Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Showing
with 185 additions and 75 deletions
CircularContentAnchorageVisualBase.java de227ce8a2a14eb4df7bdcf43b82d98f6ff17045 YELLOW
CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 YELLOW
CircularContentAnchorageVisualBase.java e1d3f982239beb38120c7eda6ecf319ab2779f9c RED
CircularContentVisualBase.java cc3caea328e36e90069b915e413c8e7e9522a939 GREEN
CircularDiagramAnchorageVisualBase.java 7a3b92fb1b135c218b9a5e16506acfc74a6b5468 YELLOW
CurveLinkVisualBase.java 0b8706214320d715966c86a5242ad21c8bf5a315 YELLOW
CurveSegment.java 445bc2607cb70ae1c788c27ba9fc637dd7df4956 YELLOW
EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 YELLOW
EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 YELLOW
CurveLinkVisualBase.java 5ce3086769004a9eb6800d7eb58379d831ff74b1 GREEN
CurveSegment.java 0e7f70e9526a74aaec2bec4f4fc16295521cf5f2 GREEN
EllipticBorderLocation.java 1e9b3d42c7fcd5495004fb30b0c499096a839967 GREEN
EllipticContentVisualBase.java dc2fddc9cfe5605bc8a5d09dd862845e360b23f5 GREEN
......@@ -84,6 +84,7 @@ public abstract class CircularContentAnchorageVisualBase extends ContentAnchorag
/** Returns the insets of the filled circle subtracted from {@link #getDimensions()}. */
protected double getInset() {
// TODO (SB): Magic constant
return 2;
}
......
......@@ -65,7 +65,7 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
for(int i = 2; i < pts; i += 3) {
Point2D ep = getBendPointLocation(i);
makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), markerSize, markerSize,
false, true, 0);
false, true, 0, getLabelText(i, pts + 1));
sp = ep;
cp1 = getBendPointLocation(i + 1);
cp2 = getBendPointLocation(i + 2);
......@@ -76,14 +76,16 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
.applyToPoint(getEndAnchorPoint());
// Last bend point is not selectable => set its feedback rectangle size to 0
makeCurve(sp, cp1, cp2, ep, getInvisibleSelectionLineWidth(), 0, markerSize,
showArrowOnLastSegment(), useLineArrow(), getArrowLength());
showArrowOnLastSegment(), useLineArrow(), getArrowLength(),
getLabelText(pts, pts + 1));
endFeedbackHandle.setX(ep.getX() - ms2);
endFeedbackHandle.setY(ep.getY() - ms2);
endFeedbackHandle.setWidth(markerSize);
endFeedbackHandle.setHeight(markerSize);
for(CurveSegment cs : segments) {
cs.addLinkNodes(layers, linkBundle);
cs.addLinkNodes(layers, linkBundle,
getLabelText(segments.indexOf(cs), segments.size()));
}
curvesAddedToSceneGraph = true;
}
......@@ -133,7 +135,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
// handle bend points
for(int i = 2; i < pts; i += 3) {
Point2D ep = getFeedbackChangeForBendPoint(i).applyToPoint(getBendPointLocation(i));
segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0);
segments.get(segIndex).update(sp, cp1, cp2, ep, markerSize, markerSize, 0,
getLabelText(i, pts));
sp = ep;
cp1 = getFeedbackChangeForBendPoint(i + 1).applyToPoint(getBendPointLocation(i + 1));
cp2 = getFeedbackChangeForBendPoint(i + 2).applyToPoint(getBendPointLocation(i + 2));
......@@ -142,7 +145,8 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
// end point
Point2D ep = getFeedbackChangeForBendPoint(END_OF_LINK_BEND_POINT_INDEX)
.applyToPoint(getEndAnchorPoint());
segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength());
segments.get(segIndex).update(sp, cp1, cp2, ep, 0, markerSize, getArrowLength(),
getLabelText(pts, pts));
endFeedbackHandle.setX(ep.getX() - ms2);
endFeedbackHandle.setY(ep.getY() - ms2);
endFeedbackHandle.setWidth(markerSize);
......@@ -338,10 +342,10 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
/** Creates the curve segment. */
private void makeCurve(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep, double selWidth,
double bpMarkerSize, double cpMarkerSize, boolean showArrow, boolean useLineArrow,
double arrowLength) {
double arrowLength, String labelText) {
CurveSegment segVis = new CurveSegment(sp.getX(), sp.getY(), cp1.getX(), cp1.getY(),
cp2.getX(), cp2.getY(), ep.getX(), ep.getY(), selWidth, bpMarkerSize, cpMarkerSize,
showArrow, useLineArrow, arrowLength);
showArrow, useLineArrow, arrowLength, labelText);
segments.add(segVis);
}
......@@ -448,4 +452,17 @@ public abstract class CurveLinkVisualBase extends LinkVisualBase {
cs.setMouseTransparent(true);
}
}
/**
* Returns the label text.
*
* @param currentSegment
* the current segment
* @param lastSegment
* the last index of a segment
* @return the label text for the current segment or null for no label
*/
protected String getLabelText(int currentSegment, int lastSegment) {
return null;
}
}
......@@ -13,6 +13,7 @@ import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.paint.Color.GRAY;
import static javafx.scene.paint.Color.RED;
import static javafx.scene.paint.Color.TRANSPARENT;
import static javafx.scene.paint.Color.WHITE;
import static javafx.scene.shape.StrokeLineCap.BUTT;
import static javafx.scene.shape.StrokeLineJoin.ROUND;
......@@ -21,11 +22,17 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramLayers.ILayer;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.widgets.LinkArrowWidget;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.paint.Paint;
import javafx.scene.shape.CubicCurve;
import javafx.scene.shape.Line;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.TextAlignment;
/**
* This class encapsulates {@link CubicCurve}s usually needed for every segment: a visible one, a
......@@ -48,12 +55,14 @@ final class CurveSegment {
private final Line helperEnd;
/** The arrow widget for curved links. */
private final LinkArrowWidget arrowWidget;
/** Stores the label. */
private Label label;
/** Constructor. */
public CurveSegment(double sx, double sy, double c1x, double c1y, double c2x, double c2y,
double ex, double ey, double selectionStrokeWidth, double bendPointFeedbackSize,
double controlPointFeedbackSize, boolean showArrow, boolean useLineArrow,
double arrowLength) {
double arrowLength, String labelText) {
visibleCurve = new CubicCurve(sx, sy, c1x, c1y, c2x, c2y, ex, ey);
visibleCurve.setStroke(BLACK);
visibleCurve.setFill(null);
......@@ -93,6 +102,12 @@ final class CurveSegment {
} else {
arrowWidget = null;
}
if(labelText != null) {
label = new Label(labelText);
label.setTextAlignment(TextAlignment.CENTER);
} else {
label = null;
}
}
/** Returns the visible curve. */
......@@ -145,7 +160,8 @@ final class CurveSegment {
/** Updates the segment coordinates. */
public void update(Point2D sp, Point2D cp1, Point2D cp2, Point2D ep,
double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength) {
double bendPointFeedbackSize, double controlPointFeedbackSize, double arrowLength,
String labelText) {
double sx = sp.getX();
double sy = sp.getY();
visibleCurve.setStartX(sx);
......@@ -196,16 +212,29 @@ final class CurveSegment {
if(arrowWidget != null) {
arrowWidget.update(ex, ey, c2x, c2y, arrowLength);
}
if(label != null) {
label.setText(labelText);
double lx = (sx + ex - label.getBoundsInLocal().getWidth()) / 2;
double ly = (sy + ey) / 2;
label.setLayoutX(lx);
label.setLayoutY(ly);
}
}
/** Adds the link nodes of this segment to the link layer node. */
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle) {
public void addLinkNodes(DiagramLayers layers, ILinkMVCBundle bundle, String labelText) {
ILayer linkLayer = layers.getLinkLayer();
linkLayer.add(visibleCurve, bundle);
linkLayer.add(clickableCurve, bundle);
if(arrowWidget != null) {
linkLayer.add(arrowWidget, bundle);
}
if(label != null) {
label.setText(labelText);
label.setBackground(
new Background(new BackgroundFill(WHITE, new CornerRadii(0), new Insets(0))));
layers.getTextLayer().add(label, bundle);
}
}
/** Removes the link nodes of this segment from the link layer node. */
......@@ -216,6 +245,9 @@ final class CurveSegment {
if(arrowWidget != null) {
linkLayer.remove(arrowWidget);
}
if(label != null) {
layers.getTextLayer().remove(label);
}
}
/** Adds the feedback nodes of this segment to the feedback layer node. */
......@@ -246,5 +278,8 @@ final class CurveSegment {
if(arrowWidget != null) {
arrowWidget.setMouseTransparent(transparent);
}
if(label != null) {
label.setMouseTransparent(transparent);
}
}
}
DiamondContentVisualBase.java 214dc886dba3f26a6404db5c521715466ce85522 YELLOW
LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc YELLOW
LineLinkVisualBase.java 41cee7c8258cb65080bfce2a5d785772305a8119 YELLOW
LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d YELLOW
RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 YELLOW
RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 YELLOW
RectangularContentVisualBase.java ccd23400a7ac47573127a39bc68c55c82baa44ad YELLOW
RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 YELLOW
RhomboidContentVisualBase.java 7a91e401034acc629179fb1a45416cd519f617d7 YELLOW
DiamondContentVisualBase.java de349d41b84b2063f74c03ff5ad7290855e997f7 RED
LineLinkGraph.java 85a06a553f88f7b9fb4bd9c06411725d9fb160fc GREEN
LineLinkVisualBase.java 5529031f89a96ad0322f011e89dad1ece785bc03 RED
LineSegment.java a8658ec5bcd930d417a148861831b9ebb70bb37d GREEN
RectangularBorderLocation.java 824472c353534d1094ae4f735a30a231b885f050 GREEN
RectangularContentAnchorageVisualBase.java 39981dc29cac42d77c6ffe855ecc8ccad1689230 GREEN
RectangularContentVisualBase.java aee9ac3dbd53ce89539252d9984ed103d955be2f RED
RectangularDiagramAnchorageVisualBase.java 1259d6d110becca9ae02c754036c6693f00de683 GREEN
RhomboidContentVisualBase.java 0c3820cbfd3763c3cb6b1a0cba5cc71d8eecea73 RED
......@@ -190,6 +190,7 @@ public abstract class DiamondContentVisualBase extends ContentVisualBase {
@Override
protected DiagramCoordinate getTextAnchorLocation() {
DiagramCoordinate textAnchorLocation = super.getTextAnchorLocation();
// TODO (SB): Magic constant
return textAnchorLocation.add(getCurrentBounds().getWidth() / 5, 0);
}
}
......@@ -339,6 +339,7 @@ public abstract class LineLinkVisualBase extends LinkVisualBase {
/** Returns the length of the arrow. */
protected double getArrowLength() {
// TODO (SB): Magic constant
return 10;
}
......
......@@ -28,6 +28,7 @@ import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
// TODO (SB): Check potential code duplication with RectangularContentVisualBase (dragGestureHitTest)
/** Base class for {@link ContentVisualBase content visuals} depicted by rectangles. */
public abstract class RectangularContentVisualBase extends ContentVisualBase {
/** Constructor. */
......@@ -98,6 +99,7 @@ public abstract class RectangularContentVisualBase extends ContentVisualBase {
/** Returns the dimensions of the corner arcs. */
protected Dimension2D getCornerArcDimensions() {
// TODO (SB): Magic constant
return new Dimension2D(15, 15);
}
......
......@@ -86,6 +86,7 @@ public abstract class RhomboidContentVisualBase extends ContentVisualBase {
/** Returns the offset of the upper and lower rhomboid line (0 = rectangle). */
public double getOffset() {
// TODO (SB): Magic constant
return 3.0 * getViewer().getFeatures().getHorizontalSpacing();
}
......@@ -123,6 +124,7 @@ public abstract class RhomboidContentVisualBase extends ContentVisualBase {
/** Returns the dimensions of the corner arcs. */
protected Dimension2D getCornerArcDimensions() {
// TODO (SB): Magic constant
return new Dimension2D(15, 15);
}
......
ExpandCollapseWidget.java f431b6a86f3ce1794c55b90f39a15cda4f92ea06 YELLOW
LinkArrowWidget.java 5354f14ca9d53cc3df88afb1867a266dfde65199 YELLOW
ExpandCollapseWidget.java f431b6a86f3ce1794c55b90f39a15cda4f92ea06 GREEN
LinkArrowWidget.java 5354f14ca9d53cc3df88afb1867a266dfde65199 GREEN
GraphicUtils.java 4d471a310a52bda1c090f956dcdbe90775b12cb8 GREEN
GraphicUtils.java 46cfc991cd3ef787fec3f95751bc680d68479e26 GREEN
JavaFXUtils.java db3cf28289109ffec64c8f96c7b2de779a977b3b GREEN
......@@ -28,21 +28,28 @@ import javafx.scene.paint.Color;
* @author munaro
*/
public class GraphicUtils {
/** The image cache of loaded images. */
private static final HashMap<String, Image> imageCache = new HashMap<>();
/** Returns the plugin-local URI string for the given resource. */
public static String getURIString(String pluginId, String localPath) {
if(!pluginId.endsWith("/") && !localPath.startsWith("/")) {
localPath = "/" + localPath;
}
return "platform:/plugin/" + pluginId + localPath;
}
/** Returns the Java FX Image load from the local path. */
/** Returns the Java FX Image loaded from the plugin's local path. */
public static Image getFXImage(String pluginId, String localPath) {
String uri = getURIString(pluginId, localPath);
if(uri == null) {
return null;
}
return getFXImageFromURI(uri);
}
/** Returns the Java FX Image loaded from the given URI. */
public static Image getFXImageFromURI(String uri) {
Image cacheImage = imageCache.get(uri);
if(cacheImage == null) {
InputStream in = null;
......
......@@ -3,8 +3,8 @@ IContextMenuContributor.java 0f09c76662c154cf52ddab61b417e82a42854162 GREEN
IContextMenuMultiSelectionContributor.java 125b31dd38009bc2095b7e6bc860e946e39f58c4 GREEN
IEditPartFactory.java 5729715847f553d95a5bad4a9211c7e6f458badd GREEN
IModelEditor.java 962d7f7758abc88bbc6064c8b4eb32da00abf8e8 GREEN
IModelEditorBinding.java 844865d93252b6c4a648c23ff28bb28fd42c17aa YELLOW
IModelElementHandler.java 21b4a96251e0267f156b4b8f2b95a97f6e81e646 GREEN
IModelEditorBinding.java 844865d93252b6c4a648c23ff28bb28fd42c17aa GREEN
IModelElementHandler.java 86a8ec88b9679bbe7f53cfa8d1592bd862873f80 GREEN
ITutorialStepUI.java b8aee2b95857484ab6ad9ecd55b5de9f0ea158e5 GREEN
ITutorialUIProvider.java aa0ff5db4d7ba0953e34edeb99f3e8279567e18f GREEN
ITutorialUIWhitelistProvider.java d703c1531c6ae7677c2d94cbc95d498dfa4a7e9b GREEN
......
......@@ -25,6 +25,8 @@ import org.fortiss.tooling.kernel.ui.extension.base.ModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.extension.base.NamedCommentedModelElementHandlerBase;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import javafx.scene.Node;
/**
* A model element handler provides information about a specific type of model
* elements like name, description, icon and certain kinds of sub-elements.
......@@ -49,6 +51,9 @@ public interface IModelElementHandler<T extends EObject> extends IEObjectAware<T
/** Returns image descriptor to be used as icon image. */
ImageDescriptor getIconImageDescriptor(T element);
/** Returns the JavaFX icon of the model element. */
Node getFXIcon(T element);
/**
* Returns all children acting as nodes, which are usually displayed as edit
* parts by graphical editors and entries in the navigator tree.
......
......@@ -4,11 +4,11 @@ EObjectActionBase.java 4ef9f8be59e64d4838acc9e268d418ba5d94fa1a GREEN
EReferenceListPropertySectionBase.java 7390dd7bfdc979e8ff0c5c30c67ab7b6c9d70c92 GREEN
EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREEN
EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN
FXEditorBase.java 2e520be0bbae7d0aebdff70218a124dbe0896ce2 GREEN
FXEditorBase.java 545085c3270f09d69b609f328792e904ebda23ff GREEN
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java 72a0735d0a516e53f34e485039471512c8ac6577 YELLOW
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 YELLOW
ModelElementHandlerBase.java 384727748f125c9d43f19d9c0eba4ba1be5a7a26 GREEN
LWFXEFEditorBase.java f6b160b700a0287021402b5702beb2bfdce3dc2e GREEN
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN
ModelElementHandlerBase.java d08583ffdf78938a14caeb46124eda4ce5cac3e4 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 20fb1daea544123ea941743aafeb9ac59daf5356 GREEN
......
......@@ -15,7 +15,15 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.extension.base;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
......@@ -28,15 +36,50 @@ import javafx.scene.Scene;
*
* @author hoelzlf
*/
public abstract class FXEditorBase<T extends EObject> extends EditorBase<T> {
public abstract class FXEditorBase<T extends EObject> extends EditorBase<T>
implements ISelectionProvider {
/** The list of {@link ISelectionChangedListener}s. */
private final List<ISelectionChangedListener> selectionListeners = new ArrayList<>();
/** {@inheritDoc} */
@Override
public final void createPartControl(Composite parent) {
FXCanvas canvas = new FXCanvas(parent, SWT.NONE);
Scene scene = new Scene(createSceneRoot());
canvas.setScene(scene);
getSite().setSelectionProvider(this);
}
/** Creates the root node of the scene. */
protected abstract Parent createSceneRoot();
/** {@inheritDoc} */
@Override
public final void addSelectionChangedListener(ISelectionChangedListener listener) {
if(!selectionListeners.contains(listener)) {
selectionListeners.add(listener);
}
}
/** {@inheritDoc} */
@Override
public final void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionListeners.remove(listener);
}
/** {@inheritDoc} */
@Override
public final void setSelection(ISelection selection) {
SelectionChangedEvent evt = new SelectionChangedEvent(this, selection);
for(ISelectionChangedListener scl : selectionListeners) {
scl.selectionChanged(evt);
}
}
/** {@inheritDoc} */
@Override
public ISelection getSelection() {
return StructuredSelection.EMPTY;
}
}
......@@ -23,10 +23,7 @@ import java.util.Objects;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer;
......@@ -51,12 +48,9 @@ import javafx.scene.Parent;
* @author hoelzl
* @author diewald
*/
public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T>
implements ISelectionProvider {
public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T> {
/** The diagram viewer. */
protected DiagramViewer viewer;
/** The list of {@link ISelectionChangedListener}s. */
private final List<ISelectionChangedListener> selectionListeners = new ArrayList<>();
/** References the delegating {@link IModelFactory} of this JavaFX {@link IEditorPart}. */
private IModelFactory delegatingModelFactory;
......@@ -75,7 +69,6 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T
viewer = new DiagramViewer(delegatingModelFactory, delegatingVisualFactory,
delegatingControllerFactory, cb -> modelSelected(), chg -> applyModelChange(chg));
customizeViewer();
getSite().setSelectionProvider(this);
return viewer.getVisualNode();
}
......@@ -117,29 +110,6 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T
ICommandStackService.getInstance().runAsCommand(editedObject, () -> chg.applyChange());
}
/** {@inheritDoc} */
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
if(!selectionListeners.contains(listener)) {
selectionListeners.add(listener);
}
}
/** {@inheritDoc} */
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionListeners.remove(listener);
}
/** {@inheritDoc} */
@Override
public void setSelection(ISelection selection) {
SelectionChangedEvent evt = new SelectionChangedEvent(this, selection);
for(ISelectionChangedListener scl : selectionListeners) {
scl.selectionChanged(evt);
}
}
/** {@inheritDoc} */
@Override
public ISelection getSelection() {
......
......@@ -16,6 +16,7 @@
package org.fortiss.tooling.kernel.ui.extension.base;
import static java.util.Collections.emptyList;
import static org.fortiss.tooling.common.ui.javafx.util.GraphicUtils.getFXImageFromURI;
import java.util.HashMap;
import java.util.List;
......@@ -28,6 +29,9 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import javafx.scene.Node;
import javafx.scene.image.ImageView;
/**
* Base implementation for {@link IModelElementHandler}s.
*
......@@ -40,7 +44,6 @@ import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
*/
public abstract class ModelElementHandlerBase<T extends EObject>
implements IModelElementHandler<T> {
/** Stores the icon image. */
private Map<ImageDescriptor, Image> iconImages = new HashMap<ImageDescriptor, Image>();
......@@ -76,6 +79,28 @@ public abstract class ModelElementHandlerBase<T extends EObject>
return iconImage;
}
/**
* Returns the URL to the JavaFX icon image.
*
* @param element
* the model element
* @return the URL of the icon
*/
protected String getFXIconURL(T element) {
return "platform:/plugin/org.fortiss.tooling.kernel.ui/icons/fix.png";
}
/** {@inheritDoc} */
@Override
public Node getFXIcon(T element) {
String uri = getFXIconURL(element);
if(uri == null) {
return null;
}
javafx.scene.image.Image img = getFXImageFromURI(uri);
return new ImageView(img);
}
/** The default implementation forwards the request by ignoring the model element. */
@Override
public ImageDescriptor getIconImageDescriptor(T element) {
......
DelegatingControllerFactory.java be19395684645d79d892e5caed079d4b7f5cb5b0 YELLOW
DelegatingControllerFactory.java 50b2a5057794d6df22649e267d282ca3aa16797c GREEN
DelegatingFactoryBase.java f421742267610f41bb6196346026d2f239d90ed0 GREEN
DelegatingModelFactory.java f94ca989a5b97ad3f073040bb46b9c0a87e35d6d YELLOW
DelegatingVisualFactory.java 8bb82e9d48b2577655e577e7e807629c6fd6f2db YELLOW
DelegatingModelFactory.java 2b5b22137d875ff7676990fb148034ab42e912da GREEN
DelegatingVisualFactory.java 17bd4a6bbd3b9f9f8f9104d8cd9b239ef4bac759 GREEN
......@@ -28,9 +28,10 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
/**
* Delegates the creational calls to concrete {@link IControllerFactory}s. The first non-null
* element returned by the factories of the initially given list is returned. If no element is
* created (all delegates returned null), this factory throws a {@link RuntimeException}.
* Delegates the creational calls to concrete {@link IControllerFactory}s. The first
* non-{@code null} element returned by the factories of the initially given list is returned. If no
* element is created (all delegates returned {@code null}), this factory throws a
* {@link RuntimeException}.
*
* @author hoelzl
* @author diewald
......