diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings index ba0f9515784cfa691eaa2dce481d006b0114604d..33bd9a4175efdfb207c2846b15bc03da6c2b69c0 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/.ratings @@ -1,16 +1,17 @@ ContextMenuUtil.java 405387151d45b09dffb3b6ba44f980313c8edcaf GREEN -CurvedLinkLayoutedContentAnchorangeController.java 6d2b64c3d6c813ac001b1500ed0529ad6e561aaf GREEN +CurvedLinkLayoutedContentAnchorangeController.java e22faedbe98c3dab660b5d2df8ebd004e116c5ba GREEN +CurvedLinkLayoutedDiagramAnchorangeController.java f2e5e2a7cc9b6a070871e200e57371286bb15222 GREEN EObjectDiagramController.java 2b253941592ee25ead95223470f983f23ef9776f GREEN -EObjectEllipticResizableContentControllerBase.java 7c862a03b97d2f2cfdcc2fcee7434de2e1e257d2 GREEN +EObjectEllipticResizableContentControllerBase.java 958d3856daf5337cd75d0a6f163a27dcc8717160 GREEN EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN -EObjectRectangularResizableContentControllerBase.java e73cda8f54318f8b785a208215d9e31eaa46eff7 GREEN +EObjectRectangularResizableContentControllerBase.java 7cbc3e89b7b74106d56b8b4f845087e96e13d109 GREEN KernelServiceBasedModelChangeProviderBase.java 8d1f8ef79ecd383ff74e5a2bbcf24345aabe70af GREEN -LayoutModelChangeProvider.java b5449d02eaf39086909720c43e21bd061005fc9e GREEN -LayoutedContentAnchorageController.java 9fc513a7404277514c730f7702d45588f2d81878 GREEN -LayoutedCurveLinkBendPointController.java 54d7c294c4afaeadb6787408fbfe2ca1958c2de0 GREEN -LayoutedDiagramAnchorageController.java 32d7d77daf252d021458c39ebcfe502f26f29a98 GREEN -LayoutedEllipticResizableContentController.java 93bdeb7ecd5f7386724a9d7df5fff3174ab8ce10 GREEN -LayoutedLineLinkBendPointController.java f5fac4fe8e4b4c0259407acb6bfc80dbe9c3a1fb GREEN -LayoutedLinkBendPointController.java 3203d946de233274934dca1bcd47bbdc1d0a3b13 GREEN -LayoutedRectangularResizableContentController.java 3232d423572924363702898cf8ba240ce7042b65 GREEN +LayoutedContentAnchorageController.java 83f066a151dd2984c4bef64daf8165a0cd53b00f GREEN +LayoutedCurveLinkBendPointController.java d963a5e227de7bd8ba910c733df2ac7acf4fa1fa GREEN +LayoutedDiagramAnchorageController.java 89ee56e8e71a5fa635cfac81e84bbfe1d50e5776 GREEN +LayoutedEllipticResizableContentController.java 1c50e80121512de7ae1f2ba09e0e1f4d0e3f3104 GREEN +LayoutedLineLinkBendPointController.java f49c994a0c90612c44ec83d42cf858e476662e1f GREEN +LayoutedLinkBendPointController.java d06736b49b6ac9a073237b989895469891500e7f GREEN +LayoutedRectangularResizableContentController.java 341f4a7da0d69360d7026af6d9b3d44dfd7d9bb1 GREEN ModelElementFXEditorUIProviderBase.java b81bf7fc945d40f1f842876f07ba70799ab65f6d GREEN +NamedCommentedLayoutModelChangeProvider.java 223e82c1b1cba842f6fae115182f5d0c6acb44b0 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java index 6d2b64c3d6c813ac001b1500ed0529ad6e561aaf..e22faedbe98c3dab660b5d2df8ebd004e116c5ba 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedContentAnchorangeController.java @@ -17,8 +17,9 @@ package org.fortiss.tooling.base.ui.editor.fx.controller; import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint; -import org.fortiss.tooling.base.model.base.EntryConnectorBase; -import org.fortiss.tooling.base.model.base.ExitConnectorBase; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.base.model.base.HierarchicElementBase; import org.fortiss.tooling.base.model.element.IConnection; import org.fortiss.tooling.base.model.element.IConnector; @@ -27,13 +28,14 @@ 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.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; /** * {@link DelegatingContentAnchorageController} for diagrams with curved links. * * @author munaro */ -public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector & ILayoutedModelElement> +public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector & INamedCommentedElement & ILayoutedModelElement> extends LayoutedContentAnchorageController<T> { /** Constructor. */ @@ -43,7 +45,7 @@ public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector } /** {@inheritDoc} */ - @SuppressWarnings("unchecked") + // TODO(3978): Resolve code duplication in the link-method of link visuals @Override protected void link(IMVCBundle startBundle, DiagramCoordinate startLocation, IMVCBundle endBundle, DiagramCoordinate endLocation) { @@ -53,18 +55,22 @@ public class CurvedLinkLayoutedContentAnchorangeController<T extends IConnector return; } - // Create the connection + // The call to `super.link` (see next lines) does not return a reference to the + // newly created connection. However, as it is needed in order to add the handles + // we get it by comparing the root element's connections before and after the + // creation of the new link: + // 1) Here we get the list of existing connections + EList<IConnection> connectionsBefore = new BasicEList<IConnection>( + ((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections()); + // 2) Here we create the new connection super.link(startBundle, startLocation, endBundle, endLocation); - - // Fetch newly created connection by comparing incoming and outgoing connections of the - // given connectors. As only one connection is allowed between a pair of connectors, this - // 'findFirst' is safe. - T startConnector = (T)(startBundle.getModel() instanceof ExitConnectorBase - ? startBundle.getModel() : endBundle.getModel()); - T endConnector = (T)(endBundle.getModel() instanceof EntryConnectorBase - ? endBundle.getModel() : startBundle.getModel()); - IConnection connection = startConnector.getOutgoing().stream() - .filter(segment -> endConnector.getIncoming().contains(segment)).findFirst().get(); + // 3) Here we get the updated list of connections + EList<IConnection> connectionsAfter = new BasicEList<IConnection>( + ((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections()); + // 4) We remove all existing ones + connectionsAfter.removeAll(connectionsBefore); + // 5) And we are left with the newly added one. + IConnection connection = connectionsAfter.stream().findFirst().get(); // Create handles DiagramCoordinate startPosition = diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedDiagramAnchorangeController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedDiagramAnchorangeController.java new file mode 100644 index 0000000000000000000000000000000000000000..f2e5e2a7cc9b6a070871e200e57371286bb15222 --- /dev/null +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/CurvedLinkLayoutedDiagramAnchorangeController.java @@ -0,0 +1,87 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2020 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.base.ui.editor.fx.controller; + +import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.addConnectionPoint; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.fortiss.tooling.base.model.base.HierarchicElementBase; +import org.fortiss.tooling.base.model.element.IConnection; +import org.fortiss.tooling.base.model.element.IConnector; +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.IMVCBundle; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; + +/** + * {@link LayoutedDiagramAnchorageController} for diagrams with curved links. + * + * @author munaro + */ +public class CurvedLinkLayoutedDiagramAnchorangeController<T extends IConnector & INamedCommentedElement & ILayoutedModelElement> + extends LayoutedDiagramAnchorageController<T> { + + /** Constructor. */ + public CurvedLinkLayoutedDiagramAnchorangeController(IMVCBundle mvcb, Class<T> modelType) { + super(mvcb, modelType); + } + + /** {@inheritDoc} */ + // TODO(3978): Resolve code duplication in the link-method of link visuals + @Override + protected void link(IMVCBundle startBundle, DiagramCoordinate startLocation, + IMVCBundle endBundle, DiagramCoordinate endLocation) { + // Disable direct links between hierarchic element bases + if(startBundle.getModel() instanceof HierarchicElementBase || + endBundle.getModel() instanceof HierarchicElementBase) { + return; + } + + // The call to `super.link` (see next lines) does not return a reference to the + // newly created connection. However, as it is needed in order to add the handles + // we get it by comparing the root element's connections before and after the + // creation of the new link: + // 1) Here we get the list of existing connections + EList<IConnection> connectionsBefore = new BasicEList<IConnection>( + ((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections()); + // 2) Here we create the new connection + super.link(startBundle, startLocation, endBundle, endLocation); + // 3) Here we get the updated list of connections + EList<IConnection> connectionsAfter = new BasicEList<IConnection>( + ((HierarchicElementBase)(EObject)getViewer().getRootElement()).getConnections()); + // 4) We remove all existing ones + connectionsAfter.removeAll(connectionsBefore); + // 5) And we are left with the newly added one. + IConnection connection = connectionsAfter.stream().findFirst().get(); + + // Create handles + DiagramCoordinate startPosition = + new DiagramCoordinate(startBundle.getVisual().getCurrentBounds().getMaxX(), + startBundle.getVisual().getCurrentBounds().getMaxY()); + DiagramCoordinate endPosition = + new DiagramCoordinate(endBundle.getVisual().getCurrentBounds().getMaxX(), + endBundle.getVisual().getCurrentBounds().getMaxY()); + DiagramCoordinate middle = + new DiagramCoordinate((startPosition.getX() + endPosition.getX()) / 2, + (startPosition.getY() + endPosition.getY()) / 2); + addConnectionPoint((ILayoutedModelElement)connection, 0, (int)middle.getX(), + (int)middle.getY()); + addConnectionPoint((ILayoutedModelElement)connection, 1, (int)middle.getX(), + (int)middle.getY()); + } +} diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java index 7c862a03b97d2f2cfdcc2fcee7434de2e1e257d2..958d3856daf5337cd75d0a6f163a27dcc8717160 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectEllipticResizableContentControllerBase.java @@ -35,6 +35,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.elliptic.EllipticR import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; @@ -51,10 +52,10 @@ import javafx.scene.input.MouseEvent; * * @author hoelzl */ -public abstract class EObjectEllipticResizableContentControllerBase<T extends EObject> +public abstract class EObjectEllipticResizableContentControllerBase<T extends INamedCommentedElement & ILayoutedModelElement> extends EllipticResizableContentControllerBase { /** {@link IModelChangeProvider} for this controller */ - private final LayoutModelChangeProvider layoutModelChangeProvider; + private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider; /** The click controller handling double-click to open editor. */ private final IClickController openEditorDoubleClickController = new ClickControllerBase() { @Override @@ -94,8 +95,8 @@ public abstract class EObjectEllipticResizableContentControllerBase<T extends EO modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); } - ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); - this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme) { + @SuppressWarnings("unchecked") T lme = (T)mvcb.getModel(); + this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme) { /** {@inheritDoc} */ @Override protected boolean acceptNotification(Notification notification) { diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectRectangularResizableContentControllerBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectRectangularResizableContentControllerBase.java index e73cda8f54318f8b785a208215d9e31eaa46eff7..7cbc3e89b7b74106d56b8b4f845087e96e13d109 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectRectangularResizableContentControllerBase.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/EObjectRectangularResizableContentControllerBase.java @@ -41,6 +41,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler; import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; @@ -58,11 +59,11 @@ import javafx.scene.input.MouseEvent; * * @author hoelzl */ -public abstract class EObjectRectangularResizableContentControllerBase<T extends EObject> +public abstract class EObjectRectangularResizableContentControllerBase<T extends INamedCommentedElement & ILayoutedModelElement> extends RectangularResizableContentControllerBase { /** {@link IModelChangeProvider} for this controller */ - private final LayoutModelChangeProvider layoutModelChangeProvider; + private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider; /** The click controller handling double-click to open editor. */ private final IClickController openEditorDoubleClickController = new ClickControllerBase() { @Override @@ -102,8 +103,8 @@ public abstract class EObjectRectangularResizableContentControllerBase<T extends modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); } - ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); - this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme) { + @SuppressWarnings("unchecked") T lme = (T)mvcb.getModel(); + this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme) { /** {@inheritDoc} */ @Override protected boolean acceptNotification(Notification notification) { diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java index 9fc513a7404277514c730f7702d45588f2d81878..83f066a151dd2984c4bef64daf8165a0cd53b00f 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedContentAnchorageController.java @@ -18,14 +18,15 @@ import static org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerDefaultTa 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.IConnector; +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.controller.base.DelegatingContentAnchorageController; import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag; -import org.fortiss.tooling.base.model.element.IConnector; -import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IElementCompositorService; @@ -34,10 +35,10 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService; * * @author hoelzl */ -public class LayoutedContentAnchorageController<T extends ILayoutedModelElement> +public class LayoutedContentAnchorageController<T extends INamedCommentedElement & ILayoutedModelElement> extends DelegatingContentAnchorageController { /** {@link IModelChangeProvider} for this controller */ - private final LayoutModelChangeProvider layoutModelChangeProvider; + private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider; /** Constructor. */ public LayoutedContentAnchorageController(IContentAnchorageMVCBundle mvcb, Class<T> modelType) { @@ -49,8 +50,8 @@ public class LayoutedContentAnchorageController<T extends ILayoutedModelElement> modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); } - ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); - this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme); + @SuppressWarnings("unchecked") T lme = (T)mvcb.getModel(); + this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme); } /** Returns the model element. */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java index 54d7c294c4afaeadb6787408fbfe2ca1958c2de0..d963a5e227de7bd8ba910c733df2ac7acf4fa1fa 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedCurveLinkBendPointController.java @@ -28,6 +28,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.ILinkVisual; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import javafx.geometry.Point2D; @@ -37,7 +38,7 @@ import javafx.geometry.Point2D; * * @author munaro */ -public class LayoutedCurveLinkBendPointController<T extends ILayoutedModelElement> +public class LayoutedCurveLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement> extends LayoutedLinkBendPointController<T> { /** Constructor. */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedDiagramAnchorageController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedDiagramAnchorageController.java index 32d7d77daf252d021458c39ebcfe502f26f29a98..89ee56e8e71a5fa635cfac81e84bbfe1d50e5776 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedDiagramAnchorageController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedDiagramAnchorageController.java @@ -14,19 +14,20 @@ package org.fortiss.tooling.base.ui.editor.fx.controller; import static java.util.Objects.requireNonNull; +import static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode; 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 static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode; 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.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.IMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.MVCBundleTag; -import org.fortiss.tooling.base.model.element.IConnector; -import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IElementCompositorService; @@ -35,10 +36,10 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService; * * @author hoelzl */ -public class LayoutedDiagramAnchorageController<T extends ILayoutedModelElement> +public class LayoutedDiagramAnchorageController<T extends INamedCommentedElement & ILayoutedModelElement> extends MoveControllerBase { /** {@link IModelChangeProvider} for this controller */ - private final LayoutModelChangeProvider layoutModelChangeProvider; + private final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider; /** Constructor. */ public LayoutedDiagramAnchorageController(IMVCBundle mvcb, Class<T> modelType) { @@ -50,8 +51,8 @@ public class LayoutedDiagramAnchorageController<T extends ILayoutedModelElement> modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); } - ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); - this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme); + @SuppressWarnings("unchecked") T lme = (T)mvcb.getModel(); + this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme); } /** Returns the model element. */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java index 93bdeb7ecd5f7386724a9d7df5fff3174ab8ce10..1c50e80121512de7ae1f2ba09e0e1f4d0e3f3104 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedEllipticResizableContentController.java @@ -29,13 +29,14 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; /** * {@link IController} for {@link ILayoutedModelElement}s that have a elliptical shape. * * @author munaro */ -public class LayoutedEllipticResizableContentController<T extends ILayoutedModelElement> +public class LayoutedEllipticResizableContentController<T extends ILayoutedModelElement & INamedCommentedElement> extends EObjectEllipticResizableContentControllerBase<T> { /** Constructor */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java index f5fac4fe8e4b4c0259407acb6bfc80dbe9c3a1fb..f49c994a0c90612c44ec83d42cf858e476662e1f 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLineLinkBendPointController.java @@ -20,6 +20,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; /** * {@link IController} for {@link ILayoutedModelElement}s representing straight links and @@ -27,7 +28,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; * * @author hoelzl */ -public class LayoutedLineLinkBendPointController<T extends ILayoutedModelElement> +public class LayoutedLineLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement> extends LayoutedLinkBendPointController<T> { /** Constructor. */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java index 3203d946de233274934dca1bcd47bbdc1d0a3b13..d06736b49b6ac9a073237b989895469891500e7f 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedLinkBendPointController.java @@ -30,6 +30,7 @@ import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.base.LinkControlle import org.fortiss.tooling.common.ui.javafx.lwfxef.model.IModelChangeProvider; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.ILinkMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IMVCBundle; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; /** @@ -38,10 +39,10 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService; * * @author munaro */ -public abstract class LayoutedLinkBendPointController<T extends ILayoutedModelElement> +public abstract class LayoutedLinkBendPointController<T extends INamedCommentedElement & ILayoutedModelElement> extends LinkControllerBase { /** {@link IModelChangeProvider} for this controller */ - protected final LayoutModelChangeProvider layoutModelChangeProvider; + protected final NamedCommentedLayoutModelChangeProvider<T> layoutModelChangeProvider; /** Returns the model element. */ @SuppressWarnings("unchecked") @@ -65,8 +66,8 @@ public abstract class LayoutedLinkBendPointController<T extends ILayoutedModelEl modelType.getSimpleName() + ", but was " + model.getClass().getSimpleName()); } - ILayoutedModelElement lme = (ILayoutedModelElement)mvcb.getModel(); - this.layoutModelChangeProvider = new LayoutModelChangeProvider(lme); + @SuppressWarnings("unchecked") T lme = (T)mvcb.getModel(); + this.layoutModelChangeProvider = new NamedCommentedLayoutModelChangeProvider<T>(lme); } /** {@inheritDoc} */ diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedRectangularResizableContentController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedRectangularResizableContentController.java index 3232d423572924363702898cf8ba240ce7042b65..341f4a7da0d69360d7026af6d9b3d44dfd7d9bb1 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedRectangularResizableContentController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutedRectangularResizableContentController.java @@ -22,13 +22,14 @@ import static org.fortiss.tooling.base.utils.LayoutDataUtils.moveNode; import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodeSize; import static org.fortiss.tooling.base.utils.LayoutDataUtils.setStickyConnectorLayoutData; +import org.fortiss.tooling.base.model.element.IConnector; +import org.fortiss.tooling.base.model.layout.Dimension; +import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.common.ui.javafx.lwfxef.FeedbackChange; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IController; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentMVCBundle; -import org.fortiss.tooling.base.model.element.IConnector; -import org.fortiss.tooling.base.model.layout.Dimension; -import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; import javafx.geometry.Dimension2D; import javafx.geometry.Side; @@ -38,7 +39,7 @@ import javafx.geometry.Side; * * @author diewald */ -public class LayoutedRectangularResizableContentController<T extends ILayoutedModelElement> +public class LayoutedRectangularResizableContentController<T extends INamedCommentedElement & ILayoutedModelElement> extends EObjectRectangularResizableContentControllerBase<T> { /** Constructor. */ public LayoutedRectangularResizableContentController(IContentMVCBundle mvcb, diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutModelChangeProvider.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/NamedCommentedLayoutModelChangeProvider.java similarity index 85% rename from org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutModelChangeProvider.java rename to org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/NamedCommentedLayoutModelChangeProvider.java index b5449d02eaf39086909720c43e21bd061005fc9e..223e82c1b1cba842f6fae115182f5d0c6acb44b0 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/LayoutModelChangeProvider.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/controller/NamedCommentedLayoutModelChangeProvider.java @@ -24,28 +24,30 @@ import org.eclipse.emf.ecore.util.EContentAdapter; import org.fortiss.tooling.base.model.layout.ILayoutData; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.LayoutPackage; +import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage; +import org.fortiss.tooling.kernel.model.INamedCommentedElement; /** * A {@link KernelServiceBasedModelChangeProviderBase} for {@link ILayoutedModelElement}s. * * @author hoelzl */ -class LayoutModelChangeProvider - extends KernelServiceBasedModelChangeProviderBase<ILayoutedModelElement> { +class NamedCommentedLayoutModelChangeProvider<T extends INamedCommentedElement & ILayoutedModelElement> + extends KernelServiceBasedModelChangeProviderBase<T> { /** The layouted model element. */ - private final ILayoutedModelElement modelElement; + private final T modelElement; /** The layout EMF notification listener. */ private final LayoutModelElementAdapter notificationListener; /** Constructor. */ - public LayoutModelChangeProvider(ILayoutedModelElement modelElement) { + public NamedCommentedLayoutModelChangeProvider(T modelElement) { this.modelElement = modelElement; this.notificationListener = new LayoutModelElementAdapter(); } /** {@inheritDoc} */ @Override - protected ILayoutedModelElement getModelElement() { + protected T getModelElement() { return modelElement; } @@ -78,7 +80,11 @@ class LayoutModelChangeProvider Object notifier = notification.getNotifier(); if(notifier == modelElement) { Object feature = notification.getFeature(); - if(feature == LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) { + if(feature == FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME || + feature == FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT) { + addNotification(notification); + return; + } else if(feature == LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) { // self adapt to layout data super.notifyChanged(notification); addNotification(notification); diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings index ae3ce00b4dfec253e3adc2a33e0b985e930fce56..fb68c914d2f2a86e204431e75a68394825817a46 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/.ratings @@ -1,12 +1,12 @@ CoordinateCorrections.java 018bf229e5686afcb8540b61dd9d05b6e4a23e93 GREEN -LayoutedCircularAnchorageContentVisualBase.java cd85ff478e9b8e6b6d6f6c75cc5bf61522a63f3e GREEN +LayoutedCircularAnchorageContentVisualBase.java bf71e5e84ede0c26bd0632e4218aae55ab915ade GREEN LayoutedCircularAnchorageDiagramVisualBase.java 7634416bcb88a014d985143bf00a8d29ff1e3ff5 GREEN LayoutedCurveLinkVisual.java 5b06cd7e80eaf7cf6af37a4769eaafe2a1e591f3 GREEN LayoutedEllipticContentVisualBase.java 6f3daf386d5120793b90ce4569dd9bea33dd2a0f GREEN LayoutedLineLinkVisual.java 5fc26086e2f63afee403379ba8f09f5113d4c025 GREEN LayoutedRectangularContentVisualBase.java 61698ffd771ee2ad798025df8195d1bc09c2c765 GREEN -NamedLayoutedCircularAnchorageContentVisual.java bf06ac6e93d78e98b0359e0f879dccaefc920aa0 GREEN -NamedLayoutedCircularAnchorageDiagramVisual.java 53b9d739587d658f65dc03517257d6e29f4ba1fa GREEN +NamedLayoutedCircularAnchorageContentVisual.java 5ba0b5d133998eac47425696ef0a02b575418c2d GREEN +NamedLayoutedCircularAnchorageDiagramVisual.java 94eccb7bb03c5518ae875e9972f062ddd0e1f62d GREEN NamedLayoutedCurveLinkVisual.java 7945b2f550d5e4804f44891294ee60cc8ffcbf1e GREEN NamedLayoutedEllipticContentVisual.java f96a956c2f71b675eee56cfc613684397545da68 GREEN NamedLayoutedLineLinkVisual.java 4fc48616000516dc90ba22b7069ffdabadc9c377 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java index cd85ff478e9b8e6b6d6f6c75cc5bf61522a63f3e..bf71e5e84ede0c26bd0632e4218aae55ab915ade 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/LayoutedCircularAnchorageContentVisualBase.java @@ -157,6 +157,6 @@ public abstract class LayoutedCircularAnchorageContentVisualBase<T extends ILayo /** {@inheritDoc} */ @Override public double getAngleInDegree() { - return toDegrees(getConnectorAngleAsDouble(getModelElement())); + return 360 - toDegrees(getConnectorAngleAsDouble(getModelElement())); } } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageContentVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageContentVisual.java index bf06ac6e93d78e98b0359e0f879dccaefc920aa0..5ba0b5d133998eac47425696ef0a02b575418c2d 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageContentVisual.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageContentVisual.java @@ -15,29 +15,64 @@ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.base.ui.editor.fx.visual; -import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; -import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; +import static org.fortiss.tooling.base.ui.utils.LWFXEditorUtils.stickyConnectorHasVisibleConnections; + import org.fortiss.tooling.base.model.element.IConnector; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramLayers; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IContentAnchorageMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; import org.fortiss.tooling.kernel.model.INamedElement; +import javafx.geometry.Rectangle2D; +import javafx.geometry.VPos; +import javafx.scene.text.Text; +import javafx.scene.text.TextAlignment; + /** * {@link IVisual} for layouted and named {@link IConnector}s of some content element within a * diagram (sticky connectors). * * @author diewald */ -public class NamedLayoutedCircularAnchorageContentVisual<T extends ILayoutedModelElement & INamedElement> +public class NamedLayoutedCircularAnchorageContentVisual<T extends ILayoutedModelElement & INamedElement & IConnector> extends LayoutedCircularAnchorageContentVisualBase<T> { + /** The name text label. */ + private final Text nameText = new Text(""); /** Constructor. */ - public NamedLayoutedCircularAnchorageContentVisual(IContentAnchorageMVCBundle mvcb, Class<T> modelType) { + public NamedLayoutedCircularAnchorageContentVisual(IContentAnchorageMVCBundle mvcb, + Class<T> modelType) { super(mvcb, modelType); + nameText.setMouseTransparent(true); + nameText.setTextAlignment(TextAlignment.LEFT); + nameText.setTextOrigin(VPos.CENTER); } /** {@inheritDoc} */ @Override - protected String getHoverText() { + public void updateNodes(DiagramLayers layers) { + super.updateNodes(layers); + if(enableName()) { + Rectangle2D bounds = getCurrentBounds(); + nameText.setX(bounds.getMaxX()); + nameText.setY(bounds.getMinY() + bounds.getHeight() / 2); + nameText.setText(getName()); + if(nameText.getParent() == null) { + layers.getVisualFeedbackLayer().add(nameText, getMVCBundle()); + } + } else if(nameText.getParent() != null) { + layers.getVisualFeedbackLayer().remove(nameText); + } + } + + /** Returns whether the name label should be enabled. */ + public boolean enableName() { + return !stickyConnectorHasVisibleConnections(getModelElement()); + } + + /** Returns the name. */ + public String getName() { return getModelElement().getName(); } } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageDiagramVisual.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageDiagramVisual.java index 53b9d739587d658f65dc03517257d6e29f4ba1fa..94eccb7bb03c5518ae875e9972f062ddd0e1f62d 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageDiagramVisual.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/editor/fx/visual/NamedLayoutedCircularAnchorageDiagramVisual.java @@ -15,28 +15,63 @@ +--------------------------------------------------------------------------*/ package org.fortiss.tooling.base.ui.editor.fx.visual; -import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle; -import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; +import static org.fortiss.tooling.base.ui.utils.LWFXEditorUtils.freeConnectorHasVisibleConnections; + import org.fortiss.tooling.base.model.element.IConnector; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramLayers; +import org.fortiss.tooling.common.ui.javafx.lwfxef.mvc.IDiagramAnchorageMVCBundle; +import org.fortiss.tooling.common.ui.javafx.lwfxef.visual.IVisual; import org.fortiss.tooling.kernel.model.INamedElement; +import javafx.geometry.Rectangle2D; +import javafx.geometry.VPos; +import javafx.scene.text.Text; +import javafx.scene.text.TextAlignment; + /** * {@link IVisual} for layouted and named {@link IConnector}s within a diagram (free connectors). * * @author diewald */ -public class NamedLayoutedCircularAnchorageDiagramVisual<T extends ILayoutedModelElement & INamedElement> +public class NamedLayoutedCircularAnchorageDiagramVisual<T extends ILayoutedModelElement & INamedElement & IConnector> extends LayoutedCircularAnchorageDiagramVisualBase<T> { + /** The name text label. */ + private final Text nameText = new Text(""); /** Constructor. */ - public NamedLayoutedCircularAnchorageDiagramVisual(IDiagramAnchorageMVCBundle mvcb, Class<T> modelType) { + public NamedLayoutedCircularAnchorageDiagramVisual(IDiagramAnchorageMVCBundle mvcb, + Class<T> modelType) { super(mvcb, modelType); + nameText.setMouseTransparent(true); + nameText.setTextAlignment(TextAlignment.LEFT); + nameText.setTextOrigin(VPos.CENTER); } /** {@inheritDoc} */ @Override - protected String getHoverText() { + public void updateNodes(DiagramLayers layers) { + super.updateNodes(layers); + if(enableName()) { + Rectangle2D bounds = getCurrentBounds(); + nameText.setX(bounds.getMaxX()); + nameText.setY(bounds.getMinY() + bounds.getHeight() / 2); + nameText.setText(getName()); + if(nameText.getParent() == null) { + layers.getVisualFeedbackLayer().add(nameText, getMVCBundle()); + } + } else if(nameText.getParent() != null) { + layers.getVisualFeedbackLayer().remove(nameText); + } + } + + /** Returns whether the name label should be enabled. */ + public boolean enableName() { + return !freeConnectorHasVisibleConnections(getModelElement()); + } + + /** Returns the name. */ + public String getName() { return getModelElement().getName(); } } diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings index b6b09de379e179640e4e2959874cb52f189329a2..a92b49bdcccf734fd7bb9ad1cbcc3febe2b8897c 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/.ratings @@ -5,7 +5,7 @@ EllipseLayoutUIUtils.java 4dd9dbd96a45e8c455c019caa19e4a50f18336af GREEN FXDNDUtils.java 6ce94e239e68f9e2b3cc0524b072606f4a120076 GREEN FontUtils.java a167a05bdaa8da9853705cc5134f30f6d81bc9f2 GREEN GCStateManager.java 983973a92376b5c757c1253b32e33d0666ccdf7b GREEN -LWFXEditorUtils.java c624d3f0f6487b6d426b168dad048b2c39e71114 GREEN +LWFXEditorUtils.java 24ec0e23dc4b4e768ede8209335985867bdf0e35 GREEN LayoutDataUIUtils.java c85886ac313a6efb122532218eb134047ffd6631 GREEN PropertiesViewUtils.java d345b4501c4092228edf1c98e0189317d53aaf22 GREEN RectangleLayoutUIUtils.java ef4b872bb5b4a51174e9a29d9ef05e7cb3bff3a1 GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/LWFXEditorUtils.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/LWFXEditorUtils.java index c624d3f0f6487b6d426b168dad048b2c39e71114..24ec0e23dc4b4e768ede8209335985867bdf0e35 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/LWFXEditorUtils.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/utils/LWFXEditorUtils.java @@ -19,8 +19,12 @@ import static java.lang.Math.atan2; import static java.lang.Math.cos; import static java.lang.Math.sin; -import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramCoordinate; +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.common.ui.javafx.lwfxef.DiagramCoordinate; import javafx.geometry.Point2D; import javafx.geometry.Rectangle2D; @@ -99,6 +103,45 @@ public final class LWFXEditorUtils { return new DiagramCoordinate(nx, ny); } + /** + * Returns whether any connections of the given sticky connector are visible on the current + * level of hierarchy. + */ + public static boolean stickyConnectorHasVisibleConnections(IConnector connector) { + IHierarchicElement elem = connector.getOwner(); + IHierarchicElementContainer diagram = elem.getContainer(); + for(IConnection conn : connector.getIncoming()) { + if(conn.getOwner() == diagram) { + return true; + } + } + for(IConnection conn : connector.getOutgoing()) { + if(conn.getOwner() == diagram) { + return true; + } + } + return false; + } + + /** + * Returns whether any connections of the given free connector are visible on the current level + * of hierarchy. + */ + public static boolean freeConnectorHasVisibleConnections(IConnector connector) { + IHierarchicElement diagram = connector.getOwner(); + for(IConnection conn : connector.getIncoming()) { + if(conn.getOwner() == diagram) { + return true; + } + } + for(IConnection conn : connector.getOutgoing()) { + if(conn.getOwner() == diagram) { + return true; + } + } + return false; + } + /** Constructor. */ private LWFXEditorUtils() { // prevent instantiation diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings index c4e75d1473fa12a68837768868d2bedadd947d2c..ff2e522a03fc37676486e55c65dafe04b28011ce 100644 --- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings +++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/.ratings @@ -2,10 +2,9 @@ ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN ConnectorCompositorBase.java 0264edd4034da7187d1dbdf35a674c7067adf3cd GREEN ConnectorConnectionCompositorBase.java eed310a4710492b7ce3bc302c3db4e5c40f4d817 GREEN ConnectorHierarchicElementConnectionCompositorBase.java 7a8e4acf235d5eb006c859056cce89fbb0aac05d GREEN -ConstraintInstanceContainerCompositor.java 9cb23f13c6cddba18ac7f9dcfd1afd9e7bce4d77 GREEN -HierarchicElementCompositorBase.java eed5112371a5819843d65ab8463ec385e50ed1e4 GREEN +HierarchicElementCompositorBase.java 79381013dcbce69031523221e9fe5ba1224580df GREEN HierarchicElementConnectionCompositorBase.java c5c4914d01f96a8f564f9a3c9bf4685e0f1e9155 GREEN HierarchicElementConnectorConnectionCompositorBase.java 0dfbe483e893be9c97d681a2610549d73e5adebc GREEN LogMessageUserInteractionContext.java b145045589fba08b67a12b5d41c51729aa4ae94e GREEN -ModelElementCompositorBase.java 0c69a61e750fc67cb71093f077eb749d248da924 GREEN +ModelElementCompositorBase.java 7cf2c62b70258f3b0e7e2a2979078e4fce7c9856 GREEN ModelElementWithRefCopyMessage.java 486c90c5896d7fe4a4595c6dbe602838a044ad14 GREEN diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java index eed5112371a5819843d65ab8463ec385e50ed1e4..79381013dcbce69031523221e9fe5ba1224580df 100644 --- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java +++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/HierarchicElementCompositorBase.java @@ -26,7 +26,6 @@ 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.kernel.model.constraints.IConstrained; import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IElementCompositorService; @@ -44,11 +43,6 @@ public abstract class HierarchicElementCompositorBase<HE extends IHierarchicElem */ @Override public final boolean decompose(EObject contained) { - // If there exist any constraints, remove them first to avoid verification launches due to - // EMF notifications when the container is removed. - if(contained instanceof IConstrained) { - ((IConstrained)contained).getConstraintInstances().clear(); - } return iterateDecompose(contained) && decomposeSpecific(contained); } diff --git a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java index 0c69a61e750fc67cb71093f077eb749d248da924..7cf2c62b70258f3b0e7e2a2979078e4fce7c9856 100644 --- a/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java +++ b/org.fortiss.tooling.base/src/org/fortiss/tooling/base/compose/ModelElementCompositorBase.java @@ -31,8 +31,6 @@ import org.fortiss.tooling.kernel.extension.IElementCompositor; import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.model.INamedElement; -import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance; -import org.fortiss.tooling.kernel.model.constraints.IConstrained; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.service.IPersistencyService; @@ -88,15 +86,6 @@ public abstract class ModelElementCompositorBase<C extends EObject> extends Obse */ @Override public boolean decompose(EObject contained) { - // Removes first the constraints - if(contained instanceof IConstrained) { - for(ConstraintInstance ci : ((IConstrained)contained).getConstraintInstances()) { - for(IConstrained c : ci.getConstraineds()) { - c.getConstraintInstances().remove(ci); - } - EcoreUtil.delete(ci, true); - } - } return iterateDecompose(contained) && decomposeSpecific(contained); } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index e30861b5b187ba9e6eaba5b2918da8900bcf079a..6cf75f172549d1a985d1af27fdb24bcb1ccc48af 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -1,6 +1,6 @@ DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN -DynamicTreeTableUIProviderBase.java 75ddf3e91c08fd6a5853ab261593040d1039d774 GREEN +DynamicTreeTableUIProviderBase.java f4fd20e3d267bc39a33a3bbb18416312779ea886 GREEN DynamicTreeTableViewer.java 431ac62cbd6ad7df25852fce1b5a62a05ba510e3 GREEN DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN DynamicTreeViewer.java e9f19d16a2a7e5a1b03b8a8b543453ac7eb6a051 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java index 75ddf3e91c08fd6a5853ab261593040d1039d774..f4fd20e3d267bc39a33a3bbb18416312779ea886 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java @@ -13,14 +13,17 @@ *******************************************************************************/ package org.fortiss.tooling.common.ui.javafx.control.treetableview; -import static javafx.scene.control.cell.TextFieldTreeTableCell.forTreeTableColumn; - import javafx.scene.Node; import javafx.scene.control.ContextMenu; +import javafx.scene.control.TextField; import javafx.scene.control.TreeTableCell; import javafx.scene.control.TreeTableColumn; +import javafx.scene.control.cell.TextFieldTreeTableCell; import javafx.scene.input.Dragboard; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; import javafx.util.Callback; +import javafx.util.converter.DefaultStringConverter; /** * This UI provider is responsible to return the label, the icon, and the context menu for each cell @@ -128,8 +131,11 @@ public abstract class DynamicTreeTableUIProviderBase<T> { column.setOnEditCommit(null); return; } - column.setCellFactory(createEditableCellFactory()); + column.setCellFactory(createEditableCellFactory(i)); column.setEditable(true); + column.setOnEditStart(event -> { + event.getEventType(); + }); column.setOnEditCommit(event -> { T element = event.getRowValue().getValue(); int colIndex = event.getTreeTablePosition().getColumn(); @@ -141,8 +147,82 @@ public abstract class DynamicTreeTableUIProviderBase<T> { /** Creates a cell factory for editable cells. */ private Callback<TreeTableColumn<T, String>, TreeTableCell<T, String>> - createEditableCellFactory() { - return forTreeTableColumn(); + createEditableCellFactory(int colIndex) { + return param -> { + return new MyTextFieldTreeTableCell(colIndex); + }; + } + + /** Custom table cell implementation to allow on key released validation. */ + private class MyTextFieldTreeTableCell extends TextFieldTreeTableCell<T, String> { + /** The column index of this cell. */ + private final int columnIndex; + + /** Constructor. */ + public MyTextFieldTreeTableCell(int colIndex) { + this.columnIndex = colIndex; + setConverter(new DefaultStringConverter()); + } + + /** {@inheritDoc} */ + @Override + public void startEdit() { + if(!isEditable() || !getTreeTableView().isEditable() || + !getTableColumn().isEditable()) { + return; + } + super.startEdit(); + // the following code uses implementation details of + // CellUtils.startEdit(...) and CellUtils.createTextfield(...) + TextField tf = (TextField)getGraphic(); // CellUtils:228 + tf.setOnKeyReleased(t -> { + DynamicTreeTableUIProviderBase<T>.MyTextFieldTreeTableCell mythis = + MyTextFieldTreeTableCell.this; + if(t.getCode() == KeyCode.ESCAPE) { + mythis.cancelEdit(); + t.consume(); + } else { + T item = mythis.getTreeTableRow().getItem(); + validateOnKeyReleased(t, columnIndex, item, tf.getText()); + } + }); + } + + /** {@inheritDoc} */ + @Override + public void cancelEdit() { + super.cancelEdit(); + T item = getTreeTableRow().getItem(); + validateOnCancelEdit(columnIndex, item); + } + } + + /** + * Called when editing a cell was canceled. + * + * @param colIndex + * the index of the column + * @param item + * the row item + */ + public void validateOnCancelEdit(int colIndex, T item) { + // nothing to do + } + + /** + * Called when a key was released during editing. Implementors should consume the event. + * + * @param event + * the key released event + * @param colIndex + * the index of the column + * @param item + * the row item + * @param text + * the current textfield content + */ + public void validateOnKeyReleased(KeyEvent event, int colIndex, T item, String text) { + // nothing to do } /** Creates a cell factory for read-only cells. */ diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings index 28d2587c373396106aed0e3864a7707ac1fb97f5..4cef315c5d4ec318db6a093a1a314b8c10117307 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/.ratings @@ -1,3 +1,3 @@ CircularResizableContentControllerBase.java daf05a58eac298462a5f092503e506575b31dff1 GREEN CurveLinkBendPointControllerBase.java 4d119cd640b864f2193ea5c1a7f816310b7a57a4 GREEN -EllipticResizableContentControllerBase.java 42bcbdbf29c1cf2b71177e55f74358d1517d623f GREEN +EllipticResizableContentControllerBase.java 636f7c8683f90035d240411f96d1f40d504ffb19 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/EllipticResizableContentControllerBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/EllipticResizableContentControllerBase.java index 42bcbdbf29c1cf2b71177e55f74358d1517d623f..636f7c8683f90035d240411f96d1f40d504ffb19 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/EllipticResizableContentControllerBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/elliptic/EllipticResizableContentControllerBase.java @@ -68,7 +68,7 @@ public abstract class EllipticResizableContentControllerBase @Override protected void moveAnchorage(DiagramCoordinate delta) { EllipticBorderLocation rbl = getBorderLocation(delta); - moveAnchorageToAngle(anchorage, rbl.getAngleInDegree()); + moveAnchorageToAngle(anchorage, 360 - rbl.getAngleInDegree()); } } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/.ratings index 5c3dd63e4d68684cf019dbafd1692296426a68f5..e2718590c195b8ee187468c6b2db4b7fb764e9c1 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/.ratings @@ -6,7 +6,7 @@ EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREE EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN FXEditorBase.java 40caf638c7b4c02da5aece0d9d58883bce630e76 GREEN IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN -LWFXEFEditorBase.java f6b160b700a0287021402b5702beb2bfdce3dc2e GREEN +LWFXEFEditorBase.java 86fb5b558794ffa6471ca343934592b6fa4277f6 GREEN ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN ModelElementHandlerBase.java d0efc1e9ca2fbbefb861f1ae8176ad9ec08a08a8 GREEN MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/LWFXEFEditorBase.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/LWFXEFEditorBase.java index f6b160b700a0287021402b5702beb2bfdce3dc2e..86fb5b558794ffa6471ca343934592b6fa4277f6 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/LWFXEFEditorBase.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/extension/base/LWFXEFEditorBase.java @@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IEditorPart; import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewer; +import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerFeatures; import org.fortiss.tooling.common.ui.javafx.lwfxef.DiagramViewerSelection; import org.fortiss.tooling.common.ui.javafx.lwfxef.change.Change; import org.fortiss.tooling.common.ui.javafx.lwfxef.controller.IControllerFactory; @@ -68,6 +69,10 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T viewer = new DiagramViewer(delegatingModelFactory, delegatingVisualFactory, delegatingControllerFactory, cb -> modelSelected(), chg -> applyModelChange(chg)); + DiagramViewerFeatures features = viewer.getFeatures(); + // extend zoom factors + features.setZoomFactors(new double[] {0.5, 0.75, 1, 1.5, 2, 4, 6}); + features.setZoomFactorIndex(2); // Zoom x1 customizeViewer(); return viewer.getVisualNode(); } diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings index fd2078b766355261bbefb4db4293b6e65ecb2c06..049538585ec8e7a8318542312273964530838a66 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings @@ -1,5 +1,5 @@ ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN -CopyPasteUtils.java bbc5cf9c9dc03ebf8dc75d42c919fe6eb60b388e GREEN +CopyPasteUtils.java 62ac1094c1d56c83251b01ce7b52c2217625a79c GREEN DataBindingUtils.java 631c47881caa13fc567679a7e4416eb777af0713 GREEN DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN EObjectSelectionUtils.java 128cf8f96c6b9478171dff3deda662d5934f5f44 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java index bbc5cf9c9dc03ebf8dc75d42c919fe6eb60b388e..62ac1094c1d56c83251b01ce7b52c2217625a79c 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java @@ -23,7 +23,6 @@ import java.util.Collection; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.swt.dnd.Clipboard; @@ -36,7 +35,6 @@ import org.eclipse.ui.PlatformUI; import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext; import org.fortiss.tooling.kernel.model.INamedElement; import org.fortiss.tooling.kernel.model.ISpeciallyCopyiable; -import org.fortiss.tooling.kernel.model.constraints.IConstrained; import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfer; import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor; @@ -65,15 +63,6 @@ public class CopyPasteUtils { EcoreUtil.Copier copier = new EcoreUtil.Copier(true, true); for(EObject obj : sel) { content[i] = copier.copy(obj); - // Remove constraint instances: these are specific to their original elements and - // should not be copied. - TreeIterator<EObject> it = content[i].eAllContents(); - while(it.hasNext()) { - EObject subObj = it.next(); - if(subObj instanceof IConstrained) { - ((IConstrained)subObj).getConstraintInstances().clear(); - } - } i++; } copier.copyReferences(); diff --git a/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF b/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF index 8871b532b24149913f7120ba6d5d03f9bcadd9c7..dd8e11900cc82c37aad26f0107afd74c32e94978 100644 --- a/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.kernel/META-INF/MANIFEST.MF @@ -24,9 +24,6 @@ Export-Package: org.fortiss.tooling.kernel;uses:="org.eclipse.core.runtime, org.fortiss.tooling.kernel.introspection, org.fortiss.tooling.kernel.introspection.items, org.fortiss.tooling.kernel.model;uses:=org.eclipse.emf.ecore, - org.fortiss.tooling.kernel.model.constraints, - org.fortiss.tooling.kernel.model.constraints.impl, - org.fortiss.tooling.kernel.model.constraints.util, org.fortiss.tooling.kernel.model.impl;uses:=org.fortiss.tooling.kernel.model, org.fortiss.tooling.kernel.model.util;uses:="org.eclipse.emf.ecore, org.fortiss.tooling.kernel.model, diff --git a/org.fortiss.tooling.kernel/model/.ratings b/org.fortiss.tooling.kernel/model/.ratings index 998f10420429ee306ca747ef85893ad6df52b2dd..0870aefed834e97bdae25b330d3dc135717932a4 100644 --- a/org.fortiss.tooling.kernel/model/.ratings +++ b/org.fortiss.tooling.kernel/model/.ratings @@ -1 +1 @@ -kernel.ecore 4a3d1961b1e127d034898770d2899ac722d690a7 GREEN +kernel.ecore 0b76d12b66f6d7f045a547bb1775428075c82ced GREEN diff --git a/org.fortiss.tooling.kernel/model/kernel.ecore b/org.fortiss.tooling.kernel/model/kernel.ecore index 4a3d1961b1e127d034898770d2899ac722d690a7..0b76d12b66f6d7f045a547bb1775428075c82ced 100644 --- a/org.fortiss.tooling.kernel/model/kernel.ecore +++ b/org.fortiss.tooling.kernel/model/kernel.ecore @@ -144,109 +144,4 @@ <eParameters name="target" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/> </eOperations> </eClassifiers> - <eSubpackages name="constraints" nsURI="http://www.fortiss.org/tooling/base/model/element/constraints" - nsPrefix="org-fortiss-tooling-kernel-constraints"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: Consolidate with constraint metaclasses in tooling.base."/> - </eAnnotations> - <eClassifiers xsi:type="ecore:EClass" name="IConstrained" abstract="true" interface="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Element which can be constrained. Keeps track of all the constraints which apply to it."/> - </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EReference" name="constraintInstances" - upperBound="-1" eType="#//constraints/ConstraintInstance"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EReference" name="checksumsPerConstraintName" - upperBound="-1" eType="#//constraints/ConstraintNameToChecksum" containment="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ConstraintInstance"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Constraint "instance": link between the constrained element(s) and the constraint. Explicitly represented in the model in order to store the status and the checksum(s) of the constrained element(s)"/> - </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EReference" name="constraineds" upperBound="-1" - eType="#//constraints/IConstrained"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EReference" name="status" eType="#//constraints/IConstraintInstanceStatus" - containment="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="constraintName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="IConstraintInstanceStatus" abstract="true" - interface="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Status of verification of a constraint. Typically, should denote "Success", "Fail", "Outdated" or "Error" with possible specializations depending on the particular constraints."/> - </eAnnotations> - <eOperations name="getConstraint" eType="#//constraints/ConstraintInstance"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="body" value="return (ConstraintInstance)this.eContainer();"/> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eOperations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="OutdatedConstraintInstanceStatus" - eSuperTypes="#//constraints/IConstraintInstanceStatus"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Status that indicates that the verification of a constraint is outdated."/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="FailedConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Status that indicates that the verification of a constraint has failed."/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ErrorConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Status that indicates that an error has occurred during the verification of a constraint."/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="SuccessConstraintInstanceStatus" eSuperTypes="#//constraints/IConstraintInstanceStatus"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Status that indicates that a constraint has succesfully been verified."/> - </eAnnotations> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="IConstraintInstanceContainer" abstract="true" - interface="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Container to group multiple constraint instances."/> - </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EReference" name="constraintInstances" - upperBound="-1" eType="#//constraints/ConstraintInstance" containment="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ConstraintNameToChecksum" instanceClassName="java.util.Map$Entry"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Map type to map constraint names to checksum values."/> - </eAnnotations> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigInteger"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="TODO: write documentation (in the model!)"/> - </eAnnotations> - </eStructuralFeatures> - </eClassifiers> - </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.tooling.kernel/model/kernel.genmodel b/org.fortiss.tooling.kernel/model/kernel.genmodel index b19daa9d047f5ab8061073e5f9c5d021f7aa6d51..d9c1a57ec0fd3ba5a598e1d83e3c8abc805de23c 100644 --- a/org.fortiss.tooling.kernel/model/kernel.genmodel +++ b/org.fortiss.tooling.kernel/model/kernel.genmodel @@ -54,33 +54,5 @@ <genParameters ecoreParameter="kernel.ecore#//ISpeciallyCopyiable/canPaste/target"/> </genOperations> </genClasses> - <nestedGenPackages prefix="Constraints" basePackage="org.fortiss.tooling.kernel.model" - disposableProviderFactory="true" ecorePackage="kernel.ecore#//constraints"> - <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstrained"> - <genFeatures notify="false" createChild="false" propertySortChoices="true" - ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstrained/constraintInstances"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstrained/checksumsPerConstraintName"/> - </genClasses> - <genClasses ecoreClass="kernel.ecore#//constraints/ConstraintInstance"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/ConstraintInstance/constraineds"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/ConstraintInstance/status"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintInstance/constraintName"/> - </genClasses> - <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstraintInstanceStatus"> - <genOperations ecoreOperation="kernel.ecore#//constraints/IConstraintInstanceStatus/getConstraint" - body="return (ConstraintInstance)this.eContainer();"/> - </genClasses> - <genClasses ecoreClass="kernel.ecore#//constraints/OutdatedConstraintInstanceStatus"/> - <genClasses ecoreClass="kernel.ecore#//constraints/FailedConstraintInstanceStatus"/> - <genClasses ecoreClass="kernel.ecore#//constraints/ErrorConstraintInstanceStatus"/> - <genClasses ecoreClass="kernel.ecore#//constraints/SuccessConstraintInstanceStatus"/> - <genClasses image="false" ecoreClass="kernel.ecore#//constraints/IConstraintInstanceContainer"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference kernel.ecore#//constraints/IConstraintInstanceContainer/constraintInstances"/> - </genClasses> - <genClasses ecoreClass="kernel.ecore#//constraints/ConstraintNameToChecksum"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintNameToChecksum/key"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute kernel.ecore#//constraints/ConstraintNameToChecksum/value"/> - </genClasses> - </nestedGenPackages> </genPackages> </genmodel:GenModel> diff --git a/org.fortiss.tooling.kernel/plugin.xml b/org.fortiss.tooling.kernel/plugin.xml index cd3685f0954639e7be5284c8b4772cba11cdc4f4..1633cc75ac6ee359dc13c0e7485c372d0749f0be 100644 --- a/org.fortiss.tooling.kernel/plugin.xml +++ b/org.fortiss.tooling.kernel/plugin.xml @@ -22,14 +22,6 @@ </package> </extension> - <extension point="org.eclipse.emf.ecore.generated_package"> - <!-- @generated kernel --> - <package - uri="http://www.fortiss.org/tooling/base/model/element/constraints" - class="org.fortiss.tooling.kernel.model.constraints.ConstraintsPackage" - genModel="model/kernel.genmodel"/> - </extension> - <extension point="org.fortiss.tooling.kernel.modelPrototypeProvider"> <modelPrototypeProvider