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:org.eclipse.m2m.internal.qvt.oml.editor.ui.completion.CompletionProposalUtil.java
License:Open Source License
public static final Image getImage(String imageKey, String decoratorKey) { String key = imageKey + decoratorKey; Image image = getImageRegistry().get(key); if (image == null) { Image baseImage = getImage(imageKey); ImageDescriptor decoratorId = imageDescriptorFromPlugin("icons/" + decoratorKey + ".gif"); //$NON-NLS-1$ //$NON-NLS-2$ DecorationOverlayIcon decoratedIconId = new DecorationOverlayIcon(baseImage, decoratorId, IDecoration.BOTTOM_RIGHT); getImageRegistry().put(key, decoratedIconId); return getImageRegistry().get(key); }//from www . j a v a 2s .c om return image; }
From source file:org.eclipse.mylyn.internal.tasks.ui.TaskLabelDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { ImageDescriptor priorityOverlay = getPriorityImageDescriptor(element); if (priorityOverlay != null) { decoration.addOverlay(priorityOverlay, IDecoration.BOTTOM_LEFT); }/*from ww w. j a va 2 s . c o m*/ if (element instanceof ITask) { ITask task = (ITask) element; if (!task.isCompleted() && (TasksUiPlugin.getTaskActivityManager().isDueToday(task) || TasksUiPlugin.getTaskActivityManager().isOverdue(task))) { decoration.addOverlay(CommonImages.OVERLAY_DATE_OVERDUE, IDecoration.TOP_RIGHT); } else if (!task.isCompleted() && task.getDueDate() != null) { decoration.addOverlay(CommonImages.OVERLAY_DATE_DUE, IDecoration.TOP_RIGHT); } if (hasNotes(task)) { decoration.addOverlay(TasksUiImages.NOTES, IDecoration.BOTTOM_RIGHT); } } else if (element instanceof ITaskRepositoryElement) { ITaskRepositoryElement repositoryElement = (ITaskRepositoryElement) element; String repositoryUrl = repositoryElement.getRepositoryUrl(); TaskRepository taskRepository = TasksUi.getRepositoryManager() .getRepository(repositoryElement.getConnectorKind(), repositoryUrl); if (taskRepository != null) { decoration.addSuffix(" [" + taskRepository.getRepositoryLabel() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ } } else if (element instanceof TaskRepository) { ImageDescriptor overlay = TasksUiPlugin.getDefault() .getOverlayIcon(((TaskRepository) element).getConnectorKind()); if (overlay != null) { decoration.addOverlay(overlay, IDecoration.BOTTOM_RIGHT); } } }
From source file:org.eclipse.ocl.examples.modelregistry.ui.icons.DecorationOverlayIcon.java
License:Open Source License
/** * Draw the overlays for the receiver./*from w ww. jav a 2s.c om*/ * @param overlaysArray */ private void drawOverlays(ImageDescriptor[] overlaysArray) { for (int i = 0; i < overlays.length; i++) { ImageDescriptor overlay = overlaysArray[i]; if (overlay == null) { continue; } ImageData overlayData = overlay.getImageData(); //Use the missing descriptor if it is not there. if (overlayData == null) { overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData(); } switch (i) { case IDecoration.TOP_LEFT: drawImage(overlayData, 0, 0); break; case IDecoration.TOP_RIGHT: drawImage(overlayData, size.x - overlayData.width, 0); break; case IDecoration.BOTTOM_LEFT: drawImage(overlayData, 0, size.y - overlayData.height); break; case IDecoration.BOTTOM_RIGHT: drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height); break; } } }
From source file:org.eclipse.osee.ote.ui.define.viewers.data.ArtifactItem.java
License:Open Source License
private void initializeImages() { Artifact artifact = getData();//from ww w.java 2 s .c o m Image defaultImage = ArtifactImageManager.getImage(artifact); DecorationOverlayIcon overlay = null; if (FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE == null) { OverlayImage overlayImage = new OverlayImage(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.ADDITION), Location.BOT_RIGHT); FROM_LOCAL_WS_COMMIT_ALLOWED_IMAGE = overlayImage.createImage(); } if (FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE == null) { overlay = new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.CONFAUTO_OV), IDecoration.BOTTOM_RIGHT); FROM_LOCAL_WS_COMMIT_NOT_ALLOWED_IMAGE = overlay.createImage(); } if (FROM_DATABASE_IMAGE == null) { overlay = new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.VERSION_CONTROLLED), IDecoration.BOTTOM_RIGHT); FROM_DATABASE_IMAGE = overlay.createImage(); } if (INVALID_SCRIPT_IMAGE == null) { overlay = new DecorationOverlayIcon(defaultImage, ImageManager.getImageDescriptor(OteDefineImage.OBSTRUCTED), IDecoration.BOTTOM_RIGHT); INVALID_SCRIPT_IMAGE = overlay.createImage(); } }
From source file:org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter.java
License:Open Source License
/** * Sets the decorated image.//from w w w . java 2 s. c o m * * @param baseImage the base image * @param decoration the decoration * @param decorationPosition the decoration position */ public void setDecoratedImage(Image baseImage, ImageDescriptor decoration, int decorationPosition) { if (decoration == null || baseImage == null) { return; } DecorationOverlayIcon decoratedImage = null; // Construct a new image identifier String decoratedImageId = baseImage.toString().concat(decoration.toString() + decorationPosition); // Return the stored image if we have one if (Activator.getDefault().getImageRegistry().get(decoratedImageId) == null) { // Otherwise create a new image and store it switch (decorationPosition) { case IDecoration.TOP_LEFT: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { decoration, null, null, null, null }, size16); break; case IDecoration.TOP_RIGHT: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { null, decoration, null, null, null }, size16); break; case IDecoration.BOTTOM_LEFT: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { null, null, decoration, null, null }, size16); break; case IDecoration.BOTTOM_RIGHT: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { null, null, null, decoration, null }, size16); break; case IDecoration.UNDERLAY: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { null, null, null, null, decoration }, size16); break; default: decoratedImage = new DecorationOverlayIcon(baseImage, new ImageDescriptor[] { null, null, decoration, null, null }, size16); break; } Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImage); } }
From source file:org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ModelExplorerDecorationAdapter.java
License:Open Source License
/** * Sets the decoration.//from w w w . j a va 2 s. co m * * @param decoration the decoration * @param position the position */ public void setDecoration(ImageDescriptor decoration, PreferedPosition position) { switch (position) { case NORTH_WEST: setDecoration(decoration, IDecoration.TOP_LEFT); break; case NORTH: setDecoration(decoration, IDecoration.TOP_RIGHT); break; case NORTH_EAST: setDecoration(decoration, IDecoration.TOP_RIGHT); break; case EAST: setDecoration(decoration, IDecoration.BOTTOM_RIGHT); break; case SOUTH_EAST: setDecoration(decoration, IDecoration.BOTTOM_RIGHT); break; case SOUTH: setDecoration(decoration, IDecoration.BOTTOM_LEFT); break; case SOUTH_WEST: setDecoration(decoration, IDecoration.BOTTOM_LEFT); break; case WEST: setDecoration(decoration, IDecoration.TOP_LEFT); break; case CENTER: setDecoration(decoration, IDecoration.UNDERLAY); break; default: setDecoration(decoration, IDecoration.BOTTOM_LEFT); break; } }
From source file:org.eclipse.rcptt.tesla.jface.aspects.test.ImageSourcesTest.java
License:Open Source License
@Test public void getImageData() { Image folder = SHARED_IMAGES.getImage(ISharedImages.IMG_OBJ_FOLDER); ImageDescriptor[] overlays = new ImageDescriptor[IDecoration.BOTTOM_RIGHT + 1]; URL url = Platform.getBundle("org.eclipse.ui").getEntry("icons/full/ovr16/warning_ovr.png"); overlays[IDecoration.BOTTOM_RIGHT] = ImageDescriptor.createFromURL(url); DecorationOverlayIcon icon = new DecorationOverlayIcon(folder, overlays); Image iconImage = (Image) icon.createResource(Display.getCurrent()); try {// w w w . j av a2 s. c om ImageSource imageSource = ImageSources.INSTANCE.find(iconImage); CompositeSource composite = (CompositeSource) imageSource; List<String> strings = composite.children.stream().map(Object::toString).collect(Collectors.toList()); Assert.assertEquals(ImmutableList.of("org.eclipse.ui/icons/full/obj16/fldr_obj.png", "org.eclipse.ui/icons/full/ovr16/warning_ovr.png"), strings); } finally { iconImage.dispose(); } }
From source file:org.eclipse.rcptt.ui.resources.viewers.WSResourceDecorator.java
License:Open Source License
public void decorate(Object element, IDecoration decoration) { if (element instanceof WSLink) { if (WSValidators.validateLink((WSLink) element, null, null)) decoration.addOverlay(LINK, IDecoration.BOTTOM_RIGHT); else// www.java 2s. com decoration.addOverlay(BROKEN, IDecoration.BOTTOM_RIGHT); } }
From source file:org.eclipse.sirius.diagram.ui.tools.internal.views.providers.outline.OutlineLabelProvider.java
License:Open Source License
/** * Returns the image for the label of the given DSemanticDecorator. * //w w w . jav a 2 s .co m * @param element * the element for which to provide the label image * @return the image used to label the element, or <code>null</code> if * there is no image for the given object */ private Image getImage(DSemanticDecorator element) { Image result = null; final EObject target = element.getTarget(); if (target != null) { final IItemLabelProvider labelProvider = (IItemLabelProvider) this.factory.adapt(target, IItemLabelProvider.class); if (labelProvider != null) { ImageDescriptor descriptor = ExtendedImageRegistry.getInstance() .getImageDescriptor(labelProvider.getImage(target)); if (descriptor == null) { descriptor = ImageDescriptor.getMissingImageDescriptor(); } result = DiagramUIPlugin.getPlugin().getImage(descriptor); if (element instanceof DEdge) { result = getDecoratedImage(result, DiagramImagesPath.VIEW_EDGE_DECORATOR, IDecoration.BOTTOM_LEFT); result = computeFoldDecorator(result, (DEdge) element); } if (element instanceof DDiagramElement) { DDiagramElementQuery query = new DDiagramElementQuery((DDiagramElement) element); if (query.isHidden()) { result = getDecoratedImage(result, DiagramImagesPath.HIDDEN_DECORATOR, IDecoration.TOP_LEFT); } if (element instanceof DDiagramElementContainer && query.isLabelHidden()) { result = getDecoratedImage(result, DiagramImagesPath.HIDDEN_LABEL_DECORATOR, IDecoration.BOTTOM_RIGHT); } } } } return result; }
From source file:org.eclipse.team.internal.ui.synchronize.SynchronizeModelElementLabelProvider.java
License:Open Source License
private Image propagateConflicts(Image base, ISynchronizeModelElement element) { ImageDescriptor[] overlayImages = new ImageDescriptor[4]; boolean hasOverlay = false; // Decorate with the busy indicator if (element.getProperty(ISynchronizeModelElement.BUSY_PROPERTY)) { overlayImages[IDecoration.TOP_LEFT] = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_HOURGLASS_OVR); hasOverlay = true;/* w w w .j a va 2s. co m*/ } // Decorate with propagated conflicts and problem markers int kind = element.getKind(); if ((kind & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) { // if the folder is already conflicting then don't bother propagating // the conflict if (hasDecendantConflicts(element)) { overlayImages[IDecoration.BOTTOM_RIGHT] = TeamUIPlugin .getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR); hasOverlay = true; } } if (hasErrorMarker(element)) { overlayImages[IDecoration.BOTTOM_LEFT] = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_ERROR_OVR); hasOverlay = true; } else if (hasWarningMarker(element)) { overlayImages[IDecoration.BOTTOM_LEFT] = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_WARNING_OVR); hasOverlay = true; } if (hasOverlay) { ImageDescriptor overlay = new DecorationOverlayIcon(base, overlayImages, new Point(base.getBounds().width, base.getBounds().height)); if (fgImageCache == null) { fgImageCache = new HashMap(10); } Image conflictDecoratedImage = (Image) fgImageCache.get(overlay); if (conflictDecoratedImage == null) { conflictDecoratedImage = overlay.createImage(); fgImageCache.put(overlay, conflictDecoratedImage); } return conflictDecoratedImage; } return base; }