org.eclipse.jface.viewers.DecorationOverlayIcon Java Examples

The following examples show how to use org.eclipse.jface.viewers.DecorationOverlayIcon. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtendEditorErrorTickUpdater.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void updateEditorImage(XtextEditor xtextEditor) {
	if (xtextEditor != null && !xtextEditor.isEditable()) {
		Severity severity = getSeverity(xtextEditor);
		if (severity != null && severity != Severity.INFO) {
			ImageDescriptor descriptor = severity == Severity.ERROR ? XtextPluginImages.DESC_OVR_ERROR
					: XtextPluginImages.DESC_OVR_WARNING;
			// TODO replace with new constructor that takes an ImageDescription when on Oxygen+
			DecorationOverlayIcon decorationOverlayIcon = new DecorationOverlayIcon(pluginImageHelper.getImage(images.forReadonly()), descriptor,
					IDecoration.BOTTOM_LEFT);
			scheduleUpdateEditor(decorationOverlayIcon);
		} else {
			scheduleUpdateEditor(images.forReadonly());
		}
	} else {
		super.updateEditorImage(xtextEditor);
	}
}
 
Example #2
Source File: JSIndexViewLabelProvider.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public Image decorateImage(Image image, Object element)
{
	Image result = null;

	if (image != null && element instanceof PropertyElement)
	{
		PropertyElement property = (PropertyElement) element;

		if (property.isClassProperty())
		{
			DecorationOverlayIcon decorator = new DecorationOverlayIcon(image, STATIC_OVERLAY,
					IDecoration.TOP_RIGHT);

			result = decorator.createImage();
		}
	}

	return result;
}
 
Example #3
Source File: GamlEditorTickUpdater.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void updateEditorImage(final XtextEditor editor) {
	Severity severity = getSeverity(editor);
	ImageDescriptor descriptor = null;
	if (severity == null || severity == Severity.INFO) {
		descriptor = GamaIcons.create(IGamaIcons.OVERLAY_OK).descriptor();
	} else if (severity == Severity.ERROR) {
		descriptor = GamaIcons.create("navigator/overlay.error2").descriptor();
	} else if (severity == Severity.WARNING) {
		descriptor = GamaIcons.create("navigator/overlay.warning2").descriptor();
	} else {
		super.updateEditorImage(editor);
		return;
	}
	final DecorationOverlayIcon decorationOverlayIcon =
			new DecorationOverlayIcon(editor.getDefaultImage(), descriptor, IDecoration.BOTTOM_LEFT);
	scheduleUpdateEditor(decorationOverlayIcon);
}
 
Example #4
Source File: JSModelFormatter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private Image addOverlay(Image base, ImageDescriptor overlay, int location, String key)
{
	ImageRegistry reg = getImageRegistry();
	Image cached = reg.get(key);
	if (cached != null)
	{
		return cached;
	}

	DecorationOverlayIcon decorator = new DecorationOverlayIcon(base, overlay, location);
	Image result = decorator.createImage();
	reg.put(key, result);
	return result;
}
 
Example #5
Source File: ImageManager.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private static Image get(String filename, String overlay) {
	if (filename == null || overlay == null)
		return null;
	String id = filename + "-" + overlay;
	Image withOverlay = registry.get(id);
	if (withOverlay != null && !withOverlay.isDisposed())
		return withOverlay;
	DecorationOverlayIcon withIcon = new DecorationOverlayIcon(
			get(filename), descriptor(overlay), IDecoration.BOTTOM_RIGHT);
	withOverlay = withIcon.createImage();
	registry.put(id, withOverlay);
	return withOverlay;
}
 
Example #6
Source File: WizardPageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Image decorateImage(Image image, Object element) {
    IProcessConfigurationWizardPage page = (IProcessConfigurationWizardPage) element ;
    String erroMessage = page.isConfigurationPageValid(dialog.getConfiguration()) ;
    if (image != null && erroMessage != null) {
        return new DecorationOverlayIcon(image,Pics.getImageDescriptor("problem.gif",ConfigurationPlugin.getDefault()) , IDecoration.BOTTOM_RIGHT).createImage();
    }

    return null;
}
 
Example #7
Source File: CustomJavaObjectDataItemProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object getImage(Object object) {
	Object icon = super.getImage(object);
	if(object instanceof Data){
		Image iconImage =  null;
		boolean formTransient = ((Data) object).getDatasourceId() != null && ((Data) object).getDatasourceId().equals("PAGEFLOW");
		if(object instanceof JavaObjectData){
			if(((JavaObjectData) object).getClassName() != null){
				try {
					IType t = RepositoryManager.getInstance().getCurrentRepository().getJavaProject().findType(((JavaObjectData) object).getClassName());
					if(t != null && t.isInterface()){
						iconImage = Pics.getImage("int_obj.gif");
						if(EMFEditCustomPlugin.getDefault().getImageRegistry().get("decoratedImageForInterfaceJavaObject") == null){
							EMFEditCustomPlugin.getDefault().getImageRegistry().put("decoratedImageForInterfaceJavaObject", new DecorationOverlayIcon(iconImage,Pics.getImageDescriptor("form_decorator.png",EMFEditCustomPlugin.getDefault()),IDecoration.BOTTOM_LEFT).createImage());
						}
						if(formTransient){
							return EMFEditCustomPlugin.getDefault().getImageRegistry().get("decoratedImageForInterfaceJavaObject") ;
						}
						return iconImage;
					}else{
						iconImage = Pics.getImage("class_obj.gif");
						if(EMFEditCustomPlugin.getDefault().getImageRegistry().get("decoratedImageForClassJavaObject") == null){
							EMFEditCustomPlugin.getDefault().getImageRegistry().put("decoratedImageForClassJavaObject", new DecorationOverlayIcon(iconImage,Pics.getImageDescriptor("form_decorator.png",EMFEditCustomPlugin.getDefault()),IDecoration.BOTTOM_LEFT).createImage());
						}
						if(formTransient){
							return EMFEditCustomPlugin.getDefault().getImageRegistry().get("decoratedImageForClassJavaObject") ;
						}
						return iconImage;
					}
				} catch (JavaModelException e) {

				}
			}
		}
	}
	return icon;
}
 
Example #8
Source File: MissingDependenciesDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected Image getWarningDecoratedImage(Image image) {
	if(warningIcon == null){
		
		warningIcon =  new DecorationOverlayIcon(image,new ImageDescriptor() {
			
			@Override
			public ImageData getImageData() {
				return warningDecoratorImage.getImageData();
			}
		}, IDecoration.BOTTOM_RIGHT).createImage() ;
	}
	return warningIcon;
}
 
Example #9
Source File: MissingDependenciesDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected Image getErrorDecoratedImage(Image image) {
	if(errorIcon == null){
		errorIcon =  new DecorationOverlayIcon(image,new ImageDescriptor() {
			
			@Override
			public ImageData getImageData() {
				return errorDecoratorImage.getImageData();
			}
		} , IDecoration.BOTTOM_RIGHT).createImage() ;
	}
	return errorIcon;
}
 
Example #10
Source File: ProblemsLabelDecorator.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
	public Image decorateImage(Image image, Object obj) {
		if(image == null)
			return null;
		
		ImageDescriptor overlayImage = computeAdornmentFlags(obj);
		if(overlayImage != null) {
//			ImageDescriptor baseImage = new ImageImageDescriptor(image);
			return getRegistry().get(new DecorationOverlayIcon(image, overlayImage, IDecoration.BOTTOM_LEFT));
		}
		return image;
	}
 
Example #11
Source File: CPVariableElementLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public CPVariableElementLabelProvider(boolean highlightReadOnly) {
	ImageRegistry reg= JavaPlugin.getDefault().getImageRegistry();
	fJARImage= reg.get(JavaPluginImages.IMG_OBJS_EXTJAR);
	fFolderImage= PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);

	fDeprecatedJARImage= new DecorationOverlayIcon(fJARImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();
	fDeprecatedFolderImage= new DecorationOverlayIcon(fFolderImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();

	fHighlightReadOnly= highlightReadOnly;
}
 
Example #12
Source File: AbapGitStagingLabelProvider.java    From ADT_Frontend with MIT License 5 votes vote down vote up
/**
 * Method to overlay an image with another
 */
private Image decorateImage(Image baseImage, String overlayImagePath) {
	Bundle bundle = Platform.getBundle(AbapGitUIPlugin.PLUGIN_ID);
	URL fullPathString = BundleUtility.find(bundle, overlayImagePath);
	DecorationOverlayIcon doi = new DecorationOverlayIcon(//
			baseImage, ImageDescriptor.createFromURL(fullPathString), IDecoration.BOTTOM_RIGHT);
	return doi.createImage();
}
 
Example #13
Source File: LaunchConfigLabelProvider.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private Image decorateImage( Image image ) {
  Image result = null;
  if( image != null ) {
    ImageDescriptor imageDescriptor = Images.getImageDescriptor( RUNNING );
    DecorationOverlayIcon overlay = new DecorationOverlayIcon( image, imageDescriptor, BOTTOM_RIGHT );
    result = resourceManager.createImage( overlay );
  }
  return result;
}
 
Example #14
Source File: TypeScriptUIImageResource.java    From typescript.java with MIT License 5 votes vote down vote up
public static Image getDecoratedImage(Image baseImage, int severity) {
	initializeIfNeeded();
	String baseImageId = baseImage.toString();
	// Construct a new image identifier
	String decoratedImageId = baseImageId.concat(String.valueOf(severity));
	ImageDescriptor overlay = null;
	switch (severity) {
	case IStatus.ERROR:
		overlay = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
		break;
	case IStatus.WARNING:
		overlay = PlatformUI.getWorkbench().getSharedImages()
				.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING);
		break;
	default:
		return baseImage;
	}
	// Return the stored image if we have one
	Image image = imageRegistry.get(decoratedImageId);
	if (image != null) {
		return image;
	}
	// Otherwise create a new image and store it
	DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(baseImage,
			new ImageDescriptor[] { null, null, null, overlay, null }, size) {
	};
	imageRegistry.put(decoratedImageId, decoratedImage);
	return imageRegistry.get(decoratedImageId);
}
 
Example #15
Source File: PreferenceCategory.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Image getImage() {
  final Image categoryImage = getUndecoratedImage();
  if (hasRules() && hasOnlyMandatoryRules()) {
    final ImageDescriptor[] descriptors = new ImageDescriptor[ValidPreferenceConstants.DECORATION_QUADRANTS_COUNT];
    descriptors[IDecoration.BOTTOM_RIGHT] = ValidPreferenceConstants.LOCK_OVERLAY_IMAGE_DESCRIPTOR;
    // Overlay custom image over base image
    return getImageManager().createImage(new DecorationOverlayIcon(categoryImage, descriptors));
  } else {
    // No decoration
    return categoryImage;
  }
}
 
Example #16
Source File: PreferenceRule.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public Image getImage() {
  if (isOptional()) {
    // No decoration
    return getUndecoratedImage();
  } else {
    final ImageDescriptor[] descriptors = new ImageDescriptor[ValidPreferenceConstants.DECORATION_QUADRANTS_COUNT];
    descriptors[IDecoration.BOTTOM_RIGHT] = ValidPreferenceConstants.LOCK_OVERLAY_IMAGE_DESCRIPTOR;
    // Overlay custom image over base image
    return getImageManager().createImage(new DecorationOverlayIcon(getUndecoratedImage(), descriptors));
  }
}
 
Example #17
Source File: XtextSpyLabelProvider.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts")
public Image getImage(final Object element) {
  Image image = super.getImage(element);
  if (image != null) {
    Pair<Object, Integer> decoration = getDecoration(element);
    if (decoration != null && decoration.getFirst() != null) {
      Image overlay = convertToImage(decoration.getFirst());
      if (overlay != null) {
        image = new DecorationOverlayIcon(image, ImageDescriptor.createFromImage(overlay), decoration.getSecond()).createImage();
      }
    }
  }
  return image;
}
 
Example #18
Source File: XtextEditorErrorTickUpdater.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void updateEditorImage(XtextEditor xtextEditor) {
	Severity severity = getSeverity(xtextEditor);
	if (severity != null && severity != Severity.INFO) {
		ImageDescriptor descriptor = severity == Severity.ERROR ? XtextPluginImages.DESC_OVR_ERROR
				: XtextPluginImages.DESC_OVR_WARNING;
		DecorationOverlayIcon decorationOverlayIcon = new DecorationOverlayIcon(defaultImage, descriptor,
				IDecoration.BOTTOM_LEFT);
		scheduleUpdateEditor(decorationOverlayIcon);
	} else {
		scheduleUpdateEditor(defaultImage);
	}
}
 
Example #19
Source File: Activator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns the image with the specified Java image decorated added in the lower left quadrant of the image.
 */
private static ImageDescriptor decorateImageDescriptor(Image baseImage, ImageDescriptor overlayDescriptor) {
  return new DecorationOverlayIcon(baseImage, overlayDescriptor, IDecoration.BOTTOM_LEFT);
}
 
Example #20
Source File: CorePlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
  super.initializeImageRegistry(reg);

  reg.put(CoreImages.LIBRARY_ICON, imageDescriptorFromPath("icons/library_obj.gif"));

  reg.put(CoreImages.TERMINATE_ICON, imageDescriptorFromPath("icons/terminate_obj.gif"));

  ImageDescriptor errorOverlayDescriptor = imageDescriptorFromPath("icons/error_co.gif");
  reg.put(CoreImages.ERROR_OVERLAY, errorOverlayDescriptor);

  ImageDescriptor invalidSdkDescriptor = new DecorationOverlayIcon(
      getImage(CoreImages.LIBRARY_ICON), errorOverlayDescriptor, IDecoration.BOTTOM_LEFT);

  reg.put(CoreImages.INVALID_SDK_ICON, invalidSdkDescriptor);
}
 
Example #21
Source File: CamelDesignerPlugin.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
private static Image getOptionalOverlayIcon(Image base) {
    DecorationOverlayIcon decorationOverlayIcon = new DecorationOverlayIcon(base,
        createImageDescriptor(OPTIONAL_OVERLAY_ICON), IDecoration.TOP_LEFT);
    return decorationOverlayIcon.createImage();
}
 
Example #22
Source File: ImageManager.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
private static Image createImageWithOverlay(Image image, Image overlay, int quadrant) {
  return new DecorationOverlayIcon(image, getImageDescriptor(overlay), quadrant)
      .createImage(true);
}
 
Example #23
Source File: ApplicationFileStoreLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void applyUnparsableFileStyle(ViewerCell cell) {
    cell.setImage(new DecorationOverlayIcon(getImage(cell.getElement()),
            UIPlugin.getImageDescriptor("icons/problem.gif"), IDecoration.BOTTOM_RIGHT)
                    .createImage());
}
 
Example #24
Source File: ImportModelLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected DecorationOverlayIcon createConflictOverlay(final Image image) {
    return new DecorationOverlayIcon(image,
            Pics.getImageDescriptor("problem.gif", BosArchiveImporterPlugin.getDefault()),
            IDecoration.BOTTOM_RIGHT);
}
 
Example #25
Source File: ImportModelLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected DecorationOverlayIcon createStatusOverlay(final Image image, IStatus status) {
    return new DecorationOverlayIcon(image,
            statusDecorator(status),
            IDecoration.BOTTOM_LEFT);
}
 
Example #26
Source File: HierarchyLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected Image decorateRecursive(Image image) {
	return new DecorationOverlayIcon(image, XtextPluginImages.DESC_OVR_RECURSIVE, IDecoration.BOTTOM_LEFT).createImage();
}