List of usage examples for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT
int BOTTOM_RIGHT
To view the source code for org.eclipse.jface.viewers IDecoration BOTTOM_RIGHT.
Click Source Link
From source file:de.bmw.yamaica.ea.ui.EALabelProvider.java
License:Mozilla Public License
@Override public Image getImage(Object element) { if (!(element instanceof EAContainerWithNamespace)) { return null; }/* ww w . j a v a 2 s .c o m*/ ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry(); EAPackageContainer p = (EAPackageContainer) element; if (p.isModel()) { return imageRegistry.get("MODEL_PACKAGE"); } else { Image image; Flags flags = new Flags(p.getFlags()); if (flags.isModel()) { String iconName; switch (flags.getPackageType()) { case Flags.SIMPLE: iconName = "SIMPLE_PACKAGE"; break; case Flags.USE_CASE: iconName = "USE_CASE_PACKAGE"; break; case Flags.DYNAMIC: iconName = "DYNAMIC_PACKAGE"; break; case Flags.CLASS_VIEW: iconName = "CLASS_VIEW_PACKAGE"; break; case Flags.COMPONENT: iconName = "COMPONENT_PACKAGE"; break; case Flags.DEPLOYMENT: iconName = "DEPLOYMENT_PACKAGE"; break; default: iconName = "PACKAGE"; break; } image = imageRegistry.get(iconName); } else { image = imageRegistry.get("PACKAGE"); } if (p.isNamespaceRoot()) { ImageDescriptor imageDescriptor = imageRegistry.getDescriptor("NS_ROOT_OVERLAY"); image = new DecorationOverlayIcon(image, imageDescriptor, IDecoration.BOTTOM_RIGHT).createImage(); } return image; } }
From source file:de.jcup.egradle.eclipse.decorators.EGradleProjectDecorator.java
License:Apache License
@Override public void decorate(Object element, IDecoration decoration) { /* no decoration when plugin is not running */ if (Activator.getDefault() == null) { return;//w w w .j a v a 2 s .c om } /* 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 = EGradleUtil.getRootProjectFolderWithoutErrorHandling(); if (rootFolder == null) { return; } if (EGradleUtil.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 (EGradleUtil.getPreferences().isSubProjectIconDecorationEnabled()) { decorateImage(decoration); } } catch (CoreException e) { EGradleUtil.log(e); } }
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 ww . j a v 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:edu.uci.lighthouse.ui.figures.AbstractUmlBoxFigure.java
License:Open Source License
private Image getEventIcon(LighthouseEvent ev) { Image result = null;/* ww w . ja va2 s .c o m*/ switch (ev.getType()) { case ADD: result = ImageFactory.getImage(Icons.EVENT_ADD); break; case REMOVE: result = ImageFactory.getImage(Icons.EVENT_REMOVE); break; case MODIFY: result = ImageFactory.getImage(Icons.EVENT_MODIFY); break; //case CUSTOM: // if (ev instanceof InfluenceEvent){ // InfluenceEvent ievt = (InfluenceEvent) ev; // result = ImageFactory.getImage(ievt.getIcon()); // } //break; } if (ev.isCommitted()) { ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(LighthouseUIPlugin.PLUGIN_ID, "/icons/commit.gif"); DecorationOverlayIcon overlayIcon = new DecorationOverlayIcon(result, desc, IDecoration.BOTTOM_RIGHT); result = overlayIcon.createImage(); } return result; }
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 . ja v a2 s. c om 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.numberfour.n4js.ui.labeling.helper.N4JSDecoratorRow.java
License:Open Source License
@SuppressWarnings("javadoc") public N4JSDecoratorRow(ImageDescriptor main, int quadrant, List<ImageDescriptor> decos) { Objects.requireNonNull(main); if ((quadrant < IDecoration.TOP_LEFT) || (quadrant > IDecoration.BOTTOM_RIGHT)) { throw new IllegalArgumentException(); }/* ww w. ja v a 2 s . c o m*/ Objects.requireNonNull(decos); this.main = main; this.quadrant = quadrant; this.decos = decos.toArray(new ImageDescriptor[decos.size()]); }
From source file:fede.workspace.tool.view.actions.delete.WCLabelDecorator.java
License:Apache License
private Image computeImage(Image image, String path) { if (image == null) { return WSPlugin.getImage(path); }//from ww w . ja va2s . c om ImageDescriptor overlay = WSPlugin.getImageDescriptor(path); DecorationOverlayIcon icon = new DecorationOverlayIcon(image, overlay, IDecoration.BOTTOM_RIGHT); return resourceManager.createImage(icon); }
From source file:fr.imag.adele.cadse.cadseg.teamwork.ui.ErrorDecorator.java
License:Apache License
protected Image computeImage(Image image, String path) { ImageDescriptor overlay = WSPlugin.getImageDescriptor(path); DecorationOverlayIcon icon = new DecorationOverlayIcon(image, overlay, IDecoration.BOTTOM_RIGHT); return _resourceManager.createImage(icon); }
From source file:gov.nasa.ensemble.core.model.plan.diff.report.viewer.PlanDiffLabelProvider.java
License:Open Source License
private Image getImage(PlanDiffObjectNode element) { EObject object = element.getObject(); Image undecoratedImage = null; if (object instanceof EPlanElement) { undecoratedImage = activityIconProvider.getImage(object); }// w w w . j a v a2s . c om if (undecoratedImage == null) return null; ImageDescriptor badge = diffTypeToBadge(element.getDiffType()); return new DecorationOverlayIcon(undecoratedImage, badge, IDecoration.BOTTOM_RIGHT).createImage(); }
From source file:gov.nasa.ensemble.core.plan.advisor.provider.ActivityAdvisorLabelDecorator.java
License:Open Source License
public ActivityAdvisorLabelDecorator() { if (badgeLocation == null) { return;/* ww w.j a va 2s. com*/ } if (badgeLocation.equalsIgnoreCase("TOP_LEFT")) { quadrant = IDecoration.TOP_LEFT; } else if (badgeLocation.equalsIgnoreCase("TOP_RIGHT")) { quadrant = IDecoration.TOP_RIGHT; } else if (badgeLocation.equalsIgnoreCase("BOTTOM_LEFT")) { quadrant = IDecoration.BOTTOM_LEFT; } else if (badgeLocation.equalsIgnoreCase("BOTTOM_RIGHT")) { quadrant = IDecoration.BOTTOM_RIGHT; } else if (badgeLocation.equalsIgnoreCase("REPLACE")) { quadrant = IDecoration.BOTTOM_LEFT; } else if (badgeLocation.equalsIgnoreCase("UNDERLAY")) { quadrant = IDecoration.UNDERLAY; } else { LogUtil.warn("unsupported value entered for " + propertyKey + ", using default value instead"); } }