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.eclipse.wst.server.ui.internal.cnf.ServerDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IServer) {
        IServer server = (IServer) element;
        String state = getServerStateLabel(server);
        String status = getServerStatusLabel(server);

        decoration.addSuffix(combine(state, status));
    } else if (element instanceof ModuleServer) {
        ModuleServer module = (ModuleServer) element;
        String state = getModuleStateText(module);
        String status = getModuleStatusText(module);

        decoration.addSuffix(combine(state, status));
    }// w w w .j  a va  2  s  .  com
}

From source file:org.eclipse.wst.server.ui.internal.ModuleLabelDecorator2.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    try {/*  ww w  .  j a  v  a2s .  c  o m*/
        IModule module = null;

        if (element instanceof IServer) {
            decoration.addSuffix(" *");
            return;
        }

        if (element instanceof IModule) {
            module = (IModule) element;
        } else if (element instanceof ModuleServer) {
            IModule[] modules = ((ModuleServer) element).module;
            module = modules[modules.length - 1];
        }
        if (module == null)
            return;

        IProject project = module.getProject();
        if (project == null)
            return;

        String text = module.getName();

        if (!project.getName().equals(text))
            decoration.addSuffix(" (" + project.getName() + ")");
        //text = NLS.bind(Messages.moduleDecoratorProject, new String[] {text, project.getName()});
        //return PlatformUI.getWorkbench().getDecoratorManager().decorateText(text, project);
    } catch (Exception e) {
        return;
    }
}

From source file:org.entirej.ide.ui.decorators.FormNameDecorator.java

License:Apache License

public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IFile && isFormFile((IFile) element)) {
        IFile file = (IFile) element;// w  ww  .ja  v  a2s  .c om
        String formName = EntireJFormReader.readFormName(file, true);
        if (formName != null && formName.length() > 0) {
            decoration.addSuffix(" ");
            decoration.addSuffix(formName);
        }

    }
}

From source file:org.grails.ide.eclipse.ui.GrailsClasspathContainerDecorator.java

License:Open Source License

/**
 * Decorates the given <code>element</code>.
 *///  ww  w .j av  a  2 s .c o  m
public void decorate(Object element, IDecoration decoration) {
    // decorate the class path container and add the originating target runtime
    if (element instanceof ClassPathContainer) {
        ClassPathContainer container = (ClassPathContainer) element;
        if (container.getClasspathEntry().getPath().equals(GrailsClasspathContainer.CLASSPATH_CONTAINER_PATH)) {
            try {
                if (container.getJavaProject().getProject().isAccessible()
                        && container.getJavaProject().isOpen()) {
                    GrailsClasspathContainer cpContainer = (GrailsClasspathContainer) JavaCore
                            .getClasspathContainer(GrailsClasspathContainer.CLASSPATH_CONTAINER_PATH,
                                    container.getJavaProject());
                    decoration.addSuffix(cpContainer.getDescriptionSuffix());
                }
            } catch (JavaModelException e) {
            }
        }
    }
}

From source file:org.guvnor.tools.GuvnorDecorator.java

License:Apache License

private void addResourceDetails(IResource resource, IDecoration decoration) throws Exception {
    GuvnorMetadataProps props = GuvnorMetadataUtils.getGuvnorMetadata(resource);
    if (props.getVersion() != null) {
        boolean showRevision = GuvnorPreferencePage.shouldShowRevision();
        boolean showDateTime = GuvnorPreferencePage.shouldShowTimeDateStamp();
        if (showRevision || showDateTime) {
            decoration.addSuffix(" "); //$NON-NLS-1$
        }//from  w  ww.ja  va  2s  . co m
        if (showRevision) {
            decoration.addSuffix(props.getRevision());
        }
        if (showDateTime) {
            if (showRevision) {
                decoration.addSuffix(", " + props.getVersion()); //$NON-NLS-1$
            } else {
                decoration.addSuffix(props.getVersion());
            }
        }
    }
}

From source file:org.guvnor.tools.GuvnorDecorator.java

License:Apache License

private void addChangeIndicator(IResource resource, IDecoration decoration) throws CoreException {
    if (!GuvnorMetadataUtils.isGuvnorResourceCurrent(resource)
            && GuvnorPreferencePage.shouldShowChangeIndicator()) {
        decoration.addSuffix(" >"); //$NON-NLS-1$
    }//from www . j ava 2 s. c  o  m
}

From source file:org.jboss.ide.eclipse.as.ui.views.server.extensions.XPathDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    String decoration2 = getDecoration(element);
    if (decoration2 != null) {
        decoration.addSuffix(decoration2);
    }//from   www  .j a  v a 2s .  c  o m
}

From source file:org.jlibrary.client.ui.repository.decorators.DecoratorNode.java

License:Open Source License

/**
 * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
 *///  www  .j ava  2  s . c  o  m
public void decorate(Object element, IDecoration decoration) {

    decoration.addOverlay(SharedImages.getImageDescriptor(SharedImages.IMAGE_USER));
    decoration.addSuffix("*");
}

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

License:Open Source License

private void decorateBuilding(final IProfileObject building, final IDecoration decoration) {
    final String typeLabel = building.getTypeLabel();

    /* suffix *///from w  w  w  . ja  va2  s  .c  o m
    if (building instanceof ICulvertBuilding)
        decoration.addSuffix(String.format(Messages.getString("WspmBuildingDecorator_0"), typeLabel)); //$NON-NLS-1$
    else if (building instanceof GenericProfileHorizon) {
        // FIXME: remove this label
        //      final String id = building.getType();
        //      decoration.addSuffix( String.format( " ('%s')", id ) );
    } else
        decoration.addSuffix(String.format(" (%s)", typeLabel)); //$NON-NLS-1$

    /* icon */
    final ImageDescriptor buildingImage = getBuildingImage(building);
    if (buildingImage != null)
        decoration.addOverlay(buildingImage, IDecoration.REPLACE);
}

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

License:Open Source License

private void decorateProfile(final IProfileFeature profileFeature, final IDecoration decoration) {
    if (profileFeature == null)
        return;//from   w w w .j av  a2s .  com

    final IProfile profile = profileFeature.getProfile();
    if (profile == null)
        return;

    /* find worst marker */
    final MarkerIndex markerIndex = profile.getProblemMarker();
    if (markerIndex == null)
        return;

    final IMarker[] markers = markerIndex.getMarkers();
    final IMarker worst = MarkerUtils.worstOf(markers);
    if (worst == null)
        return;

    final int severity = MarkerUtils.getSeverity(worst);

    /* do not decorate info */
    if (severity == IMarker.SEVERITY_INFO)
        return;

    /* do the decoration */
    final ImageDescriptor imageDescriptor = getImage(severity);

    final String message = worst.getAttribute(IMarker.MESSAGE, null);
    final String kindText = getKindtext(severity);

    decoration.addSuffix(String.format(" (%s: %s)", kindText, message)); //$NON-NLS-1$

    decoration.addOverlay(imageDescriptor, IDecoration.BOTTOM_RIGHT);
}