Example usage for org.eclipse.jface.viewers IDecoration TOP_LEFT

List of usage examples for org.eclipse.jface.viewers IDecoration TOP_LEFT

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers IDecoration TOP_LEFT.

Prototype

int TOP_LEFT

To view the source code for org.eclipse.jface.viewers IDecoration TOP_LEFT.

Click Source Link

Document

Constants for placement of image decorations.

Usage

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for edited state.//from   ww  w.  j  a  va2 s  .  c  om
 * 
 * @param decoration
 */
private static void decorateEdited(IDecoration decoration) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateEdited"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (ClearCaseUIPreferences.decorateEditedElements()) {
        decoration.addOverlay(IMG_DESC_EDITED);
    }
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixEdited());
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for hijaced state.//from w  w  w  .  ja  va2s  . com
 * 
 * @param decoration
 */
private static void decorateHijacked(IDecoration decoration, String version) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateHijacked"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (ClearCaseUIPreferences.decorateHijackedElements()) {
        decoration.addOverlay(IMG_DESC_HIJACKED);
    }
    if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) {
        decoration.addPrefix(ClearCaseUI.getTextPrefixHijacked());
    }
    if (ClearCaseUIPreferences.decorateElementsWithVersionInfo() && null != version) {
        decoration.addSuffix("  " + version); //$NON-NLS-1$
    }
}

From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java

License:Open Source License

/**
 * Adds decoration for links./*from  w  ww  . ja  va2s. c  o m*/
 * 
 * @param decoration
 * @param isLinkTargetCheckedOut
 */
private static void decorateLink(IDecoration decoration, String linkTarget, boolean isValidLinkTarget,
        boolean isLinkTargetCheckedOut) {
    if (ClearCaseUI.DEBUG_DECORATION) {
        ClearCaseUI.trace(DECORATOR, "  decorateLink"); //$NON-NLS-1$
    }
    if (ClearCaseUIPreferences.decorateClearCaseElements())
        decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY);
    if (isLinkTargetCheckedOut) {
        decoration.addOverlay(IMG_DESC_CHECKED_OUT);
    } else if (isValidLinkTarget) {
        decoration.addOverlay(IMG_DESC_LINK);
    } else {
        decoration.addOverlay(IMG_DESC_LINK_WARNING);
    }

    decoration.addSuffix(" --> " + linkTarget); //$NON-NLS-1$
}

From source file:net.sourceforge.taggerplugin.preferences.TaggerPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.//  w w  w  . j  av a  2s  .  c  o m
 */
public void createFieldEditors() {
    addField(new BooleanFieldEditor(PreferenceConstants.CONFIRM_CLEAR_ASSOCIATIONS.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_ConfirmClear, getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.CONFIRM_DELETE_TAG.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_ConfirmDelete, getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(PreferenceConstants.POSITION_LABEL_DECORATION.getKey(),
            TaggerMessages.TaggerPreferencePage_Label_LabelDecoration, 1,
            new String[][] {
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_TopRight,
                            String.valueOf(IDecoration.TOP_RIGHT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_TopLeft,
                            String.valueOf(IDecoration.TOP_LEFT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_BottomRight,
                            String.valueOf(IDecoration.BOTTOM_RIGHT) },
                    { TaggerMessages.TaggerPreferencePage_Label_LabelDecoration_BottomLeft,
                            String.valueOf(IDecoration.BOTTOM_LEFT) } },
            getFieldEditorParent()));

    //       FIXME: externalize
    addField(new FileFieldEditor(PreferenceConstants.TAGSET_FILE_LOCATION.getKey(), "TagSet Storage File:",
            true, getFieldEditorParent()));
}

From source file:net.sourceforge.tagsea.core.ui.decorators.WaypointDecorator.java

License:Open Source License

/**
 * //from  w w w .  j  av  a2s. c  o m
 */
public WaypointDecorator() {
    this.listeners = new HashMap<ILabelProviderListener, MarkerChangeListener>();
    descriptor = TagSEAPlugin.getImageDescriptor(iconPath);
    parentDescriptor = TagSEAPlugin.getImageDescriptor(parentIconPath);
    quadrant = IDecoration.TOP_LEFT;
}

From source file:org.apache.directory.studio.ldapbrowser.ui.views.browser.BrowserViewLabelDecorator.java

License:Apache License

/**
 * {@inheritDoc}// w ww  . ja va  2s. c o  m
 */
public void decorate(Object element, IDecoration decoration) {
    IEntry entry = null;
    if (element instanceof ISearchResult) {
        entry = ((ISearchResult) element).getEntry();
        decoration.addOverlay(
                BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_SEARCHRESULT),
                IDecoration.BOTTOM_RIGHT);
    } else if (element instanceof IEntry) {
        entry = (IEntry) element;
        if (entry.getChildrenFilter() != null) {
            decoration.addOverlay(
                    BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_FILTERED),
                    IDecoration.BOTTOM_RIGHT);
        }
    }

    if (entry instanceof IContinuation || element instanceof IContinuation) {
        decoration.addOverlay(BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_OVR_REF),
                IDecoration.TOP_LEFT);
    }
}

From source file:org.cs3.pdt.navigator.internal.decorators.PDTConsultDecoratorContributor.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    if (!(element instanceof IFile) && !(element instanceof IFolder)) {
        return;//from  w ww.j  a  v  a  2s  .co m
    }

    try {
        // get active pif from console
        PrologInterface currentPif = PDTCommonUtil.getActivePrologInterface();

        if (currentPif == null) {
            if (element instanceof IFile) {
                decoration.addOverlay(
                        ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_UNCONSULTED),
                        IDecoration.UNDERLAY);
            }
            return;
        }

        if (element instanceof IFile) {
            IFile file = (IFile) element;

            //         final DecorationContext decorationContext = (DecorationContext) decoration.getDecorationContext();
            //         decorationContext.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);

            // check if file is in consulted files list (important for qlf files)
            String prologFileName = getPrologFileName(file);

            // XXX: don't mark qlf file if only the pl file is consulted 
            if (prologFileName.endsWith(".qlf")) {
                prologFileName = prologFileName.substring(0, prologFileName.length() - 3) + "pl";
            }
            // check if file is source_file
            if (isCurrent(prologFileName)) {
                decoration.addSuffix(" [consulted]");
                if (file.getFileExtension().equalsIgnoreCase("QLF")) {
                    decoration.addOverlay(
                            ImageRepository.getImageDescriptor(ImageRepository.QLF_FILE_CONSULTED),
                            IDecoration.BOTTOM_LEFT);
                } else {
                    decoration.addOverlay(
                            ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_CONSULTED),
                            IDecoration.UNDERLAY);
                }
            } else if (isOld(prologFileName)) {
                decoration.addSuffix(" [consulted]");
                if (file.getFileExtension().equalsIgnoreCase("QLF")) {
                    decoration.addOverlay(
                            ImageRepository.getImageDescriptor(ImageRepository.QLF_FILE_CONSULTED_OLD),
                            IDecoration.BOTTOM_LEFT);
                } else {
                    decoration.addOverlay(
                            ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_CONSULTED_OLD),
                            IDecoration.UNDERLAY);
                }
            } else {
                decoration.addOverlay(
                        ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FILE_UNCONSULTED),
                        IDecoration.UNDERLAY);
            }
        } else {
            IFolder folder = (IFolder) element;
            String dirName = Util.prologFileName(folder.getRawLocation().toFile());

            if (isContainingFolder(dirName)) {
                decoration.addOverlay(
                        ImageRepository.getImageDescriptor(ImageRepository.PROLOG_FOLDER_CONSULTED),
                        IDecoration.TOP_LEFT);
            }
        }
    } catch (Exception e) {
        Debug.error("Error during decoration of " + (element == null ? null : element.toString()));
        Debug.report(e);
    }

}

From source file:org.eclipse.ajdt.internal.ui.lazystart.AdviceImageDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    // add the orange triangle to the icon if this method, 
    // class or aspect is advised
    if ((element instanceof IMethod || element instanceof SourceType)) {
        IJavaElement je = (IJavaElement) element;
        IJavaProject jp = je.getJavaProject();
        // only query the model if the element is in an AJ project
        if ((jp != null) && Utils.isAJProject(jp.getProject()) && !(je instanceof AspectJMemberElement)) {
            if (AJProjectModelFactory.getInstance().getModelForJavaElement(je).isAdvised(je)) {
                ensureAdviceListenerIsRegistered();
                // causes bundle activation
                AspectJUIPlugin.getDefault();
                decoration.addOverlay(AspectJImages.ADVICE_OVERLAY.getImageDescriptor(), IDecoration.TOP_LEFT);
            }//from   www  .  ja  v a2 s  .co  m
        }
    }
}

From source file:org.eclipse.cdt.internal.ui.viewsupport.IndexedFilesLabelProvider.java

License:Open Source License

/**
 * Adds the linked resource overlay if the given element is a linked
 * resource.// w  w w  . j a  va 2 s .  c  om
 * 
 * @param element element to decorate
 * @param decoration  The decoration we are adding to
 * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(Object, IDecoration)
 */
@Override
public void decorate(Object element, IDecoration decoration) {
    IIndexFileLocation ifl = null;
    IProject project = null;
    if (element instanceof IFile) {
        final IFile file = (IFile) element;
        ifl = IndexLocationFactory.getWorkspaceIFL(file);
        project = file.getProject();
    } else if (element instanceof ITranslationUnit) {
        final ITranslationUnit tu = (ITranslationUnit) element;
        ifl = IndexLocationFactory.getIFL(tu);
        project = tu.getCProject().getProject();
    }
    if (isIndexed(project, ifl)) {
        decoration.addOverlay(INDEXED, IDecoration.TOP_LEFT);
    }
}

From source file:org.eclipse.compare.internal.patch.DecoratorOverlayIcon.java

License:Open Source License

/**
 * Draw the overlays for the receiver.//from  w  w w  .  java  2 s  .  c  o m
 * @param overlaysArray the overlay images
 */
protected void drawOverlays(ImageDescriptor[] overlaysArray) {

    for (int i = 0; i < overlays.length; i++) {
        ImageDescriptor overlay = overlaysArray[i];
        if (overlay == null) {
            continue;
        }
        ImageData overlayData = overlay.getImageData();
        //Use the missing descriptor if it is not there.
        if (overlayData == null) {
            overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData();
        }
        switch (i) {
        case IDecoration.TOP_LEFT:
            drawImage(overlayData, 0, 0);
            break;
        case IDecoration.TOP_RIGHT:
            drawImage(overlayData, size.x - overlayData.width, 0);
            break;
        case IDecoration.BOTTOM_LEFT:
            drawImage(overlayData, 0, size.y - overlayData.height);
            break;
        case IDecoration.BOTTOM_RIGHT:
            drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height);
            break;
        }
    }
}