use of org.eclipse.jface.viewers.DecorationOverlayIcon in project hale by halestudio.
the class InstanceValidationReportDetailsPage method createControls.
/**
* @see CustomReportDetailsPage#createControls(Composite)
*/
@Override
public Control createControls(Composite parent) {
// filtered tree sets itself GridData, so set layout to gridlayout
parent.setLayout(GridLayoutFactory.fillDefaults().create());
// create pattern filter for FilteredTree
PatternFilter filter = new TreePathPatternFilter();
filter.setIncludeLeadingWildcard(true);
// create FilteredTree
FilteredTree filteredTree = new TreePathFilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true);
treeViewer = filteredTree.getViewer();
// set content provider
contentProvider = new InstanceValidationReportDetailsContentProvider();
treeViewer.setContentProvider(contentProvider);
// set label provider
treeViewer.setLabelProvider(new InstanceValidationReportDetailsLabelProvider(contentProvider));
// set comparator
treeViewer.setComparator(new ViewerComparator() {
/**
* @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
*/
@Override
public int category(Object element) {
if (element instanceof QName || element instanceof Definition<?>)
// Path
return 0;
else if (element instanceof String)
// Category
return 1;
else
// InstanceValidationMessage
return 2;
}
});
// add menu on right-click
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
if (getValidSelection() == null)
return;
// selection is valid, offer link to transformed data view
manager.add(new ShowExampleAction());
}
});
// remove previous menus
menuMgr.setRemoveAllWhenShown(true);
// add menu to tree
treeViewer.getTree().setMenu(menu);
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
showSelectionInDataView();
}
});
Image noReportBaseImage = InstanceValidationUIPlugin.getDefault().getImageRegistry().get(InstanceValidationUIPlugin.IMG_INSTANCE_VALIDATION);
reportImage = new DecorationOverlayIcon(noReportBaseImage, PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING), IDecoration.BOTTOM_LEFT).createImage();
return filteredTree;
}
use of org.eclipse.jface.viewers.DecorationOverlayIcon in project xtext-eclipse by eclipse.
the class XtextEditorErrorTickUpdater method updateEditorImage.
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);
}
}
use of org.eclipse.jface.viewers.DecorationOverlayIcon in project dsl-devkit by dsldevkit.
the class PreferenceCategory method getImage.
/**
* {@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;
}
}
use of org.eclipse.jface.viewers.DecorationOverlayIcon in project egit by eclipse.
the class ProblemLabelDecorator method getDecoratedImage.
private Image getDecoratedImage(Image base, String teamImageId) {
ImageDescriptor overlay = TeamImages.getImageDescriptor(teamImageId);
DecorationOverlayIcon decorated = new DecorationOverlayIcon(base, overlay, IDecoration.BOTTOM_LEFT);
return (Image) this.resourceManager.get(decorated);
}
use of org.eclipse.jface.viewers.DecorationOverlayIcon in project tdq-studio-se by Talend.
the class UdiLabelProvider method getImage.
@Override
public Image getImage(Object element) {
if (element instanceof IFolder) {
return ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
}
if (element instanceof IFile) {
IndicatorDefinition findUdi = IndicatorResourceFileHelper.getInstance().findIndDefinition((IFile) element);
boolean validStatus = TaggedValueHelper.getValidStatus(findUdi);
ImageDescriptor imageDescriptor = ImageLib.getImageDescriptor(ImageLib.IND_DEFINITION);
if (!validStatus) {
ImageDescriptor warnImg = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJS_WARN_TSK);
DecorationOverlayIcon icon = new DecorationOverlayIcon(imageDescriptor.createImage(), warnImg, IDecoration.BOTTOM_RIGHT);
imageDescriptor = icon;
}
return imageDescriptor.createImage();
}
if (element instanceof File) {
return ImageLib.getImage(ImageLib.JAR_FILE);
}
return null;
}
Aggregations