List of usage examples for org.eclipse.jface.viewers IDecoration addSuffix
void addSuffix(String suffix);
From source file:org.eclipse.scada.ide.hd.hdsspy.decorators.TimeRangeDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { try {//w w w . j a va2 s . c o m final IFile resource = (IFile) element; final String timeframe = getTimeframe(resource); if (timeframe != null) { decoration.addSuffix(" " + timeframe); } } catch (final Exception e) { } }
From source file:org.eclipse.team.internal.ccvs.ui.CVSDecoration.java
License:Open Source License
public void apply(IDecoration decoration) { compute();/*from w w w .j av a 2 s . co m*/ // apply changes String suffix = getSuffix(); if (suffix != null) decoration.addSuffix(suffix); String prefix = getPrefix(); if (prefix != null) decoration.addPrefix(prefix); ImageDescriptor overlay = getOverlay(); if (overlay != null) decoration.addOverlay(overlay); Color bc = getBackgroundColor(); if (bc != null) decoration.setBackgroundColor(bc); Color fc = getForegroundColor(); if (fc != null) decoration.setForegroundColor(fc); Font f = getFont(); if (f != null) decoration.setFont(f); }
From source file:org.eclipse.team.svn.ui.decorator.DecoratorVariables.java
License:Open Source License
public void decorateText(IDecoration decoration, IVariable[] format, IVariableContentProvider provider) { int centerPoint = Arrays.asList(format).indexOf(this.variableSetProvider.getCenterVariable()); String prefix = ""; //$NON-NLS-1$ String suffix = ""; //$NON-NLS-1$ for (int i = 0; i < format.length; i++) { if (!format[i].equals(this.variableSetProvider.getCenterVariable())) { if (centerPoint != -1 && i < centerPoint) { prefix += getValue(format[i], provider); } else { suffix += getValue(format[i], provider); }//ww w . j av a2 s . co m } } // trim left/trim right int i = 0; for (; i < prefix.length() && Character.isWhitespace(prefix.charAt(i)); i++) ; prefix = prefix.substring(i); i = suffix.length() - 1; for (; i >= 0 && Character.isWhitespace(suffix.charAt(i)); i--) ; suffix = suffix.substring(0, i + 1); decoration.addPrefix(prefix); decoration.addSuffix(suffix); }
From source file:org.eclipse.titan.log.viewer.views.navigator.FileSizeDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { if (!(element instanceof IFile)) { return;//from ww w. j a v a2 s.c o m } IFile aFile = (IFile) element; String extension = aFile.getFileExtension(); if ((extension == null) || !extension.contentEquals(Constants.LOG_EXTENSION)) { return; } try { if (!aFile.getProject().hasNature(Constants.NATURE_ID)) { return; } } catch (CoreException e) { return; } String formattedSize = getFormattedSize(aFile); decoration.addSuffix(" [" + formattedSize + ']'); //$NON-NLS-1$ }
From source file:org.eclipse.ui.dynamic.DynamicLightweightLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { decoration.addSuffix("Light"); }
From source file:org.eclipse.ui.tests.decorators.TestAdaptableDecoratorContributor.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { Assert.assertTrue(clazz.isInstance(element)); decoration.addSuffix(suffix); }
From source file:org.eclipse.ui.tests.decorators.TestLightweightDecoratorContributor.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) *///from w w w . j a v a 2 s . c om public void decorate(Object element, IDecoration decoration) { decoration.addOverlay(getOverlay(element)); decoration.addPrefix(DECORATOR_PREFIX); decoration.addSuffix(DECORATOR_SUFFIX); }
From source file:org.eclipse.virgo.ide.jdt.internal.ui.decoration.JdtClasspathContainerElementDecorator.java
License:Open Source License
/** * Decorates the given <code>element</code>. *//*from w w w. ja va 2s. c o m*/ public void decorate(Object element, IDecoration decoration) { // package fragments are the first elements below the JAR file if (element instanceof IPackageFragment) { IPackageFragment packageFragment = (IPackageFragment) element; if (shouldDecorateImportedPackageFragment(packageFragment)) { // make light gray and lock icon decoration decoration.setForegroundColor(ColorMap.GRAY_LIGHT); decoration.addOverlay(JdtUiImages.DESC_OVR_LOCKED, IDecoration.TOP_LEFT); } else if (shouldDecorateExportedPackageFragment(packageFragment)) { decoration.addOverlay(JdtUiImages.DESC_OVR_EXPORTED, IDecoration.TOP_RIGHT); } } // jar package fragments roots; decorate those that come from a test dependency else if (element instanceof IPackageFragmentRoot) { IPackageFragmentRoot root = (IPackageFragmentRoot) element; try { if (ServerClasspathContainer.CLASSPATH_CONTAINER_PATH.equals(root.getRawClasspathEntry().getPath()) && root.getJavaProject().getProject().isAccessible() && root.getJavaProject().isOpen()) { ServerClasspathContainer cpContainer = (ServerClasspathContainer) JavaCore .getClasspathContainer(ServerClasspathContainer.CLASSPATH_CONTAINER_PATH, root.getJavaProject()); if (cpContainer != null) { for (IClasspathEntry entry : cpContainer.getClasspathEntries()) { if (entry.getPath().equals(root.getPath()) && entry.getExtraAttributes() != null) { for (IClasspathAttribute attribute : entry.getExtraAttributes()) { if (attribute.getName() .equals(ServerClasspathContainer.TEST_CLASSPATH_ATTRIBUTE_VALUE)) { decoration.setForegroundColor(ColorMap.GRAY_LIGHT); decoration.addOverlay(JdtUiImages.DESC_OVR_LOCKED, IDecoration.TOP_LEFT); } } break; } } } } } catch (JavaModelException e) { } } // class files represent a single type file in a JAR else if (element instanceof IClassFile) { IClassFile classFile = (IClassFile) element; if (classFile.getParent() instanceof IPackageFragment) { if (shouldDecorateImportedPackageFragment((IPackageFragment) classFile.getParent())) { // make light gray decoration.setForegroundColor(ColorMap.GRAY_LIGHT); } } } // decorate the class path container and add the originating target runtime else if (element instanceof ClassPathContainer) { ClassPathContainer container = (ClassPathContainer) element; if (container.getClasspathEntry().getPath().equals(ServerClasspathContainer.CLASSPATH_CONTAINER_PATH)) { try { if (container.getJavaProject().getProject().isAccessible() && container.getJavaProject().isOpen()) { ServerClasspathContainer cpContainer = (ServerClasspathContainer) JavaCore .getClasspathContainer(ServerClasspathContainer.CLASSPATH_CONTAINER_PATH, container.getJavaProject()); decoration.addSuffix(cpContainer.getDescriptionSuffix()); } } catch (JavaModelException e) { } } } }
From source file:org.eclipse.virgo.ide.runtime.internal.ui.providers.ServerFileLabelProvider.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof ServerFile) { ServerFile serverFile = (ServerFile) element; String suffix = " [" + serverFile.getServer() + "] - " + serverFile.getFile().getLocation(); if (element instanceof ServerFileSelection) { suffix += " #" + ((ServerFileSelection) element).getItem(); }//from ww w .j a v a 2 s . c o m decoration.addSuffix(suffix); if (!(element instanceof ServerFileSelection)) { decoration.addOverlay(ServerUiImages.DESC_OBJ_VIRGO_OVER, IDecoration.TOP_LEFT); } } }
From source file:org.eclipse.virgo.ide.runtime.internal.ui.ServerDeploymentDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof ModuleServer) { ModuleServer mServer = (ModuleServer) element; IModule[] modules = mServer.module; IServer server = mServer.getServer(); if (modules != null && server != null) { IServerType serverType = server.getServerType(); String runtime = serverType.getRuntimeType().getId(); if (runtime.equals(ServerVersionHelper.SERVER_10) || runtime.equals(ServerVersionHelper.SERVER_20)) { boolean deployed = true; for (int i = 0; i < modules.length; i++) { IModule module = modules[i]; ServerBehaviour behaviour = (ServerBehaviour) server.getAdapter(ServerBehaviour.class); if (behaviour != null) { DeploymentIdentity identity = behaviour.getDeploymentIdentities().get(module.getId()); if (identity == null) { deployed = false; }//w ww .jav a 2 s . c o m } } if (deployed) { decoration.addSuffix(" [Deployed]"); } else { decoration.addSuffix(" [Not Running]"); } } } } }