List of usage examples for org.eclipse.jface.viewers IDecoration addOverlay
void addOverlay(ImageDescriptor overlay, int quadrant);
From source file:de.walware.statet.r.internal.ui.nolazy.RResourceDecorator.java
License:Open Source License
@Override public void decorate(final Object element, final IDecoration decoration) { IProject project = null;// ww w .j a va 2 s . co m if (element instanceof IProject) { project = (IProject) element; } if (project != null) { try { if (project.hasNature(de.walware.statet.r.core.RProjects.R_PKG_NATURE_ID)) { decoration.addOverlay(getPackageProjectOverlay(), IDecoration.TOP_LEFT); } } catch (final CoreException 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 .ja 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:eu.cloudwave.wp5.feedback.eclipse.performance.ui.decorators.FeedbackProjectNatureEnabledDecorator.java
License:Apache License
/** * {@inheritDoc}/* w w w . j ava2s .co m*/ */ @Override public void decorate(final Object element, final IDecoration decoration) { final Optional<IProject> project = isProject(element); if (project.isPresent()) { try { if (project.get().isNatureEnabled(Ids.NATURE)) { decoration.addOverlay(PerformancePluginActivator.getImageDescriptor(DECORATOR_ICON_PATH), IDecoration.TOP_LEFT); } } catch (final CoreException e) { // do nothing, decoration is not applied } } }
From source file:eu.geclipse.ui.decorators.GridJobDecorator.java
License:Open Source License
public void decorate(final Object element, final IDecoration decoration) { if (element instanceof GridJob) { IGridJobStatus status = ((GridJob) element).getJobStatus(); ImageDescriptor decorator = getIcon(status.getType()); decoration.addOverlay(decorator, IDecoration.BOTTOM_LEFT); }//w w w . j a va2 s .c o m }
From source file:eu.geclipse.ui.decorators.GridProjectFolderDecorator.java
License:Open Source License
private void decorate(final IGridContainer container, final IDecoration decoration) { IGridContainer parent = container.getParent(); if (parent instanceof IGridProject) { String id = ((IGridProject) parent).getProjectFolderID(container); if (id != null) { ImageDescriptor image = this.images.get(id); if (image != null) { decoration.addOverlay(image, IDecoration.TOP_RIGHT); }/*www .j a va 2 s .c o m*/ } } }
From source file:eu.modelwriter.marker.model.decorators.EcoreModelDecorator.java
License:Open Source License
@Override public void decorate(Object resource, IDecoration decoration) { if (resource instanceof ENamedElement) { ENamedElement namedElement = (ENamedElement) resource; Resource eResource = namedElement.eResource(); if (eResource == null) return; URI eUri = eResource.getURI(); IResource iResource = null;//from w w w. j a va 2s . co m if (eUri.isPlatformResource()) { String platformString = eUri.toPlatformString(true); iResource = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString); } if (iResource == null) return; AbstractUIPlugin plugin = MarkerActivator.getDefault(); ImageRegistry imageRegistry = plugin.getImageRegistry(); IMarker marker = null; URI uri = EcoreUtil.getURI(namedElement); marker = MarkerFactory.findMarkersByUri(iResource, uri.toString()); if (marker != null) { try { if (marker.getType().equals(MarkerFactory.MARKER_MARKING)) { decoration.addOverlay( ImageDescriptor .createFromImage(imageRegistry.get(MarkerActivator.Images.IMAGE_BLACK_ID)), IDecoration.BOTTOM_RIGHT); decoration.setForegroundColor(color_blue); } else { decoration.addOverlay( ImageDescriptor .createFromImage(imageRegistry.get(MarkerActivator.Images.IMAGE_RED_ID)), IDecoration.BOTTOM_RIGHT); decoration.setForegroundColor(color_maroon); } } catch (CoreException e) { e.printStackTrace(); } // EClass or EDataType if (namedElement instanceof EClassifier) { System.out.println("Classifier: " + namedElement.getName()); EClassifier eC = (EClassifier) namedElement; System.out.println(eC.getEPackage().getNsURI()); System.out.println(eC.getClassifierID()); } if (namedElement instanceof EStructuralFeature) { System.out.println("Structural Feature: " + namedElement.getName()); EStructuralFeature eS = (EStructuralFeature) namedElement; System.out.println(eS.getEContainingClass().getName()); System.out.println(eS.getFeatureID()); } } } else if (resource instanceof EObject) { EObject element = (EObject) resource; URI eUri = EcoreUtil.getURI(element); Resource eResource = element.eResource(); if (eResource == null) return; IResource iResource = null; if (eUri.isPlatformResource()) { String platformString = eUri.toPlatformString(true); iResource = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString); } if (iResource == null) return; AbstractUIPlugin plugin = MarkerActivator.getDefault(); ImageRegistry imageRegistry = plugin.getImageRegistry(); try { IMarker marker = MarkerFactory.findMarkersByUri(iResource, eUri.toString()); if (marker != null) { if (marker.getType().equals(MarkerFactory.MARKER_MARKING)) { decoration.addOverlay( ImageDescriptor .createFromImage(imageRegistry.get(MarkerActivator.Images.IMAGE_BLACK_ID)), IDecoration.BOTTOM_RIGHT); decoration.setForegroundColor(color_blue); } else { decoration.addOverlay( ImageDescriptor .createFromImage(imageRegistry.get(MarkerActivator.Images.IMAGE_RED_ID)), IDecoration.BOTTOM_RIGHT); decoration.setForegroundColor(color_maroon); } } } catch (CoreException e) { e.printStackTrace(); } } }
From source file:eu.modelwriter.marker.model.decorators.FileDecorator.java
License:Open Source License
@Override public void decorate(Object resource, IDecoration decoration) { int markers = MarkerFactory.findMarkers((IResource) resource).size(); if (markers > 0) { decoration.addOverlay(ImageDescriptor.createFromFile(FileDecorator.class, ICON), IDecoration.TOP_RIGHT); decoration.setForegroundColor(color); } else {/*from ww w . java2s . c o m*/ decoration.addOverlay(null); decoration.setForegroundColor(new Color(null, 0, 0, 0, 0)); } }
From source file:ext.org.eclipse.jdt.internal.ui.BuildpathIndicatorLabelDecorator.java
License:Open Source License
/** * {@inheritDoc}/* www .ja va 2s.c o m*/ */ @Override public void decorate(Object element, IDecoration decoration) { ImageDescriptor overlay = getOverlay(element); if (overlay != null) { decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT); } }
From source file:ext.org.eclipse.jdt.internal.ui.InterfaceIndicatorLabelDecorator.java
License:Open Source License
private void addOverlaysFromFlags(int flags, IDecoration decoration) { ImageDescriptor type;/*from ww w. j a va2s . c om*/ if (Flags.isAnnotation(flags)) { type = JavaPluginImages.DESC_OVR_ANNOTATION; } else if (Flags.isEnum(flags)) { type = JavaPluginImages.DESC_OVR_ENUM; } else if (Flags.isInterface(flags)) { type = JavaPluginImages.DESC_OVR_INTERFACE; } else if (/* is class */ Flags.isAbstract(flags)) { type = JavaPluginImages.DESC_OVR_ABSTRACT_CLASS; } else { type = null; } boolean deprecated = Flags.isDeprecated(flags); boolean packageDefault = Flags.isPackageDefault(flags); /* Each decoration position can only be used once. Since we don't want to take all positions * away from other decorators, we confine ourselves to only use the top right position. */ if (type != null && !deprecated && !packageDefault) { decoration.addOverlay(type, IDecoration.TOP_RIGHT); } else if (type == null && deprecated && !packageDefault) { decoration.addOverlay(JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_RIGHT); } else if (type != null || deprecated || packageDefault) { decoration.addOverlay(new TypeIndicatorOverlay(type, deprecated, packageDefault), IDecoration.TOP_RIGHT); } }
From source file:fede.workspace.tool.view.decorator.WorkspaceCopyLabelDecorator.java
License:Apache License
public void decorate(Object element, IDecoration decoration) { if (element instanceof ItemDelta) { if (((ItemDelta) element).isDeleted()) { ImageDescriptor overlay = WSPlugin.getImageDescriptor("icons/delete_ovr.gif"); decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT); }//from ww w. j a v a2s . c o m if (((ItemDelta) element).isAdded()) { ImageDescriptor overlay = WSPlugin.getImageDescriptor("icons/add_ovr.gif"); decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT); } } }