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:org.gw4e.eclipse.decorator.ProjectLabelDecorator.java

License:Open Source License

@Override
public Image decorateImage(Image image, Object element) {
    if (image != null) {
        if (element instanceof IProject) {
            IProject project = (IProject) element;
            boolean b = GW4ENature.hasGW4ENature(project);
            if (b) {
                DecorationOverlayIcon icon = new DecorationOverlayIcon(image, GW_DESCRIPTOR,
                        IDecoration.TOP_LEFT);
                Image ret = (Image) resourceManager.get(icon);
                return ret;
            }//ww  w. j ava  2 s . co m
        }
    }
    return image;
}

From source file:org.mxupdate.eclipse.Decorator.java

License:Apache License

public void decorate(final Object _obj, final IDecoration _idecoration) {
    final IFile file = (IFile) _obj;
    final String name = file.getName();

    for (final Map.Entry<String, Map<String, ImageDescriptor>> suffixEntry : Activator.IMAGEMAP.entrySet()) {
        if (name.endsWith(suffixEntry.getKey())) {
            for (final Map.Entry<String, ImageDescriptor> entry : suffixEntry.getValue().entrySet()) {
                if (name.startsWith(entry.getKey())) {
                    _idecoration.addOverlay(entry.getValue(), IDecoration.TOP_LEFT);
                    break;
                }//from  w ww  .j  a  va 2  s . co m
            }
            break;
        }
    }
}

From source file:org.mxupdate.eclipse.mxadapter.MXDecorator.java

License:Apache License

/**
 * Depending on the file suffixes and prefixes the related image descriptor
 * is selected and shown as decorator image.
 *
 * @param _obj          object which must be checked for decoration
 * @param _decoration   decoration from Eclipse where the images are
 *                      &quot;overlayed&quot; on the top left
 *///from   w  ww  . j  a  v  a  2  s . c  om
public void decorate(final Object _obj, final IDecoration _decoration) {
    final IFile file = (IFile) _obj;
    try {
        final IDeploymentAdapter adapter = Activator.getDefault().getAdapter(file.getProject());
        if (adapter != null) {
            final ImageDescriptor imageDesc = adapter.getImageDescriptor(file);
            if (imageDesc != null) {
                _decoration.addOverlay(imageDesc, IDecoration.TOP_LEFT);
            }
        }
    } catch (final Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.mxupdate.eclipse.MXDecorator.java

License:Apache License

/**
 * Depending on the file suffixes and prefixes the related image descriptor
 * is selected and shown as decorator image.
 *
 * @param _obj          object which must be checked for decoration
 * @param _decoration   decoration from Eclipse where the images are
 *                      &quot;overlayed&quot; on the top left
 *//*from w w w  .j  a va  2 s  .c  om*/
public void decorate(final Object _obj, final IDecoration _decoration) {
    final IFile file = (IFile) _obj;
    final String name = file.getName();

    for (final Map.Entry<String, Map<String, ImageDescriptor>> suffixEntry : Activator.IMAGEMAP.entrySet()) {
        if (name.endsWith(suffixEntry.getKey())) {
            for (final Map.Entry<String, ImageDescriptor> entry : suffixEntry.getValue().entrySet()) {
                if (name.startsWith(entry.getKey())) {
                    _decoration.addOverlay(entry.getValue(), IDecoration.TOP_LEFT);
                    break;
                }
            }
            break;
        }
    }
}

From source file:org.nabucco.testautomation.config.ui.rcp.multipage.config.maintenance.masterdetails.TreeNodeDecorator.java

License:Open Source License

public static void decorateNode(MasterDetailTreeNode node, Datatype datatype) {

    // Reused PropertyLists and ConfigElements should be decorated
    if (datatype instanceof TestConfigElementContainer) {
        TestConfigElement newTestConfigElement = ((TestConfigElementContainer) datatype).getElement();
        Map<Integer, String> decorations = node.getDecorations();

        if (newTestConfigElement.getReused() != null && newTestConfigElement.getReused().getValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }/*from  w  w  w . ja  v  a  2s. c om*/
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    }

    if (datatype instanceof TestConfigElement) {
        TestConfigElement newTestConfigElement = (TestConfigElement) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (newTestConfigElement.getReused() != null && newTestConfigElement.getReused().getValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    } else if (datatype instanceof PropertyList) {
        PropertyList propertyList = (PropertyList) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (propertyList.getReused() != null && propertyList.getReused().getValue() != null
                && propertyList.getReused().getValue().booleanValue()) {
            if (!decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
                decorations.put(IDecoration.BOTTOM_RIGHT, ConfigImageRegistry.ICON_REUSED.getId());
            }
        } else if (decorations.containsKey(IDecoration.BOTTOM_RIGHT)) {
            decorations.remove(IDecoration.BOTTOM_RIGHT);
        }
    }

    // Decorate "skip" and "executionType"
    if (datatype instanceof TestConfigElement) {
        TestConfigElement testConfigElement = (TestConfigElement) datatype;
        Map<Integer, String> decorations = node.getDecorations();

        if (testConfigElement.getSkip() != null && testConfigElement.getSkip().getValue() != null
                && testConfigElement.getSkip().getValue()) {
            if (!decorations.containsKey(IDecoration.TOP_LEFT)) {
                decorations.put(IDecoration.TOP_LEFT, ConfigImageRegistry.ICON_SKIP_8X8.getId());
            }
        } else if (decorations.containsKey(IDecoration.TOP_LEFT)) {
            decorations.remove(IDecoration.TOP_LEFT);
        }

        if (testConfigElement.getExecutionType() != null
                && testConfigElement.getExecutionType() == ExecutionType.MANUAL) {
            if (!decorations.containsKey(IDecoration.TOP_RIGHT)) {
                decorations.put(IDecoration.TOP_RIGHT, ConfigImageRegistry.ICON_MANUAL.getId());
            }
        } else if (decorations.containsKey(IDecoration.TOP_RIGHT)) {
            decorations.remove(IDecoration.TOP_RIGHT);
        }
    }
}

From source file:org.nabucco.testautomation.ui.rcp.multipage.engine.masterdetail.TreeNodeDecorator.java

License:Open Source License

public static void decorateNode(MasterDetailTreeNode node, ProxyConfiguration proxyConfiguration) {

    // Disabled ProxyConfigurations should be decorated
    if (proxyConfiguration != null) {
        Map<Integer, String> decorations = node.getDecorations();

        if (proxyConfiguration.getEnabled() == null || proxyConfiguration.getEnabled().getValue() == null
                || !proxyConfiguration.getEnabled().getValue().booleanValue()) {
            if (!decorations.containsKey(IDecoration.TOP_LEFT)) {
                decorations.put(IDecoration.TOP_LEFT, TestautomationImageRegistry.ICON_PROXY_DISABLED.getId());
            }// w w  w  .j  a v a 2s .c o  m
        } else {
            if (decorations.containsKey(IDecoration.TOP_LEFT)) {
                decorations.remove(IDecoration.TOP_LEFT);
            }
        }
    }
}

From source file:org.netxms.ui.eclipse.objectbrowser.ObjectDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    ObjectStatus status = ((AbstractObject) element).getStatus();
    decoration.addOverlay(statusImages[status.getValue()], IDecoration.BOTTOM_RIGHT);
    if (((AbstractObject) element).isInMaintenanceMode()) {
        decoration.addOverlay(maintModeImage, IDecoration.TOP_RIGHT);
        decoration.addSuffix(Messages.get().ObjectDecorator_MaintenanceSuffix);
        decoration.setForegroundColor(maintColor);
    }// w  ww .  j  av  a  2  s .co  m
    if (element instanceof Interface) {
        if ((((Interface) element).getOperState() == Interface.OPER_STATE_DOWN)
                && (((Interface) element).getAdminState() == Interface.ADMIN_STATE_UP)
                && (((Interface) element).getExpectedState() == Interface.EXPECTED_STATE_IGNORE))
            decoration.addOverlay(statusImages[ObjectStatus.CRITICAL.getValue()], IDecoration.TOP_LEFT);
    }
}

From source file:org.nightlabs.jfire.scripting.editor2d.ui.decorators.VisibleScriptDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof DrawComponentTreeEditPart) {
        DrawComponentTreeEditPart dctep = (DrawComponentTreeEditPart) element;
        DrawComponent dc = dctep.getDrawComponent();
        if (dc.getProperties().containsKey(ScriptingConstants.PROP_VISIBLE_SCRIPT)) {
            ImageDescriptor visibleScriptImage = SharedImages.getSharedImageDescriptor(
                    ScriptingEditor2DPlugin.getDefault(), VisibleScriptDecorator.class, "", ImageDimension._8x8, //$NON-NLS-1$
                    ImageFormat.gif);//from  w ww .j a v a  2  s .  c o m
            decoration.addOverlay(visibleScriptImage, IDecoration.TOP_LEFT);
            decoration.addSuffix("[" + Messages.getString( //$NON-NLS-1$
                    "org.nightlabs.jfire.scripting.editor2d.ui.decorators.VisibleScriptDecorator.visibleScript") //$NON-NLS-1$
                    + "]"); //$NON-NLS-1$
        }
    }
}

From source file:org.polymap.core.project.ui.project.MapStatusDecorator.java

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    if (elm instanceof IMap) {
        IMap map = (IMap) elm;//from   www . ja  v a2 s . c  o  m
        // visible
        if (map.isVisible() /*activeMaps.containsKey( map.id() )*/) {
            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(visible, IDecoration.REPLACE);
            decoration.addOverlay(visibleOvr, IDecoration.TOP_LEFT);
        }
        // empty
        if (map.getLayers().isEmpty()) {
            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(empty, IDecoration.REPLACE);
        }
        decorated.put(map.id(), map);
    }
}

From source file:org.rulez.magwas.zenta.editor.diagram.ZentaDiagramEditorActionBarContributor.java

License:Open Source License

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

    // Show Structural Chains
    RetargetAction retargetAction = new LabelRetargetAction(ShowStructuralChainsAction.ID,
            ShowStructuralChainsAction.DEFAULT_TEXT);
    retargetAction/*from   w  ww  .j a  va 2  s. c  om*/
            .setImageDescriptor(IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.ICON_DERIVED_16));
    addRetargetAction(retargetAction);

    // Create Derived Relation
    retargetAction = new RetargetAction(CreateDerivedRelationAction.ID, CreateDerivedRelationAction.TEXT);
    retargetAction.setImageDescriptor(
            new DecorationOverlayIcon(IZentaImages.ImageFactory.getImage(IZentaImages.ICON_DERIVED_SM_16),
                    IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.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);
    }
}