List of usage examples for org.eclipse.jface.viewers IDecoration addOverlay
void addOverlay(ImageDescriptor overlay, int quadrant);
From source file:metabup.decorators.MetaBupProjectDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { /**//from www .ja va 2 s .c o m * Checks that the element is an IResource with the 'Read-only' attribute * and adds the decorator based on the specified image description and the * integer representation of the placement option. */ IResource resource = (IResource) element; if (resource instanceof IProject) { IProject project = (IProject) resource; boolean mbupProject = false; try { for (String nature : project.getDescription().getNatureIds()) if (nature.equals(MetaBupProjectNature.NATURE_ID)) mbupProject = true; } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (mbupProject) { URL url = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path(iconPath), null); //NON-NLS-1 if (url == null) return; descriptor = ImageDescriptor.createFromURL(url); quadrant = IDecoration.TOP_RIGHT; decoration.addOverlay(descriptor, quadrant); } } }
From source file:metabup.sketches.decorators.LegendFolderDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { /**/*from w w w .j a va 2 s .c om*/ * Checks that the element is an IResource with the 'Read-only' attribute * and adds the decorator based on the specified image description and the * integer representation of the placement option. */ IResource resource = (IResource) element; if (resource instanceof IFolder) { IFolder folder = (IFolder) resource; try { if (folder.getPersistentProperty(SketchPersistentProperties.FOLDER_KEY) != null && folder.getPersistentProperty(SketchPersistentProperties.FOLDER_KEY) .equals(SketchPersistentProperties.FOLDER_KEY_LEGEND)) { URL url = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path(iconPath), null); //NON-NLS-1 if (url == null) return; descriptor = ImageDescriptor.createFromURL(url); quadrant = IDecoration.TOP_RIGHT; decoration.addOverlay(descriptor, quadrant); } } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:mm.eclipse.trac.views.TracLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof TracServer) { TracServer server = (TracServer) element; if (!server.isValid()) decoration.addOverlay(Images.getDescriptor(Images.Error), IDecoration.TOP_LEFT); } else if (element instanceof WikiPage) { WikiPage page = (WikiPage) element; if (page.isDirty()) { decoration.addOverlay(Images.getDescriptor(Images.Modified), IDecoration.BOTTOM_RIGHT); }/*from ww w. j a va2 s. co m*/ } }
From source file:msi.gama.lang.gaml.ui.decorators.GamlDecorator.java
@Override public void decorate(final Object element, final IDecoration deco) { if (element instanceof VirtualContent) { deco.addOverlay(((VirtualContent<?>) element).getOverlay(), BOTTOM_LEFT); } else if (element instanceof IFile) { final IFile r = (IFile) element; if (GamlFileExtension.isAny(r.getName())) try { deco.addOverlay(DESCRIPTORS.get(r.findMaxProblemSeverity(PROBLEM, true, DEPTH_INFINITE)), BOTTOM_LEFT);/* ww w . j av a 2s. c o m*/ } catch (final CoreException e) { } } }
From source file:net.bhl.cdt.ui.decorators.IsStartableDecorator.java
License:Open Source License
@Override public void decorate(Object resource, IDecoration decoration) { try {// w w w. jav a 2 s .co m if (resource instanceof ProcessElement) { ProcessElement processElement = (ProcessElement) resource; if (processElement.isStartable()) { decoration.addOverlay( ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/ready.gif"), IDecoration.TOP_RIGHT); } else decoration.addOverlay( ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/nogo.gif"), IDecoration.TOP_RIGHT); /** * Dummy Notification to get the Containment (the parent) refreshed so that decorate is called. The * containment sets a notification that itself has changed. */ processElement.eContainer() .eNotify(new ENotificationImpl((InternalEObject) processElement.eContainer(), Notification.UNSET, ProcessPackage.DESIGN_OPERATION___IS_STARTABLE, null, null)); } } catch (NullPointerException e) { e.printStackTrace(); } }
From source file:net.refractions.udig.project.ui.internal.LayerStatusDecorator.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 va 2 s . c o m*/ @SuppressWarnings("unchecked") public synchronized void decorate(Object element, IDecoration decoration) { Layer layer = (Layer) element; // should be safe, extention point does the instanceof // check ImageDescriptor ovr = statusIcon(layer); if (ovr != null) decoration.addOverlay(ovr, IDecoration.BOTTOM_LEFT); // decoration.addOverlay( ProjectUIPlugin.getDefault().getImageDescriptor( ISharedImages.SELECT_UDR ), // IDecoration.UNDERLAY ); if (!layer.eAdapters().contains(hack)) layer.eAdapters().add(hack); }
From source file:net.sf.vex.editor.config.BuildProblemDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (this.errorIcon == null) { this.loadImageDescriptors(); }/*from ww w . j ava2s.c om*/ if (element instanceof IResource) { try { IResource resource = (IResource) element; IMarker[] markers = resource.findMarkers(IMarker.PROBLEM, true, 0); if (markers.length > 0) { decoration.addOverlay(this.errorIcon, IDecoration.BOTTOM_LEFT); } } catch (CoreException e) { } } }
From source file:net.sf.vex.editor.config.PluginProjectDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (this.vexIcon == null) { this.loadImageDescriptors(); }/* w w w . j a v a 2s . c om*/ if (element instanceof IProject) { try { IProject project = (IProject) element; if (project.hasNature(PluginProjectNature.ID)) { decoration.addOverlay(this.vexIcon, IDecoration.TOP_RIGHT); } } catch (CoreException e) { } } }
From source file:net.sourceforge.c4jplugin.internal.decorators.C4JDecorator.java
License:Open Source License
private void overlay(IDecoration decoration, ImageDescriptor descriptor) { decoration.addOverlay(descriptor, DECO_POS); }
From source file:net.sourceforge.eclipseccase.ui.ClearCaseDecorator.java
License:Open Source License
/** * Adds decoration for checked in state. * //from w w w.j av a 2 s . com * @param decoration */ private static void decorateCheckedIn(IDecoration decoration) { if (ClearCaseUI.DEBUG_DECORATION) { ClearCaseUI.trace(DECORATOR, " decorateCheckedIn"); //$NON-NLS-1$ } if (ClearCaseUIPreferences.decorateClearCaseElements()) decoration.addOverlay(IMG_DESC_ELEMENT_BG, IDecoration.TOP_LEFT + IDecoration.UNDERLAY); decoration.addOverlay(IMG_DESC_CHECKED_IN); }