Skip to content
Snippets Groups Projects
Commit e1c4fad9 authored by Simon Barner's avatar Simon Barner
Browse files

Create Display menu in DefaultDiagramController.contextMenuContributions

* Remove method ContextMenuUtils.createDisplayMenu() that duplicated it
* Rationale: Display menus are only applicable to diagrams. Hence it
  makes no sense to have the code in a utility class

Issue-Ref: 4097
Issue-Url: https://af3-developer.fortiss.org/issues/4097



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 9be21c13
No related branches found
No related tags found
1 merge request!1314097: Add hide/show grid context menu item for diagram editors
CurvedLinkLayoutedContentAnchorangeController.java e22faedbe98c3dab660b5d2df8ebd004e116c5ba GREEN
CurvedLinkLayoutedDiagramAnchorangeController.java f2e5e2a7cc9b6a070871e200e57371286bb15222 GREEN
EObjectDiagramController.java ccccc925eb7966b274aa7354f4e9d4c534b250c5 GREEN
EObjectDiagramController.java 7fe2cd69ee8449b0ecaeb42e4fe2b65fffd9b6c3 YELLOW
EObjectEllipticResizableContentControllerBase.java f12e8f5a646a23fe428ed4768bf041c8b885ec81 GREEN
EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN
EObjectRectangularResizableContentControllerBase.java cde6c13659611d927691c03ecd2621cff2414b03 GREEN
......
......@@ -16,7 +16,6 @@ package org.fortiss.tooling.base.ui.editor.fx.controller;
import static java.lang.Math.max;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createAutoLayoutMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createDisplayMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.canCompose;
......@@ -86,7 +85,8 @@ public class EObjectDiagramController<T extends EObject> extends DefaultDiagramC
IElementCompositionContext edc = createElementCompositionContext(modelParent, x, y, true,
getViewer().getFeatures().getCurrentZoomFactor());
List<MenuItem> result = createPrototypeMenu(modelParent, edc);
result.add(createDisplayMenu(getViewer()));
// Adds "Display" menu
result.addAll(super.contextMenuContributions(node, diagramLocation));
if(modelParent instanceof IHierarchicElement && enableAutoLayout()) {
result.add(createAutoLayoutMenu((IHierarchicElement)modelParent));
}
......
AbstractNameEditingSupport.java c57336a0e0da18711a1610ca667dfea76728807f GREEN
ActionUtils.java 322f43d4f92f992daef8ac88eb0f9197c840c89b GREEN
ContextMenuUtils.java 434d6b7aad095ce726caa4de42913391ed6e6832 GREEN
ContextMenuUtils.java 74a4264a1d3febb92c7cf9a78f6c12fa1c7ad2f0 YELLOW
DragAndDropBaseUtils.java d375377f9124f6113b2a295e6b0e09ac8966e564 GREEN
EllipseLayoutUIUtils.java 4dd9dbd96a45e8c455c019caa19e4a50f18336af GREEN
FXDNDUtils.java 6ce94e239e68f9e2b3cc0524b072606f4a120076 GREEN
......
......@@ -26,8 +26,6 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.ui.layout.auto.IAutoLayouter;
import org.fortiss.tooling.base.ui.layout.auto.KielerAutoLayouter;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.ICommandStackService;
......@@ -105,39 +103,4 @@ public final class ContextMenuUtils {
Point loc = createPoint((int)x, (int)y, "CompositionPoint");
return new ElementDropContext(target, loc, isRoot, zoom);
}
/** Returns the default display menu for interaction with diagram viewer features. */
public static Menu createDisplayMenu(DiagramViewer viewer) {
Menu menu = new Menu("Display ...");
DiagramViewerFeatures features = viewer.getFeatures();
// link highlighting
if(features.isLinkHighlightingEnabled()) {
MenuItem disableLinkHighlighting = new MenuItem("Disable Link Highlighting");
disableLinkHighlighting.setOnAction(evt -> {
features.setLinkHighlightingEnabled(false);
});
menu.getItems().add(disableLinkHighlighting);
} else {
MenuItem enableLinkHighlighting = new MenuItem("Enable Link Highlighting");
enableLinkHighlighting.setOnAction(evt -> {
features.setLinkHighlightingEnabled(true);
});
menu.getItems().add(enableLinkHighlighting);
}
// interaction area shading
if(features.isInteractionAreaShadingEnabled()) {
MenuItem disableInteractionShading = new MenuItem("Disable Interactive Area Shading");
disableInteractionShading.setOnAction(evt -> {
features.setInteractionAreaShadingEnabled(false);
});
menu.getItems().add(disableInteractionShading);
} else {
MenuItem enableInteractionShading = new MenuItem("Enable Interactive Area Shading");
enableInteractionShading.setOnAction(evt -> {
features.setInteractionAreaShadingEnabled(true);
});
menu.getItems().add(enableInteractionShading);
}
return menu;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment