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

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

Introduction

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

Prototype

void addSuffix(String suffix);

Source Link

Document

Adds a suffix to the element's label.

Usage

From source file:org.kalypso.model.wspm.tuhh.ui.internal.gml.WspmReachNamesDecorator.java

License:Open Source License

private void decorateProfile(final IProfileFeature profile, final IDecoration decoration) {
    final WspmWaterBody water = profile.getWater();
    if (water == null)
        return;/*from  w w  w . ja v  a 2  s. c o m*/

    final String[] reachNames = collectReachNames(water, profile);
    if (ArrayUtils.isEmpty(reachNames))
        return;

    final String names = StringUtils.join(reachNames, ", "); //$NON-NLS-1$
    final String suffix = String.format(Messages.getString("WspmReachNamesDecorator_0"), names); //$NON-NLS-1$

    final String shortenedSuffix = StringUtils.abbreviate(suffix, 255);

    decoration.addSuffix(shortenedSuffix);
}

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);
    }//from ww  w. j  a v a2 s. c o  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.editor2d.ui.decorators.VisibleDecorator.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.isVisible()) {
            ImageDescriptor invisibleImage = SharedImages.getSharedImageDescriptor(EditorPlugin.getDefault(),
                    VisibleCompositeImage.class, "", ImageDimension._8x8, ImageFormat.gif); //$NON-NLS-1$

            decoration.addOverlay(invisibleImage);
            decoration.addSuffix(
                    " [" + Messages.getString("org.nightlabs.editor2d.ui.decorators.VisibleDecorator.invisible") //$NON-NLS-1$//$NON-NLS-2$
                            + "]"); //$NON-NLS-1$
        }/*from  www  .ja v a 2  s .  c  om*/
        if (dc.isTemplate()) {
            decoration.addSuffix(
                    " [" + Messages.getString("org.nightlabs.editor2d.ui.decorators.VisibleDecorator.template") //$NON-NLS-1$//$NON-NLS-2$
                            + "]"); //$NON-NLS-1$
        }
        if (!dc.isEditable()) {
            decoration.addSuffix(Messages.getString("org.nightlabs.editor2d.ui.decorators.VisibleDecorator.0") //$NON-NLS-1$
                    + Messages.getString("org.nightlabs.editor2d.ui.decorators.VisibleDecorator.locked") //$NON-NLS-1$
                    + Messages.getString("org.nightlabs.editor2d.ui.decorators.VisibleDecorator.2")); //$NON-NLS-1$
        }
    }
}

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 w  w.  ja v a  2 s.  c  om*/
            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.opentravel.schemas.views.decoration.LibraryDecorator.java

License:Apache License

@Override
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof LibraryNode) {
        decoration.addSuffix(getLibraryDecoration((LibraryNode) element));
    } else if (element instanceof LibraryChainNode) {
        LibraryNode head = ((LibraryChainNode) element).getHead();
        decoration.addSuffix(getLibraryDecoration(head));
    } else if (element instanceof RepositoryNameNode) {
        decoration.addSuffix(getRepositoryNameDecoration((RepositoryNameNode) element));

    } else if (element instanceof RepositoryChainNode) {
        RepositoryChainNode node = (RepositoryChainNode) element;
        decoration.addSuffix(getRepositoryItemDecoration(node.getItem()));
    } else if (element instanceof NamespaceNode) {
        decoration.addSuffix(getNamespaceDecoration((NamespaceNode) element));
    }//from  ww w  .  jav a2s .c  om
}

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

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    try {/*w ww  .  j  a va  2 s . c  o  m*/
        ModelChangeSupport entity = (ModelChangeSupport) elm;
        EntityChangeStatus entityState = EntityChangeStatus.forEntity(entity);

        boolean dirty = entityState.isDirty();
        boolean pendingConflict = entityState.isConcurrentlyDirty();
        boolean conflicting = entityState.isConflicting();

        if (dirty && conflicting) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(conflictImage);
            decoration.addOverlay(ovr, IDecoration.BOTTOM_RIGHT);
            //decoration.addPrefix( "# " );
        } else if (!dirty && conflicting) {
            //ImageDescriptor ovr = ProjectPlugin.imageDescriptorFromPlugin( ProjectPlugin.PLUGIN_ID, warningImage );
            //decoration.addOverlay( ovr, IDecoration.BOTTOM_RIGHT );
            //decoration.addPrefix( "< " );
        } else if (dirty) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(dirtyImage);
            decoration.addOverlay(ovr, IDecoration.BOTTOM_RIGHT);
            //decoration.addSuffix( "*" );
        }

        // register
        decorated.put(entity.id(), entity);
    } catch (NoSuchEntityException e) {
        decoration.addSuffix(" (removed)");
    }
}

From source file:org.polymap.core.project.ui.layer.LayerStatusDecorator.java

License:Open Source License

public void decorate(Object elm, IDecoration decoration) {
    if (elm instanceof ILayer) {
        ILayer layer = (ILayer) elm;/*  w w  w  .j  a v  a2 s  .com*/

        try {
            layer.id();
        } catch (NoSuchEntityException e) {
            // handled by EntityModificationDecorator
            return;
        }

        // visible
        if (layer.isVisible()) {
            ImageDescriptor image = ProjectPlugin.getDefault().imageDescriptor(visible);
            decoration.setFont(bold);

            DecorationContext context = (DecorationContext) decoration.getDecorationContext();
            context.putProperty(IDecoration.ENABLE_REPLACE, Boolean.TRUE);
            decoration.addOverlay(image, IDecoration.REPLACE);

            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(visible_ovr);
            decoration.addOverlay(ovr, TOP_LEFT);
        }

        // inactive == not visible
        if (!layer.isVisible()) {
            decoration.setForegroundColor(INACTIVE_COLOR);
        }

        LayerStatus layerStatus = layer.getLayerStatus();
        if (layerStatus.getCode() == LayerStatus.MISSING) {
            decoration.setForegroundColor(MISSING_COLOR);
            decoration.addSuffix(Messages.get("LayerStatusDecorator_missing"));
        } else if (layerStatus.getCode() == LayerStatus.WAITING) {
            ImageDescriptor ovr = ProjectPlugin.getDefault().imageDescriptor(waiting);
            decoration.setFont(italic);
            decoration.addOverlay(ovr, TOP_RIGHT);
            decoration.addSuffix(Messages.get("LayerStatusDecorator_checking"));
        } else if (layerStatus.getSeverity() == LayerStatus.OK) {
            //
        }

        // register listener
        decorated.put(layer.id(), layer);
    }
}

From source file:org.robotframework.ide.eclipse.main.plugin.navigator.RobotValidationExcludedDecorator.java

License:Apache License

@Override
public void decorate(final Object element, final IDecoration decoration) {
    final IResource resource = RedPlugin.getAdapter(element, IResource.class);
    if (resource != null && (resource.getType() == IResource.FILE || resource.getType() == IResource.FOLDER
            || resource.getType() == IResource.PROJECT)) {
        final RobotProject robotProject = RedPlugin.getModelManager().getModel()
                .createRobotProject(resource.getProject());
        RobotProjectConfig config = robotProject.getOpenedProjectConfig();
        if (config == null) {
            config = robotProject.getRobotProjectConfig();
        }/*www .  ja v  a  2  s  .c o  m*/

        if (config != null
                && config.isExcludedFromValidation(resource.getProjectRelativePath().toPortableString())) {
            decoration.addSuffix(" [excluded]");
            decoration.setForegroundColor(ColorsManager.getColor(200, 200, 200));
        }
    }
}

From source file:org.robotframework.ide.eclipse.main.plugin.navigator.RobotVersionDecorator.java

License:Apache License

@Override
public void decorate(final Object element, final IDecoration decoration) {
    if (element instanceof RobotProjectDependencies) {
        final RobotProjectDependencies dependencies = (RobotProjectDependencies) element;

        final String additionalInfo = dependencies.getAdditionalInformation();
        if (!additionalInfo.isEmpty()) {
            decoration.addSuffix(" " + additionalInfo);
        }/*from www . j a v a2  s  .  c o  m*/
    }
}

From source file:org.seasar.dblauncher.decorator.DBRunningDecorator.java

License:Apache License

public void decorate(Object element, IDecoration decoration) {
    try {/*  w  w w  .  j a v a  2  s.  c  om*/
        if (element instanceof IAdaptable) {
            IAdaptable adaptable = (IAdaptable) element;
            IProject project = (IProject) adaptable.getAdapter(IProject.class);
            Object o = project.getSessionProperty(Constants.KEY_SERVER_STATE);
            H2Preferences pref = DbLauncherPlugin.getPreferences(project);
            if (o instanceof ITerminate) {
                ITerminate t = (ITerminate) o;
                if (t.isTerminated()) {
                    project.setSessionProperty(Constants.KEY_SERVER_STATE, null);
                } else {
                    decoration.addSuffix(" [H2:" + pref.getDbPortNo() + "]");
                    decoration.addOverlay(Images.RUNNING, IDecoration.BOTTOM_RIGHT);
                }
            }
        }
    } catch (CoreException e) {
    }

}