List of usage examples for org.eclipse.jface.viewers IDecoration addSuffix
void addSuffix(String suffix);
From source file:de.jcup.egradle.eclipse.ide.decorators.EGradleProjectDecorator.java
License:Apache License
@Override public void decorate(Object element, IDecoration decoration) { /* no decoration when plugin is not running */ if (IDEActivator.getDefault() == null) { return;//from w w w . j av a 2 s .com } /* no decoration when workbench is not running */ if (!PlatformUI.isWorkbenchRunning()) { return; } /* do not decoratore if its not a project */ if (!(element instanceof IProject)) { return; } IProject p = (IProject) element; File rootFolder = getRootProjectFolderWithoutErrorHandling(); if (rootFolder == null) { return; } if (hasVirtualRootProjectNature(p)) { decoration.addPrefix("EGradle "); decoration.addSuffix(" (" + rootFolder.getName() + ")"); decorateImage(decoration); /* * Because the virtual root project is not hosted in SCM - at least * with GIT, there is always an ugly question icon at * IDecoration.BOTTOM_RIGHT . To avoid this we simply render an * empty deocorator here. This is okay, because diff changes in * project are rendered as usual */ decoration.addOverlay(emptyDecoratorDescriptor, IDecoration.BOTTOM_RIGHT); return; } /* we simply check if the project is inside root project */ try { if (!isSubprojectOfCurrentRootProject(p)) { return; } if (IDEUtil.getPreferences().isSubProjectIconDecorationEnabled()) { decorateImage(decoration); } } catch (CoreException e) { IDEUtil.logError("Was not able to decorate sub project:" + p, e); } }
From source file:eclox.core.ui.DoxyfileDecorator.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration) *///w w w. j a v a 2s . co m public void decorate(Object element, IDecoration decoration) { if (Doxyfile.isDoxyfile(element)) { Doxyfile doxyfile = new Doxyfile((IFile) element, null); BuildJob job = BuildJob.findJob(doxyfile); if (job != null && job.getState() == BuildJob.RUNNING) { decoration.addOverlay(ImageDescriptor.createFromFile(this.getClass(), "build_co.gif"), IDecoration.BOTTOM_LEFT); decoration.addSuffix(" (building...)"); } } }
From source file:gov.redhawk.eclipsecorba.idl.provider.decorator.IdlInterfaceDclDecorator.java
License:Open Source License
/** * {@inheritDoc}/*from w w w. j a va 2 s . c o m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { if (!(element instanceof EObject || element instanceof FeatureMap.Entry || element instanceof IWrapperItemProvider)) { return; } EObject object = null; if (element instanceof EObject) { object = (EObject) element; } else { final Object unwrapped = AdapterFactoryEditingDomain.unwrap(element); if (unwrapped instanceof EObject) { object = (EObject) unwrapped; } } if (object instanceof IdlInterfaceDcl) { final IdlInterfaceDcl inter = (IdlInterfaceDcl) object; final StringBuilder label = new StringBuilder(); if (!inter.getInheritedInterfaces().isEmpty()) { label.append(" -> "); for (final Iterator<IdlInterfaceDcl> i = inter.getInheritedInterfaces().iterator(); i.hasNext();) { label.append(i.next().getName()); if (i.hasNext()) { label.append(", "); } } } decoration.addSuffix(label.toString()); } }
From source file:gov.redhawk.ide.debug.internal.ui.LocalLaunchDecorator.java
License:Open Source License
/** * {@inheritDoc}/*w w w .j a v a 2s.co m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof LocalLaunch) { final LocalLaunch ll = (LocalLaunch) element; final ILaunch launch = ll.getLaunch(); if (launch != null && ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode())) { decoration.addSuffix(" < DEBUGGING > "); } } }
From source file:gov.redhawk.ide.spd.internal.ui.editor.provider.PrimaryImplementationDecorator.java
License:Open Source License
/** * {@inheritDoc}/*from www. j ava 2 s . c o m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { if (!(element instanceof EObject || element instanceof FeatureMap.Entry || element instanceof IWrapperItemProvider)) { return; } EObject object = null; if (element instanceof EObject) { object = (EObject) element; } else { final Object unwrapped = AdapterFactoryEditingDomain.unwrap(element); if (unwrapped instanceof EObject) { object = (EObject) unwrapped; } } if (object instanceof Implementation) { final Implementation impl = (Implementation) object; final ImplementationSettings settings = CodegenUtil.getImplementationSettings(impl); if ((settings != null) && settings.isPrimary()) { decoration.addSuffix(" *"); } } }
From source file:gov.redhawk.sca.internal.ui.ScaDomainManagerDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { if (element instanceof ScaDomainManager) { ScaUiPlugin.getDefault().getImageRegistry().getDescriptor(ScaUiPluginImages.IMG_DEFAULT_DOMAIN_OVR); final ScaDomainManager domMgr = (ScaDomainManager) element; ScaModelCommand.execute(domMgr, new ScaModelCommand() { @Override// w w w . j a v a 2 s . co m public void execute() { if (!domMgr.eAdapters().contains(adapter)) { domMgr.eAdapters().add(ScaDomainManagerDecorator.this.adapter); } } }); switch (domMgr.getState()) { case CONNECTED: decoration.addSuffix(" CONNECTED"); break; case DISCONNECTED: decoration.addSuffix(" DISCONNECTED"); break; case DISCONNECTING: decoration.addSuffix(" DISCONNECTING"); break; case CONNECTING: decoration.addSuffix(" CONNECTING"); break; case FAILED: decoration.addSuffix(" FAILED"); break; default: break; } } }
From source file:net.bioclipse.structuredb.viewer.StructureDBLightweightLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { try {//from w w w .j a v a2 s .com if (element instanceof StructureDBInstance) { int n = ((StructureDBInstance) element).getNumberOfMolecules(); decoration.addSuffix(" [" + n + "]"); } if (element instanceof Label) { int n = ((Label) element).getNumberOfMolecules(); decoration.addSuffix(" [" + n + "]"); } } catch (Exception e) { logger.debug("Exception when trying to decorate StructureDB " + "part of databaseview"); LogUtils.debugTrace(logger, e); } }
From source file:net.sf.freeqda.view.projectview.TextNodeLightweightDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { TextNode text = (TextNode) element;/* w ww . j a v a 2s .c o m*/ if (text.isActivated()) { decoration.addPrefix(PREFIX_ACTIVATED); } else { decoration.addPrefix(PREFIX_DEACTIVATED); } if (text.getCodeCounter() > 0) decoration.addSuffix(CODE_COUNT_PREFIX + text.getCodeCounter() + CODE_COUNT_POSTFIX); }
From source file:net.sf.freeqda.view.tagview.TagNodeLightweightDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { TagNode tag = (TagNode) element;/* w w w .j av a 2 s .co m*/ if (tag.getOccuranceCounter() >= 0) decoration.addSuffix(COUNTER_PREFIX + tag.getOccuranceCounter() + COUNTER_POSTFIX); }
From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java
License:Open Source License
/** * Adds decoration for checked out state. * //from w w w. j a v a2 s.com * @param decoration */ private static void decorateCheckedOut(IDecoration decoration, String version) { if (ClearCaseUI.DEBUG_DECORATION) { ClearCaseUI.trace(DECORATOR, " decorateCheckedOut"); //$NON-NLS-1$ } if (ClearCaseUIPreferences.decorateClearCaseElements()) decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY); decoration.addOverlay(IMG_DESC_CHECKED_OUT); if (ClearCaseUIPreferences.decorateElementStatesWithTextPrefix()) { decoration.addPrefix(ClearCaseUI.getTextPrefixDirty()); } if (ClearCaseUIPreferences.decorateElementsWithVersionInfo() && null != version) { decoration.addSuffix(" " + version); //$NON-NLS-1$ } }