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:ch.elexis.core.ui.contacts.decorator.ContactTypeDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    IContact contact = (IContact) element;
    if (contact.isDeleted()) {
        ImageDescriptor deleted = Images.IMG_DELETE.getImageDescriptor();
        decoration.addOverlay(deleted, IDecoration.TOP_LEFT);
    }//  ww  w  .  j av a 2 s.c  om

    if (contact.isMandator()) {
        ImageDescriptor vip = Images.IMG_VIP_OVERLAY.getImageDescriptor();
        decoration.addOverlay(vip, IDecoration.BOTTOM_RIGHT);
    }
    if (contact.isUser()) {
        FieldDecoration info = FieldDecorationRegistry.getDefault()
                .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
        ImageDescriptor infoD = ImageDescriptor.createFromImage(info.getImage());
        decoration.addOverlay(infoD, IDecoration.BOTTOM_LEFT);
    }
}

From source file:com.android.ide.eclipse.adt.internal.project.FolderDecorator.java

License:Open Source License

public void doDecoration(IDecoration decoration, String suffix) {
    decoration.addOverlay(mDescriptor, IDecoration.TOP_LEFT);

    if (suffix != null) {
        decoration.addSuffix(suffix);/*from   w  w  w. ja  va2 s.co  m*/
    }
}

From source file:com.android.ide.eclipse.adt.project.FolderDecorator.java

License:Open Source License

public void doDecoration(IDecoration decoration, String suffix) {
    decoration.addOverlay(mDescriptor, IDecoration.TOP_LEFT);

    if (suffix != null) {
        decoration.addSuffix(suffix);//from   w w  w .jav  a 2  s .co m

        // this is broken as it changes the color of the whole text, not only of the decoration.
        // TODO: figure out how to change the color of the decoration only.
        //            ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
        //            ColorRegistry registry = theme.getColorRegistry();
        //            decoration.setForegroundColor(
        //                    registry.get("org.eclipse.jdt.ui.ColoredLabels.decorations")); //$NON-NLS-1$
    }

}

From source file:com.aptana.editor.js.contentassist.JSModelFormatter.java

License:Open Source License

/**
 * getImage/*from  w  w w.j av a  2  s. c o  m*/
 * 
 * @param property
 * @return
 */
public Image getImage(PropertyElement property) {
    String key = "property"; //$NON-NLS-1$
    Image result = PROPERTY;
    if (property instanceof FunctionElement) {
        key = "function"; //$NON-NLS-1$
        result = TYPE_IMAGE_MAP.get(JSTypeConstants.FUNCTION_TYPE);
    }

    if (property != null) {
        List<String> types = property.getTypeNames();

        if (types != null && types.size() == 1) {
            String type = types.get(0);

            if (TYPE_IMAGE_MAP.containsKey(type)) {
                result = TYPE_IMAGE_MAP.get(type);
                key = type;
            } else if (type.startsWith(JSTypeConstants.DYNAMIC_CLASS_PREFIX)) {
                result = TYPE_IMAGE_MAP.get(JSTypeConstants.OBJECT_TYPE);
                key = "object"; //$NON-NLS-1$
            } else if (type.startsWith(JSTypeConstants.FUNCTION_TYPE)) {
                result = TYPE_IMAGE_MAP.get(JSTypeConstants.FUNCTION_TYPE);
                key = "function"; //$NON-NLS-1$
            } else if (type.endsWith(JSTypeConstants.ARRAY_LITERAL)) {
                result = TYPE_IMAGE_MAP.get(JSTypeConstants.ARRAY_TYPE);
                key = "array"; //$NON-NLS-1$
            }
        }
        if (property.isClassProperty()) {
            key += ".static"; //$NON-NLS-1$
            result = addOverlay(result, STATIC_OVERLAY, IDecoration.TOP_RIGHT, key);
        }
        if (property.isDeprecated()) {
            key += ".deprecated"; //$NON-NLS-1$
            result = addOverlay(result, DEPRECATED_OVERLAY, IDecoration.TOP_LEFT, key);
        }
    }
    return result;
}

From source file:com.archimatetool.editor.diagram.ArchimateDiagramEditorActionBarContributor.java

License:Open Source License

@Override
protected void buildActions() {
    super.buildActions();

    // Show Structural Chains
    RetargetAction retargetAction = new LabelRetargetAction(ShowStructuralChainsAction.ID,
            ShowStructuralChainsAction.DEFAULT_TEXT);
    retargetAction.setImageDescriptor(/*from  w w  w  . j a  v a 2 s.  c o m*/
            IArchimateImages.ImageFactory.getImageDescriptor(IArchimateImages.ICON_DERIVED_16));
    addRetargetAction(retargetAction);

    // Create Derived Relation
    retargetAction = new RetargetAction(CreateDerivedRelationAction.ID, CreateDerivedRelationAction.TEXT);
    retargetAction.setImageDescriptor(new DecorationOverlayIcon(
            IArchimateImages.ImageFactory.getImage(IArchimateImages.ICON_DERIVED_SM_16),
            IArchimateImages.ImageFactory.getImageDescriptor(IArchimateImages.ICON_NEW_OVERLAY_16),
            IDecoration.TOP_LEFT));
    addRetargetAction(retargetAction);

    // Delete From Model
    retargetAction = new RetargetAction(DeleteFromModelAction.ID, DeleteFromModelAction.TEXT);
    addRetargetAction(retargetAction);

    // Viewpoints
    for (IViewpoint viewPoint : ViewpointsManager.INSTANCE.getAllViewpoints()) {
        retargetAction = new RetargetAction(viewPoint.getClass().toString(), viewPoint.getName(),
                IAction.AS_RADIO_BUTTON);
        // Looks better as a checkbox
        //retargetAction.setImageDescriptor(ViewpointsManager.INSTANCE.getImageDescriptor(viewPoint));
        addRetargetAction(retargetAction);
    }
}

From source file:com.arm.cmsis.pack.project.ui.RteProjectDecorator.java

License:Open Source License

private void addOverlay(IDecoration decoration, String iconFile) {
    ImageDescriptor descriptor = CpPlugInUI.getImageDescriptor(iconFile);
    if (descriptor == null)
        return;/*from   w w  w .j  a v a  2 s . co  m*/
    decoration.addOverlay(descriptor, IDecoration.TOP_LEFT);
}

From source file:com.bb.extensions.plugin.unittests.internal.navigator.decorators.MocksUpdateDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof MocksUnitTestsNavigatorElement) {
        MocksUnitTestsNavigatorElement mocksElement = (MocksUnitTestsNavigatorElement) element;
        if (mocksElement.isUpToDate() == false) {
            AbstractUIPlugin plugin = Activator.getDefault();
            ImageRegistry imageRegistry = plugin.getImageRegistry();
            ImageDescriptor outOfDateImageDescriptor = imageRegistry.getDescriptor(Activator.outOfDateImageId);

            decoration.addOverlay(outOfDateImageDescriptor, IDecoration.TOP_LEFT);
        }/*from  w  ww  .j  a v a 2 s  .c  o m*/
    }
}

From source file:com.centimia.orm.jaqu.plugin.decorator.ResourceDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFile) {
        String isJaqu = Activator.getDefault().getPreferenceStore()
                .getString(((IFile) element).getProject().getName() + "_" + ((IFile) element).getName());
        if (!"".equals(isJaqu)) {
            ((DecorationContext) decoration.getDecorationContext()).putProperty(IDecoration.ENABLE_REPLACE,
                    Boolean.TRUE);
            decoration.addOverlay(getFileImageDescriptor(), IDecoration.TOP_LEFT);
        }/* w w w. j av  a2s.c o  m*/
    }
}

From source file:com.google.gdt.eclipse.managedapis.ui.ApiListingItem.java

License:Open Source License

private Image createUpdateAvailableImage(Image image) {
    try {/*from ww  w.  ja  v a 2s .com*/
        ImageDescriptor overlayIcon = resources.getUpdateAvailableOverlay16ImageDescriptor();

        DecorationOverlayIcon overlayDescriptor = new DecorationOverlayIcon(image, overlayIcon,
                IDecoration.TOP_LEFT);

        return resources.getResourceManager().createImage(overlayDescriptor);
    } catch (MalformedURLException e) {
        return image;
    }
}

From source file:com.mercatis.lighthouse3.ui.operations.ui.LighthouseOperationsDecorator.java

License:Apache License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof Deployment) {
        Deployment deployment = (Deployment) element;
        Integer installedCounter = decoratedDeployments.get(deployment);
        if (installedCounter == null) {
            installedCounter = OperationBase.getOperationInstallationService().findAtDeployment(deployment)
                    .size();//from   www  . j  a v  a2  s .  com
            decoratedDeployments.put(deployment, installedCounter);
        }
        if (installedCounter > 0) {
            decoration.addOverlay(image, IDecoration.TOP_LEFT);
        }
    }
}