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

Merge branch 'master' of https://git.fortiss.org/af3/kernel.git into 4248

parents 82d630fa 21a54349
No related branches found
No related tags found
1 merge request!2244248: Create sub context menus within Model Navigator context menu
......@@ -5,12 +5,12 @@ EObjectEllipticResizableContentControllerBase.java 7021ae2cadf40bdd099964908cc88
EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN
EObjectRectangularResizableContentControllerBase.java dbeb8371fdac0838c9a23b9dcff63f81aae1265b GREEN
KernelServiceBasedModelChangeProviderBase.java 8d1f8ef79ecd383ff74e5a2bbcf24345aabe70af GREEN
LayoutedContentAnchorageController.java 83f066a151dd2984c4bef64daf8165a0cd53b00f GREEN
LayoutedContentAnchorageController.java ba732aeb6a5c2b8c52c5dd7af5ba46b093a90f2c GREEN
LayoutedCurveLinkBendPointController.java d963a5e227de7bd8ba910c733df2ac7acf4fa1fa GREEN
LayoutedDiagramAnchorageController.java 89ee56e8e71a5fa635cfac81e84bbfe1d50e5776 GREEN
LayoutedDiagramAnchorageController.java 59916f198bee84f7f7ec029ba5d70100f15e1e38 GREEN
LayoutedEllipticResizableContentController.java 00037188773eb65866863ab89331bc981873957e GREEN
LayoutedLineLinkBendPointController.java 8022cc66c4d33d7bf357ceb4c9ca1694f4f2fda8 GREEN
LayoutedLinkBendPointController.java d3f22ffb43426da62e849074a9d5a64e4d70a7ad GREEN
LayoutedLinkBendPointController.java 225b2ba13f1f0ccdd46b204e9484e3650cc835cd GREEN
LayoutedRectangularResizableContentController.java 341f4a7da0d69360d7026af6d9b3d44dfd7d9bb1 GREEN
ModelElementFXEditorUIProviderBase.java 1ab1d053029e14510ff97c84821a62ddeaf595e7 GREEN
NamedCommentedLayoutModelChangeProvider.java 223e82c1b1cba842f6fae115182f5d0c6acb44b0 GREEN
/*******************************************************************************
* Copyright (c) 2017, 2018 fortiss GmbH.
* Copyright (c) 2017, 2018, 2023 fortiss GmbH.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which is available at
......@@ -20,10 +20,13 @@ import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTa
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.utils.LWFXEditorUtils;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.DelegatingContentAnchorageController;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
......@@ -113,4 +116,14 @@ public class LayoutedContentAnchorageController<T extends INamedCommentedElement
}
return LINK_TARGET_DENIED_TAG;
}
/** {@inheritDoc} */
@Override
public MVCBundleTag getLinkTargetEffectForMoveLink(ILinkMVCBundle linkBundle,
IAnchorageMVCBundle movedAnchorageBundle) {
ILayoutedModelElement ownModel = getLayoutedME();
return LWFXEditorUtils.getLinkTargetEffectForMoveLink(linkBundle, movedAnchorageBundle,
ownModel);
}
}
/*******************************************************************************
* Copyright (c) 2017, 2018 fortiss GmbH.
* Copyright (c) 2017, 2018, 2023 fortiss GmbH.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v2.0 which is available at
......@@ -21,10 +21,13 @@ import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTa
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.utils.LWFXEditorUtils;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange;
import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.MoveControllerBase;
import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
......@@ -123,4 +126,14 @@ public class LayoutedDiagramAnchorageController<T extends INamedCommentedElement
}
return LINK_TARGET_DENIED_TAG;
}
/** {@inheritDoc} */
@Override
public MVCBundleTag getLinkTargetEffectForMoveLink(ILinkMVCBundle linkBundle,
IAnchorageMVCBundle movedAnchorageBundle) {
ILayoutedModelElement ownModel = getLayoutedME();
return LWFXEditorUtils.getLinkTargetEffectForMoveLink(linkBundle, movedAnchorageBundle,
ownModel);
}
}
......@@ -22,6 +22,7 @@ import static org.fortiss.tooling.base.utils.LayoutDataUtils.removeConnectionPoi
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer;
......@@ -119,7 +120,18 @@ public abstract class LayoutedLinkBendPointController<T extends INamedCommentedE
@Override
protected void updateModelAfterLinkMove(ILinkMVCBundle linkBundle, IMVCBundle startBundle,
IMVCBundle endBundle) {
// ignored
EObject connectionObj = (EObject)linkBundle.getModel();
EObject sourceObj = (EObject)startBundle.getModel();
EObject targetObj = (EObject)endBundle.getModel();
IConnectionCompositorService connectionService = IConnectionCompositorService.getInstance();
if(connectionService.canReconnect(connectionObj, sourceObj,
targetObj, null)) {
connectionService.reconnect(connectionObj, sourceObj,
targetObj, null);
getViewer().updateFromModel();
}
}
/** Returns the list of bend-points. */
......
......@@ -5,7 +5,7 @@ EllipseLayoutUIUtils.java 0af2cfc038661828b1bb8c51c0a3816d453e8313 GREEN
FXDNDUtils.java 6ce94e239e68f9e2b3cc0524b072606f4a120076 GREEN
FontUtils.java a167a05bdaa8da9853705cc5134f30f6d81bc9f2 GREEN
GCStateManager.java 983973a92376b5c757c1253b32e33d0666ccdf7b GREEN
LWFXEditorUtils.java 32b62765bec43e610e49d11213d58285ccfe9b06 GREEN
LWFXEditorUtils.java 9ff4c23b65287cb31681441f432b9cbcaa5b43b5 GREEN
PropertiesViewUtils.java d345b4501c4092228edf1c98e0189317d53aaf22 GREEN
RectangleLayoutUIUtils.java 688cd42ff2b18182492da2062f5f2e0e6987f2d0 GREEN
SnapToGridUtils.java efbcbd51764d97cf086b92b37908be46a7d5d09d GREEN
......
......@@ -18,13 +18,21 @@ package org.fortiss.tooling.base.ui.utils;
import static java.lang.Math.atan2;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_ALLOWED_TAG;
import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTags.LINK_TARGET_DENIED_TAG;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.base.model.layout.EOrientation;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IAnchorageMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle;
import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import javafx.geometry.Point2D;
import javafx.geometry.Rectangle2D;
......@@ -154,6 +162,43 @@ public final class LWFXEditorUtils {
return false;
}
/**
* Computes the visual effect for connection targets, when reconnecting (i.e. moving the
* connection).
*
* @param linkBundle
* The {@link ILinkMVCBundle} (i.e. for the connection) to be moved.
* @param movedAnchorageBundle
* The {@link IAnchorageMVCBundle} (i.e. for the connector) to be moved.
* @param newTargetModel
* The model of the potential new target.
*
* @return The {@link MVCBundleTag} with the effect to be displayed.
*/
public static MVCBundleTag getLinkTargetEffectForMoveLink(ILinkMVCBundle linkBundle,
IAnchorageMVCBundle movedAnchorageBundle, ILayoutedModelElement newTargetModel) {
EObject srcModel = (EObject)linkBundle.getStartAnchorage().getModel();
EObject trgModel = (EObject)linkBundle.getEndAnchorage().getModel();
EObject movedAnchorageModel = (EObject)movedAnchorageBundle.getModel();
IConnectionCompositorService srv = IConnectionCompositorService.getInstance();
// Check whether source or target of the link are moved and check own model for eligibility
// as new source/target
EObject connectionModel = (EObject)linkBundle.getModel();
if(movedAnchorageModel == srcModel) {
if(srv.canReconnect(connectionModel, newTargetModel, trgModel, null)) {
return LINK_TARGET_ALLOWED_TAG;
}
} else {
if(srv.canReconnect(connectionModel, srcModel, newTargetModel, null)) {
return LINK_TARGET_ALLOWED_TAG;
}
}
return LINK_TARGET_DENIED_TAG;
}
/** Constructor. */
private LWFXEditorUtils() {
// prevent instantiation
......
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