Commit 7ea7590d authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Added possibility to specify overlay in ModelElementHandler.

parent 61ceaec8
...@@ -4,7 +4,7 @@ EObjectActionBase.java 67c307ac15d7f45ad970ab1df42f4729fee09518 GREEN ...@@ -4,7 +4,7 @@ EObjectActionBase.java 67c307ac15d7f45ad970ab1df42f4729fee09518 GREEN
EReferencePropertySectionBase.java d4cce5af54efc59b33415a34d5130ab8952d60ce GREEN EReferencePropertySectionBase.java d4cce5af54efc59b33415a34d5130ab8952d60ce GREEN
EditorBase.java 3af0350a488adf676d5b5e5ccad2087fb97c3d5b GREEN EditorBase.java 3af0350a488adf676d5b5e5ccad2087fb97c3d5b GREEN
ModelEditorBindingBase.java 12f6323750cde28cefa99c1ec9d45191c8779109 GREEN ModelEditorBindingBase.java 12f6323750cde28cefa99c1ec9d45191c8779109 GREEN
ModelElementHandlerBase.java 135d078a83e2174e762168d7467b6def2ad26273 GREEN ModelElementHandlerBase.java 56590eab74170f91e2760ec5d44d2653667f1f94 YELLOW
MultiEObjectActionBase.java ab9170f3918a069fa2a3aabae0436618317fa7b8 GREEN MultiEObjectActionBase.java ab9170f3918a069fa2a3aabae0436618317fa7b8 GREEN
NamedCommentedModelElementHandlerBase.java 8f9cb1e750afb577f528d330165a9f377e23aa8b GREEN NamedCommentedModelElementHandlerBase.java 8f9cb1e750afb577f528d330165a9f377e23aa8b GREEN
PropertySectionBase.java f8e2cf4444ab4808ac8c45b65840619b367ba112 GREEN PropertySectionBase.java f8e2cf4444ab4808ac8c45b65840619b367ba112 GREEN
......
...@@ -22,7 +22,9 @@ import java.util.Map; ...@@ -22,7 +22,9 @@ import java.util.Map;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
/** /**
...@@ -58,6 +60,17 @@ public abstract class ModelElementHandlerBase<T extends EObject> implements IMod ...@@ -58,6 +60,17 @@ public abstract class ModelElementHandlerBase<T extends EObject> implements IMod
iconImage = descr.createImage(); iconImage = descr.createImage();
iconImages.put(descr, iconImage); iconImages.put(descr, iconImage);
} }
ImageDescriptor overlay = getIconOverlay(element);
if(overlay != null) {
Point resultImgSize = new Point(16, 16);
ImageDescriptor[] overlaysArray = new ImageDescriptor[] {null, null, null,
overlay, null};
DecorationOverlayIcon decorated =
new DecorationOverlayIcon(iconImage, overlaysArray, resultImgSize);
return decorated.createImage();
}
return iconImage; return iconImage;
} }
...@@ -127,4 +140,15 @@ public abstract class ModelElementHandlerBase<T extends EObject> implements IMod ...@@ -127,4 +140,15 @@ public abstract class ModelElementHandlerBase<T extends EObject> implements IMod
public EObject getPropertySectionRetargetElement(T element) { public EObject getPropertySectionRetargetElement(T element) {
return element; return element;
} }
/**
* Retrieves the overlay, that is applied to the icon of the given element.
*
* @param element
* The element for which its icon shall be decorated with the overlay.
* @return The decoration overlay for element's icon.
*/
public ImageDescriptor getIconOverlay(T element) {
return null;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment