List of usage examples for org.eclipse.jface.viewers DecorationOverlayIcon DecorationOverlayIcon
public DecorationOverlayIcon(ImageDescriptor baseImageDescriptor, ImageDescriptor overlayImageDescriptor, int quadrant)
From source file:org.eclipse.recommenders.completion.rcp.processable.OverlayImageProposalProcessor.java
License:Open Source License
@Override public Image modifyImage(Image image) { Image newImage = cache.get(image); if (newImage == null) { DecorationOverlayIcon decorator = new DecorationOverlayIcon(image, overlay, decorationCorner); newImage = decorator.createImage(); cache.put(image, newImage);/*ww w.j a v a 2s.c o m*/ } return newImage; }
From source file:org.eclipse.recommenders.completion.rcp.processable.Proposals.java
License:Open Source License
/** * @param decorationCorner// ww w . j a v a 2s .com * e.g. {@link IDecoration#TOP_LEFT} */ public static void overlay(IProcessableProposal proposal, ImageDescriptor icon, int decorationCorner) { Image originalImage = proposal.getImage(); CacheKey key = new CacheKey(originalImage, icon, decorationCorner); Image newImage = CACHE.get(key); if (newImage == null) { DecorationOverlayIcon decorator = new DecorationOverlayIcon(originalImage, icon, decorationCorner); newImage = decorator.createImage(); CACHE.put(key, newImage); } proposal.setImage(newImage); }
From source file:org.eclipse.sirius.diagram.ui.tools.internal.views.providers.outline.OutlineLabelProvider.java
License:Open Source License
private Image getDecoratedImage(Image baseImage, String decoratorPath, int decoratorPosition) { ImageDescriptor decoratorDescriptor = ExtendedImageRegistry.getInstance() .getImageDescriptor(DiagramUIPlugin.INSTANCE.getImage(decoratorPath)); DecorationOverlayIcon finalDescriptor = new DecorationOverlayIcon(baseImage, decoratorDescriptor, decoratorPosition);//from w w w. j ava2 s .co m return DiagramUIPlugin.getPlugin().getImage(finalDescriptor); }
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;// www. j a v a2s .c o 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; }
From source file:org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider.java
License:Open Source License
private Image addOverlays(Image base, Object element) { if (!isIncludeOverlays()) return base; ImageDescriptor[] overlayImages = new ImageDescriptor[4]; boolean hasOverlay = false; // Decorate with the busy indicator if (isBusy(element)) { overlayImages[IDecoration.TOP_LEFT] = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_HOURGLASS_OVR); hasOverlay = true;//from www .j a v a 2 s . c o m } // Decorate with propagated conflicts and problem markers if (!isConflicting(element)) { // if the folder is already conflicting then don't bother propagating if (hasDecendantConflicts(element)) { overlayImages[IDecoration.BOTTOM_RIGHT] = TeamUIPlugin .getImageDescriptor(ISharedImages.IMG_CONFLICT_OVR); hasOverlay = true; } } int severity = getMarkerSeverity(element); if (severity == IMarker.SEVERITY_ERROR) { overlayImages[IDecoration.BOTTOM_LEFT] = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_ERROR_OVR); hasOverlay = true; } else if (severity == IMarker.SEVERITY_WARNING) { 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)); return getImageManager().getImage(overlay); } return base; }
From source file:org.eclipse.tycho.targeteditor.Activator.java
License:Open Source License
@Override protected void initializeImageRegistry(final ImageRegistry reg) { reg.put(NEXUS_IMG, imageDescriptorFromPlugin(PLUGIN_ID, "icons/nexusRepo.png")); reg.put(VERSION_ACTION_DISABLED_IMG, imageDescriptorFromPlugin(PLUGIN_ID, "icons/versionUpdateAction_disabled.png")); reg.put(VERSION_ACTION_IMG, imageDescriptorFromPlugin(PLUGIN_ID, "icons/versionUpdateAction.png")); final Image nexusLogo = getImageFromRegistry(NEXUS_IMG); final DecorationOverlayIcon errorOverlay = new DecorationOverlayIcon(nexusLogo, PDEPluginImages.DESC_INTERNAL_CO, IDecoration.TOP_RIGHT); reg.put(ERROR_OVERLAY, errorOverlay.createImage()); final DecorationOverlayIcon updateableOverlay = new DecorationOverlayIcon(nexusLogo, PDEPluginImages.DESC_FRIEND_CO, IDecoration.TOP_RIGHT); reg.put(UPDATEABLE_OVERLAY, updateableOverlay.createImage()); final DecorationOverlayIcon loadingOverlay = new DecorationOverlayIcon(nexusLogo, PDEPluginImages.DESC_OPTIONAL_CO, IDecoration.TOP_RIGHT); reg.put(LOADING_OVERLAY, loadingOverlay.createImage()); }
From source file:org.eclipse.ui.internal.decorators.DecorationResult.java
License:Open Source License
/** * Decorate the Image supplied with the overlays. * /* w ww. j a v a 2s .c o m*/ * @param image * @param manager * @return Image */ Image decorateWithOverlays(Image image, ResourceManager manager) { // Do not try to do anything if there is no source or overlays if (image == null || descriptors == null) { return image; } Rectangle bounds = image.getBounds(); Point size = new Point(bounds.width, bounds.height); DecorationOverlayIcon icon = new DecorationOverlayIcon(image, descriptors, size); return manager.createImage(icon); }
From source file:org.eclipse.ui.internal.decorators.OverlayCache.java
License:Open Source License
/** * Apply the descriptors for the receiver to the supplied image. * /*from www . j a va 2 s . co m*/ * @param source * @param descriptors * @return Image */ Image applyDescriptors(Image source, ImageDescriptor[] descriptors) { Rectangle bounds = source.getBounds(); Point size = new Point(bounds.width, bounds.height); DecorationOverlayIcon icon = new DecorationOverlayIcon(source, descriptors, size); return getImageFor(icon); }
From source file:org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionLabelProvider.java
License:Open Source License
@Override protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { ImageDescriptor descriptor = super.decorateImage(input, element); if (descriptor == null) { return null; }/*from www .ja va 2 s . co m*/ IResource resource = Adapters.adapt(element, IResource.class); if (resource != null && (resource.getType() != IResource.PROJECT || ((IProject) resource).isOpen())) { ImageDescriptor overlay = null; switch (getHighestProblemSeverity(resource)) { case IMarker.SEVERITY_ERROR: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR); break; case IMarker.SEVERITY_WARNING: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING); break; } if (overlay != null) { descriptor = new DecorationOverlayIcon(descriptor, overlay, IDecoration.BOTTOM_LEFT); } } return descriptor; }
From source file:org.eclipse.wst.sse.sieditor.ui.Activator.java
License:Open Source License
public Image getImage(Image originalImage, int severity) { if (severity == IStatus.OK || severity == IStatus.INFO) { return originalImage; }//from ww w . jav a 2s .com final String fullKey = originalImage.hashCode() + UIConstants.UNDERSCORE + severity; Image image = getImageRegistry().get(fullKey); if (image == null) { String decorationId = null; switch (severity) { case IStatus.ERROR: decorationId = FieldDecorationRegistry.DEC_ERROR; break; case IStatus.WARNING: decorationId = FieldDecorationRegistry.DEC_WARNING; break; } final Image errImage = FieldDecorationRegistry.getDefault().getFieldDecoration(decorationId).getImage(); if (errImage == null) { return originalImage; } DecorationOverlayIcon overlay; overlay = new DecorationOverlayIcon(originalImage, ImageDescriptor.createFromImage(errImage), IDecoration.BOTTOM_LEFT); image = overlay.createImage(); getImageRegistry().put(fullKey, image); } return image; }