List of usage examples for org.eclipse.jface.viewers IDecoration addOverlay
void addOverlay(ImageDescriptor overlay, int quadrant);
From source file:org.mxupdate.eclipse.Decorator.java
License:Apache License
public void decorate(final Object _obj, final IDecoration _idecoration) { final IFile file = (IFile) _obj; final String name = file.getName(); for (final Map.Entry<String, Map<String, ImageDescriptor>> suffixEntry : Activator.IMAGEMAP.entrySet()) { if (name.endsWith(suffixEntry.getKey())) { for (final Map.Entry<String, ImageDescriptor> entry : suffixEntry.getValue().entrySet()) { if (name.startsWith(entry.getKey())) { _idecoration.addOverlay(entry.getValue(), IDecoration.TOP_LEFT); break; }//from w w w. j av a2 s . c om } break; } } }
From source file:org.mxupdate.eclipse.mxadapter.MXDecorator.java
License:Apache License
/** * Depending on the file suffixes and prefixes the related image descriptor * is selected and shown as decorator image. * * @param _obj object which must be checked for decoration * @param _decoration decoration from Eclipse where the images are * "overlayed" on the top left *//*from w w w. j a v a 2 s .c om*/ public void decorate(final Object _obj, final IDecoration _decoration) { final IFile file = (IFile) _obj; try { final IDeploymentAdapter adapter = Activator.getDefault().getAdapter(file.getProject()); if (adapter != null) { final ImageDescriptor imageDesc = adapter.getImageDescriptor(file); if (imageDesc != null) { _decoration.addOverlay(imageDesc, IDecoration.TOP_LEFT); } } } catch (final Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mxupdate.eclipse.MXDecorator.java
License:Apache License
/** * Depending on the file suffixes and prefixes the related image descriptor * is selected and shown as decorator image. * * @param _obj object which must be checked for decoration * @param _decoration decoration from Eclipse where the images are * "overlayed" on the top left *//* ww w.ja v a 2 s .com*/ public void decorate(final Object _obj, final IDecoration _decoration) { final IFile file = (IFile) _obj; final String name = file.getName(); for (final Map.Entry<String, Map<String, ImageDescriptor>> suffixEntry : Activator.IMAGEMAP.entrySet()) { if (name.endsWith(suffixEntry.getKey())) { for (final Map.Entry<String, ImageDescriptor> entry : suffixEntry.getValue().entrySet()) { if (name.startsWith(entry.getKey())) { _decoration.addOverlay(entry.getValue(), IDecoration.TOP_LEFT); break; } } break; } } }
From source file:org.netxms.ui.eclipse.actionmanager.ServerActionDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { decoration.addOverlay(((ServerAction) element).isDisabled() ? disabledMark : null, IDecoration.TOP_RIGHT); }
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); }/* ww w. ja v a2 s.co 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.netxms.ui.eclipse.usermanager.UserDecorator.java
License:Open Source License
@Override public void decorate(Object element, IDecoration decoration) { if ((((AbstractUserObject) element).getFlags() & AbstractUserObject.DISABLED) != 0) { decoration.addOverlay(imageDisabled, IDecoration.BOTTOM_RIGHT); } else if ((((AbstractUserObject) element).getFlags() & AbstractUserObject.SYNC_EXCEPTION) != 0) { decoration.addOverlay(imageError, IDecoration.BOTTOM_RIGHT); }//from ww w . j a v a2 s . c om }
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 . j av a 2s .c o m 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.overture.ide.ui.navigator.ProblemLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof IResource) { IResource resource = (IResource) element; if (resource instanceof IProject) { if (!((IProject) resource).isOpen()) return; }//from w w w.j a va2s .c om try { if (!resource.exists()) { return;//Nothing to do then. } IMarker[] markers = resource.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); if (markers.length > 0) { if (containsSeverity(markers, IMarker.SEVERITY_ERROR)) { Image image = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); decoration.addOverlay(DecorationOverlayIcon.createFromImage(image), IDecoration.BOTTOM_LEFT); } else if (containsSeverity(markers, IMarker.SEVERITY_WARNING)) { Image image = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage(); decoration.addOverlay(DecorationOverlayIcon.createFromImage(image), IDecoration.BOTTOM_LEFT); } } } catch (CoreException e) { VdmUIPlugin.log("Faild to decorate element: " + element, e); } } }
From source file:org.parallelj.designer.validation.decorators.ParallelJProjectIconDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (!(element instanceof IJavaProject)) { return;/*from www. j av a2 s . c o m*/ } if (this.projectDecorationImageDescriptor == null) { this.projectDecorationImageDescriptor = DiagramValidationPlugin.getImageDescriptor(DECORATOR_PATH); } if (this.projectDecorationImageDescriptor != null) { decoration.addOverlay(this.projectDecorationImageDescriptor, IDecoration.BOTTOM_LEFT); } }
From source file:org.polymap.core.data.feature.buffer.LayerBufferDecorator.java
License:Open Source License
public void decorate(Object elm, IDecoration decoration) { boolean incoming = false; boolean outgoing = false; // check removed; handled by EntityModificationDecorator try {// w w w . j a v a2 s. c om ((Entity) elm).id(); } catch (NoSuchEntityException e) { return; } try { // ILayer if (elm instanceof ILayer) { ILayer layer = (ILayer) elm; outgoing = modified.containsKey(layer.id()); // EntityHandle layerHandle = FeatureStateTracker.layerHandle( layer ); // boolean incoming = EntityStateTracker.instance().isConflicting( // layerHandle, layerBuffer.getLayerTimestamp() ); decorated.put(layer.id(), layer); } // IMap else if (elm instanceof IMap) { IMap map = (IMap) elm; final AtomicBoolean outgo = new AtomicBoolean(outgoing); map.visit(new LayerVisitor() { public boolean visit(ILayer layer) { outgo.set(modified.containsKey(layer.id())); return !outgo.get(); } }); outgoing = outgo.get(); decorated.put(map.id(), map); } if (outgoing && incoming) { decoration.addPrefix("# "); } else if (incoming) { decoration.addPrefix("< "); } else if (outgoing) { ImageDescriptor ovr = DataPlugin.getDefault().imageDescriptor(OUTGOING); decoration.addOverlay(ovr, BOTTOM_RIGHT); //decoration.addSuffix( "*" ); } } catch (Exception e) { log.warn("", e); // XXX add question mark overlay } }