Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/RestoreDurationConstraintLinkCommand.java144
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/DurationConstraintAutomaticRouter.java90
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionInteractionCompartmentEditPart.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCommentAnnotatedElementEditPart.java113
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintAppliedStereotypeEditPart.java73
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java926
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageAppliedStereotypeEditPart.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageEditPart.java130
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationAppliedStereotypeEditPart.java78
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationEditPart.java147
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkEndEditPolicy.java54
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkStartEditPolicy.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java402
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java33
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java135
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java66
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/DurationConstraintFigure.java119
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/DurationConstraintLocator.java127
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java125
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java146
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java319
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LinkRouteModelElementFactory.java176
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java31
32 files changed, 14 insertions, 3657 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/RestoreDurationConstraintLinkCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/RestoreDurationConstraintLinkCommand.java
deleted file mode 100644
index a9f8992914c..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/RestoreDurationConstraintLinkCommand.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.command;
-
-import java.util.Collections;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AnnotatedLinkEndEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AnnotatedLinkStartEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class RestoreDurationConstraintLinkCommand extends AbstractTransactionalCommand {
-
- private IAdaptable dcViewAdapter;
-
- private EditPartViewer viewer;
-
- private Boolean isOnTop;
-
- private Point targetLocation;
-
- private PreferencesHint diagramPreferenceHint;
-
- /**
- * Constructor.
- *
- * @param domain
- * @param label
- * @param affectedFiles
- */
- public RestoreDurationConstraintLinkCommand(TransactionalEditingDomain domain, IAdaptable dcViewAdapter, EditPartViewer viewer, Boolean isOnTop, Point targetLocation, PreferencesHint diagramPreferenceHint) {
- super(domain, "Resotore Annotated Link", null);
- this.dcViewAdapter = dcViewAdapter;
- this.viewer = viewer;
- this.isOnTop = isOnTop;
- this.targetLocation = targetLocation;
- this.diagramPreferenceHint = diagramPreferenceHint;
- }
-
- /**
- * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
- *
- * @return
- */
- @Override
- public boolean canExecute() {
- if (dcViewAdapter == null || viewer == null || targetLocation == null) {
- return false;
- }
- return super.canExecute();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- *
- * @param monitor
- * @param info
- * @return
- * @throws ExecutionException
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- return CommandResult.newCancelledCommandResult();
- }
- View view = dcViewAdapter.getAdapter(View.class);
- if (view == null) {
- return CommandResult.newErrorCommandResult("No view found");
- }
- EditPart sourceEditPart = (EditPart) viewer.getEditPartRegistry().get(view);
- if (sourceEditPart == null) {
- return CommandResult.newCancelledCommandResult();
- }
- Rectangle bounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) sourceEditPart);
- Point sourceLocation = null;
- if (isOnTop != null) {
- sourceLocation = isOnTop.booleanValue() ? bounds.getTop() : bounds.getBottom();
- } else if (targetLocation.y >= bounds.getCenter().y) {
- sourceLocation = bounds.getBottom();
- } else {
- sourceLocation = bounds.getTop();
- }
- EditPart targetEditPart = null;
- CreateConnectionViewRequest request = CreateViewRequestFactory.getCreateConnectionRequest(UMLElementTypes.Comment_AnnotatedElementEdge, diagramPreferenceHint);
- request.setLocation(sourceLocation);
- request.setType(AnnotatedLinkStartEditPolicy.REQ_ANNOTATED_LINK_START);
- request.setSourceEditPart(sourceEditPart);
- request.setTargetEditPart(sourceEditPart);
- Command command = sourceEditPart.getCommand(request);
- // connect...
- request.setLocation(targetLocation);
- request.setType(AnnotatedLinkEndEditPolicy.REQ_ANNOTATED_LINK_END);
- targetEditPart = sourceEditPart.getViewer().findObjectAtExcluding(targetLocation, Collections.emptySet(), getTargetingConditional(request));
- request.setTargetEditPart(targetEditPart);
- command = targetEditPart.getCommand(request);
- if (command != null && command.canExecute()) {
- command.execute();
- }
- return CommandResult.newOKCommandResult();
- }
-
- protected EditPartViewer.Conditional getTargetingConditional(final Request req) {
- return new EditPartViewer.Conditional() {
-
- @Override
- public boolean evaluate(EditPart editpart) {
- return editpart.getTargetEditPart(req) != null;
- }
- };
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/DurationConstraintAutomaticRouter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/DurationConstraintAutomaticRouter.java
deleted file mode 100644
index 78461e21347..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/DurationConstraintAutomaticRouter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers;
-
-import org.eclipse.draw2d.Connection;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.PrecisionPoint;
-import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter;
-import org.eclipse.gmf.runtime.notation.View;
-
-public class DurationConstraintAutomaticRouter extends ObliqueRouter {
-
- public DurationConstraintAutomaticRouter(View notationView) {
- super();
- }
-
- @Override
- protected void resetEndPointsToEdge(Connection conn, PointList newLine) {
- if (newLine.size() < 2) {
- /*
- * Connection must have at least 2 points in the list: the source
- * and target anchor points. Otherwise it's invalid connection.
- * Invalid connection case: add a dumb point at the start of the
- * list and at the end of the list. The first and the last point in
- * the list are replaced by the new source and target anchor points
- * in this method
- */
- newLine.addPoint(0, 0);
- newLine.insertPoint(new Point(), 0);
- }
-
- PrecisionPoint sourceAnchorPoint = null, targetAnchorPoint = null;
- while (newLine.size() != 2) {
- newLine.removePoint(1);
- }
- PrecisionPoint sourceReference = getAnchorReference(conn.getTargetAnchor());
- sourceAnchorPoint = getAnchorLocation(conn.getSourceAnchor(), sourceReference);
- targetAnchorPoint = getAnchorLocation(conn.getTargetAnchor(), sourceAnchorPoint);
- Point midpoint = recomputeBenpointLocation(conn);
- newLine.addPoint(midpoint);
- newLine.setPoint(midpoint, 1);
-
- conn.translateToRelative(sourceAnchorPoint);
- conn.translateToRelative(targetAnchorPoint);
-
- newLine.setPoint(new PrecisionPoint(sourceAnchorPoint.preciseX(), sourceAnchorPoint.preciseY()), 0);
- newLine.setPoint(targetAnchorPoint, newLine.size() - 1);
- }
-
- public Point recomputeBenpointLocation(Connection conn) {
- PrecisionPoint a1 = new PrecisionPoint(conn.getSourceAnchor().getReferencePoint());
- PrecisionPoint a2 = new PrecisionPoint(conn.getTargetAnchor().getReferencePoint());
- PrecisionPoint a3 = new PrecisionPoint(conn.getSourceAnchor().getLocation(a1));
- PrecisionPoint a4 = new PrecisionPoint(conn.getTargetAnchor().getLocation(a2));
- conn.translateToRelative(a3);
- conn.translateToRelative(a4);
- return new PrecisionPoint(a4.preciseX() + computeOffset(a3.preciseX(), a4.preciseX()), a3.preciseY());
- }
-
- private double computeOffset(double x, double x2) {
- if (Math.abs(x - x2) > 20) {
- return 20 * Math.signum(x - x2);
- } else {
- return (x - x2) * 0.5;
- }
- }
-
- private PrecisionPoint getAnchorLocation(ConnectionAnchor anchor, Point reference) {
- return new PrecisionPoint(anchor.getLocation(reference));
- }
-
- private PrecisionPoint getAnchorReference(ConnectionAnchor anchor) {
- return new PrecisionPoint(anchor.getReferencePoint());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionInteractionCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionInteractionCompartmentEditPart.java
index 19df9b50215..abdb45d7f30 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionInteractionCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionInteractionCompartmentEditPart.java
@@ -25,13 +25,8 @@ import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.ReconnectRequest;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionFragmentContainerCreationEditPolicy;
-import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
-import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
/**
* @author Celine JANSSENS
@@ -63,15 +58,6 @@ public class CInteractionInteractionCompartmentEditPart extends InteractionInter
*/
@Override
public Command getCommand(Request request) {
- if (request instanceof CreateViewAndElementRequest && request.getType().equals(REQ_CREATE)) {
- CreateViewAndElementRequest createrequest = (CreateViewAndElementRequest) request;
- ViewAndElementDescriptor descriptor = createrequest.getViewAndElementDescriptor();
- IElementType elementType = descriptor.getElementAdapter().getAdapter(IElementType.class);
- if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.DURATION_CONSTRAINT_SHAPE)) {
- return null;
- }
- }
-
// ExecutionSpecification can't be drop into Interaction
if (request instanceof ChangeBoundsRequest) {
List<?> editParts = ((ChangeBoundsRequest) request).getEditParts();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCommentAnnotatedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCommentAnnotatedElementEditPart.java
deleted file mode 100644
index a3973aae58a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCommentAnnotatedElementEditPart.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.ConnectionLayer;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx;
-import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.FanRouter;
-import org.eclipse.gmf.runtime.gef.ui.internal.tools.SelectConnectionEditPartTracker;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.RoutingStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.DurationConstraintAutomaticRouter;
-import org.eclipse.papyrus.uml.diagram.sequence.util.LinkRouteModelElementFactory;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomCommentAnnotatedElementEditPart extends CommentAnnotatedElementEditPart implements ITreeBranchEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomCommentAnnotatedElementEditPart(View view) {
- super(view);
- }
-
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- super.handleNotificationEvent(event);
- if (LinkRouteModelElementFactory.isRoutingNotification(event)) {
- installRouter();
- }
- }
-
- private FanRouter customRouter;
-
- @Override
- protected void installRouter() {
- if (this.getSource() instanceof CustomDurationConstraintEditPart) {
- ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
- RoutingStyle style = (RoutingStyle) ((View) getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE);
- if (style != null && cLayer instanceof ConnectionLayerEx) {
- ConnectionLayerEx cLayerEx = (ConnectionLayerEx) cLayer;
- if (LinkRouteModelElementFactory.isAutomaticRouting(this.getNotationView())) {
- CustomDurationConstraintEditPart customDurationConstraintEditPart = (CustomDurationConstraintEditPart) this.getSource();
- if (customRouter == null) {
- FanRouter router = new FanRouter();
- router.setNextRouter(new DurationConstraintAutomaticRouter(this.getNotationView()));
- customRouter = router;
- }
- getConnectionFigure().setConnectionRouter(customRouter);
- } else {
- getConnectionFigure().setConnectionRouter(cLayerEx.getObliqueRouter());
- }
- }
- refreshRouterChange();
- } else {
- super.installRouter();
- }
- }
-
- @Override
- public void setSource(EditPart editPart) {
- super.setSource(editPart);
- // Fixed bug about duration constraint links' automatic router.
- if (editPart instanceof CustomDurationConstraintEditPart) {
- installRouter();
- }
- }
-
- @Override
- public DragTracker getDragTracker(final Request req) {
- return new SelectConnectionEditPartTrackerEx(this);
- }
-
- class SelectConnectionEditPartTrackerEx extends SelectConnectionEditPartTracker {
-
- public SelectConnectionEditPartTrackerEx(CommentAnnotatedElementEditPart owner) {
- super(owner);
- }
-
- @Override
- protected boolean handleDragInProgress() {
- if (isInState(STATE_DRAG_IN_PROGRESS) && shouldAllowDrag()) {
- LinkRouteModelElementFactory.switchToManualRouting(getEdge());
- super.handleDragInProgress();
- }
- return true;
- }
- };
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintAppliedStereotypeEditPart.java
deleted file mode 100644
index 470824f5114..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintAppliedStereotypeEditPart.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeExternalNodeLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.AppliedStereotypeLabelFigure;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationConstraintAppliedStereotypeEditPart extends DurationConstraintAppliedStereotypeEditPart implements IPapyrusEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationConstraintAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- public IFigure getPrimaryShape() {
- return getFigure();
- }
-
- @Override
- protected void refreshLabel() {
- // We do NOT want to update label with the Parser.
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- removeEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY);
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeLabelEditPolicy());
- }
-
- @Override
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeLabelFigure();
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java
deleted file mode 100644
index 581db81737b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintEditPart.java
+++ /dev/null
@@ -1,926 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PolylineShape;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.PrecisionPoint;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.handles.HandleBounds;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.render.editparts.RenderedDiagramRootEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
-import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.LinesBorder;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper.FixedAnchorEx;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeCommentCreationEditPolicyEx;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.DurationConstraintFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
-import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-
-/**
- * Add implementing IPapyrusEditPart to displaying Stereotypes.
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationConstraintEditPart extends DurationConstraintEditPart implements IPapyrusEditPart {
-
- private static final String ARROW = "Arrow";
-
- private static final String DIRECTION = "Direction";
-
- private static final String VERTICAL = "vertical";
-
- private static final String HORIZONTAL = "horizontal";
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationConstraintEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- // install a editpolicy to display stereotypes, there's a bug on super class.
- installEditPolicy(AppliedStereotypeCommentEditPolicy.APPLIED_STEREOTYPE_COMMENT, new AppliedStereotypeCommentCreationEditPolicyEx());
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
- *
- * @param request
- * The request
- * @return The anchor
- */
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(Request request) {
- IHintedType type = (IHintedType) UMLElementTypes.Comment_AnnotatedElementEdge;
- if (request instanceof CreateConnectionViewRequest) {
- String hint = ((CreateConnectionViewRequest) request).getConnectionViewDescriptor().getSemanticHint();
- if (hint.equals(type.getSemanticHint())) {
- return new RotateAnchor(getFigure(), computeAnchorLocation(((CreateConnectionViewRequest) request).getLocation()));
- }
- } else if (request instanceof ReconnectRequest) {
- ConnectionEditPart linkPart = ((ReconnectRequest) request).getConnectionEditPart();
- if (linkPart instanceof CommentAnnotatedElementEditPart) {
- return new RotateAnchor(getFigure(), computeAnchorLocation(((ReconnectRequest) request).getLocation()));
- }
- }
- return super.getSourceConnectionAnchor(request);
- }
-
- protected int computeAnchorLocation(Point location) {
- Rectangle box = getBox();
- if (isArrowVertical()) {
- if (location.getDistance2(box.getTop()) > location.getDistance2(box.getBottom())) {
- return PositionConstants.BOTTOM;
- }
- return PositionConstants.TOP;
- } else {
- if (location.getDistance2(box.getLeft()) > location.getDistance2(box.getRight())) {
- return PositionConstants.RIGHT;
- }
- return PositionConstants.LEFT;
- }
- }
-
- protected Rectangle getBox() {
- Rectangle rBox = getFigure() instanceof HandleBounds ? new PrecisionRectangle(((HandleBounds) getFigure()).getHandleBounds()) : new PrecisionRectangle(getFigure().getBounds());
- getFigure().translateToAbsolute(rBox);
- return rBox;
- }
-
- public boolean canCreateLink(Point point) {
- DurationConstraint dc = (DurationConstraint) this.resolveSemanticElement();
-
- int count = 0; // link counts
- List list = this.getSourceConnections();
- for (Object o : list) {
- if (o instanceof CustomCommentAnnotatedElementEditPart) {
- count++;
- }
- }
- if (count >= 2) {
- return false;
- }
-
- if (count < 1) {
- return true;
- }
-
- int targetPosition = computeAnchorLocation(point);
- if (findLinkAtPosition(targetPosition)) {
- return false;
- }
- return true;
- }
-
- // protected void refreshSourceConnections() {
- // super.refreshSourceConnections();
- // Display.getDefault().asyncExec(new Runnable(){
- // public void run() {
- // refreshBorder();
- // }
- // });
- // }
- //
- // public void refresh(){
- // super.refresh();
- // refreshBorder();
- // }
- //
- // private void refreshBorder() {
- // if(getPrimaryShape() instanceof CustomDurationConstraintFigure){
- // CustomDurationConstraintFigure fig = (CustomDurationConstraintFigure)getPrimaryShape();
- // fig.setBorderVisible(hasTopLink(), hasBottomLink());
- // }
- // }
-
- public boolean hasTopLink() {
- return findLinkAtPosition(PositionConstants.TOP);
- }
-
- public boolean hasBottomLink() {
- return findLinkAtPosition(PositionConstants.BOTTOM);
- }
-
- protected boolean findLinkAtPosition(int targetPos) {
- List list = this.getSourceConnections();
- for (Object o : list) {
- if (o instanceof CustomCommentAnnotatedElementEditPart) {
- CustomCommentAnnotatedElementEditPart connPart = (CustomCommentAnnotatedElementEditPart) o;
- if ((targetPos & getSourceAnchorPosition(connPart)) > 0) {
- return true;
- }
-
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
- *
- * @param connEditPart
- * The connection edit part.
- * @return The anchor.
- */
- @Override
- public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
- ConnectionAnchor anchor = null;
- if (connEditPart instanceof CommentAnnotatedElementEditPart) {
- anchor = new RotateAnchor(getFigure(), getSourceAnchorPosition((CommentAnnotatedElementEditPart) connEditPart));
- } else {
- anchor = super.getSourceConnectionAnchor(connEditPart);
- }
-
- return anchor;
- }
-
- private int getSourceAnchorPosition(CommentAnnotatedElementEditPart connEditPart) {
- String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, true);
- if (terminal.length() > 0) {
- return parseLocation(terminal);
- }
- return PositionConstants.TOP;
- }
-
- @Override
- protected void refreshBounds() {
- super.refreshBounds();
-
- int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
- // restore to default size
- if (width == -1) {
- width = getFigure().getPreferredSize().width;
- }
- if (height == -1) {
- height = getFigure().getPreferredSize().height;
- }
-
- if (width != -1 && height != -1) {
- Dimension size = primaryShape.getBounds().getSize();
- // if(size.width != width || size.height != height) { // if resize bounds
- primaryShape.setBounds(new Rectangle(primaryShape.getBounds().getLocation(), new Dimension(width, height)));
- // }
- }
-
- // fix combined fragment move
- this.getFigure().getParent().getLayoutManager().layout(this.getFigure().getParent());
- relocateLabelEditPart();
- }
-
- @Override
- protected IFigure createNodeShape() {
- return primaryShape = new CustomDurationConstraintFigure();
- }
-
- @Override
- protected IFigure setupContentPane(IFigure nodeShape) {
- nodeShape = super.setupContentPane(nodeShape);
- DefaultSizeNodeFigure parent = (DefaultSizeNodeFigure) nodeShape.getParent();
- nodeShape.setPreferredSize(parent.getDefaultSize());
- return nodeShape; // use nodeShape itself as contentPane
- }
-
- /**
- * This method creates a specific edit policy for time realted elements
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart#getPrimaryDragEditPolicy()
- *
- * @return <code>EditPolicy</code>
- * @Override
- */
- @Override
- public EditPolicy getPrimaryDragEditPolicy() {
- EditPolicy policy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- return policy != null ? policy : new ResizableShapeEditPolicy() {
-
- @Override
- protected Command getResizeCommand(ChangeBoundsRequest request) {
- ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_RESIZE_CHILDREN);
- req.setEditParts(getHost());
- req.setMoveDelta(request.getMoveDelta());
- req.setSizeDelta(request.getSizeDelta());
- req.setLocation(request.getLocation());
- req.setExtendedData(request.getExtendedData());
- req.setResizeDirection(request.getResizeDirection());
- return getHost().getParent().getCommand(req);
- }
-
- @Override
- protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
- IFigure feedback = getDragSourceFeedbackFigure();
-
- PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
- getHostFigure().translateToAbsolute(rect);
- rect.translate(request.getMoveDelta());
- rect.resize(request.getSizeDelta());
-
- IFigure f = getHostFigure();
- Dimension max = f.getMaximumSize().getCopy();
- IMapMode mmode = MapModeUtil.getMapMode(f);
- max.height = mmode.LPtoDP(max.height);
- max.width = mmode.LPtoDP(max.width);
-
- // no minimal size
- if (max.width < rect.width) {
- rect.width = max.width;
- }
-
- if (max.height < rect.height) {
- rect.height = max.height;
- }
-
- feedback.translateToRelative(rect);
- feedback.setBounds(rect);
- }
- };
- }
-
- /**
- * @Override use ExternalLabelPrimaryDragRoleEditPolicy
- */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case DurationConstraintLabelEditPart.VISUAL_ID:
- case DurationConstraintAppliedStereotypeEditPart.VISUAL_ID:
- // use ExternalLabelPrimaryDragRoleEditPolicy
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @Override use ExternalLabelPositionLocator
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof DurationConstraintLabelEditPart) {
- DurationConstraintLabelLocator locator = new DurationConstraintLabelLocator(getMainFigure());
- locator.setParentEditPart(this);
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else if (borderItemEditPart instanceof DurationConstraintAppliedStereotypeEditPart) {
- // use ExternalLabelPositionLocator
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- /**
- * @Override Override for redirecting creation request to the lifeline
- */
- @Override
- public Command getCommand(Request request) {
- if (request instanceof CreateUnspecifiedTypeRequest) {
- return getParent().getCommand(request);
- }
- return super.getCommand(request);
- }
-
- /**
- * @Override Override for redirecting creation request to the lifeline
- */
- @Override
- public void showSourceFeedback(Request request) {
- if (request instanceof CreateUnspecifiedTypeRequest) {
- getParent().showSourceFeedback(request);
- }
- super.showSourceFeedback(request);
- }
-
- /**
- * @Override Override for redirecting creation request to the lifeline
- */
- @Override
- public void eraseSourceFeedback(Request request) {
- if (request instanceof CreateUnspecifiedTypeRequest) {
- getParent().eraseSourceFeedback(request);
- }
- super.eraseSourceFeedback(request);
- }
-
- @Override
- protected void handleNotificationEvent(Notification notification) {
- super.handleNotificationEvent(notification);
- Object feature = notification.getFeature();
- if ((getModel() != null) && (getModel() == notification.getNotifier())) {
- if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
- refreshLineWidth();
- }
- }
-
- if (notification.getNewValue() instanceof EAnnotation && ARROW.equals(((EAnnotation) notification.getNewValue()).getSource())) {
- refreshArrowDirection((EAnnotation) notification.getNewValue());
- } else if (notification.getNotifier() instanceof EAnnotation && ARROW.equals(((EAnnotation) notification.getNotifier()).getSource())) {
- refreshArrowDirection((EAnnotation) notification.getNotifier()); // notification.getEventType() ==
- }
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshArrowDirection(null);
- refreshLineWidth();
- }
-
- private void relocateLabelEditPart() {
- List list = this.getChildren();
- for (Object o : list) {
- if (o instanceof DurationConstraintLabelEditPart) {
- DurationConstraintLabelEditPart label = (DurationConstraintLabelEditPart) o;
- if (label.getBorderItemLocator() != null) {
- IBorderItemLocator loc = label.getBorderItemLocator();
- loc.relocate(label.getFigure());
- }
- }
- }
- }
-
- public Rectangle updateMoveBounds(Rectangle newBounds) {
- if (getCurrentSideOfParent() == PositionConstants.WEST) {
- Rectangle bounds = this.getFigure().getBounds();
- return newBounds.translate(-bounds.width, 0); // keep bounds in left side
- }
- return newBounds;
- }
-
- public int getCurrentSideOfParent() {
- IBorderItemLocator locator = this.getBorderItemLocator();
- if (locator != null) {
- return locator.getCurrentSideOfParent();
- }
- return PositionConstants.EAST;
- }
-
- public class CustomDurationConstraintFigure extends DurationConstraintFigure {
-
- /**
- * Height of the arrow end
- *
- */
- private static final int ARROW_HEIGHT = 8;
-
- /**
- * Width of the half of the arrow end
- *
- */
- private static final int ARROW_SEMI_WIDTH = 7;
-
- boolean vertical = true;
-
- public CustomDurationConstraintFigure() {
- setBorder(createBorder0());
- setDashBorder();
- }
-
- private Border createBorder0() {
- LinesBorder result = new LinesBorder() {
-
- @Override
- public void paint(IFigure figure, Graphics graphics, Insets insets) {
- tempRect.setBounds(getPaintRectangle(figure, insets));
-
- int one = MapModeUtil.getMapMode(figure).DPtoLP(1);
- int widthInDP = getWidth() / one;
-
- int halfWidthInLP = MapModeUtil.getMapMode(figure).DPtoLP(widthInDP / 2);
-
- graphics.setLineWidth(getWidth());
- graphics.setLineStyle(getStyle());
- // adapt tempRect so that borders do not overflow the initial bounds
- tempRect.x += halfWidthInLP;
- tempRect.width -= getWidth();
- tempRect.y += halfWidthInLP;
- tempRect.height -= getWidth();
-
- if ((getPositions() & PositionConstants.TOP) > 0) {
- // graphics.drawLine(tempRect.getTopLeft(), tempRect.getTopRight());
- graphics.drawLine(new Point(tempRect.getTopLeft().x(), tempRect.getTopLeft().y() + 1), new Point(tempRect.getTopRight().x(), tempRect.getTopRight().y() + 1));
- }
- if ((getPositions() & PositionConstants.LEFT) > 0) {
- // graphics.drawLine(tempRect.getTopLeft(), tempRect.getBottomLeft());
- graphics.drawLine(new Point(tempRect.getTopLeft().x() + 1, tempRect.getTopLeft().y()), new Point(tempRect.getBottomLeft().x() + 1, tempRect.getBottomLeft().y()));
- }
- if ((getPositions() & PositionConstants.BOTTOM) > 0) {
- graphics.drawLine(tempRect.getBottomLeft(), tempRect.getBottomRight());
- }
- if ((getPositions() & PositionConstants.RIGHT) > 0) {
- graphics.drawLine(tempRect.getTopRight(), tempRect.getBottomRight());
- }
- }
- };
- result.setSides(PositionConstants.TOP | PositionConstants.BOTTOM);
- return result;
- }
-
- protected void setDashBorder() {
- if (this.getBorder() instanceof LinesBorder) {
- LinesBorder lb = (LinesBorder) this.getBorder();
- lb.setStyle(Graphics.LINE_DASH);
- if (vertical) {
- lb.setSides(PositionConstants.TOP | PositionConstants.BOTTOM);
- } else {
- lb.setSides(PositionConstants.LEFT | PositionConstants.RIGHT);
- }
- }
- }
-
- @Override
- public Insets getInsets() {
- if (getBorder() != null) {
- return getBorder().getInsets(this);
- }
- return NO_INSETS;
- }
-
- public void setVertical(boolean val) {
- if (val != vertical) {
- vertical = val;
- setDashBorder();
- revalidate();
- }
- }
-
- // public void setBorderVisible(boolean top, boolean bottom){
- // if(this.getBorder() instanceof LinesBorder){
- // LinesBorder lb = (LinesBorder) this.getBorder();
- // if(top){
- // int value = bottom ? PositionConstants.TOP | PositionConstants.BOTTOM : PositionConstants.TOP;
- // lb.setSides(value);
- // }else{
- // int value = bottom ? PositionConstants.BOTTOM : PositionConstants.NONE;
- // lb.setSides(value);
- // }
- // this.repaint();
- // }
- // }
-
- /**
- * Sets the bounds of this Figure to the Rectangle <i>rect</i>.
- * This also updates sub-figures.
- *
- * @see Figure#setBounds(Rectangle)
- * @param rect
- * The new bounds
- */
- @Override
- public void setBounds(Rectangle rect) {
- updateArrow(rect.width, rect.height);
-
- Rectangle c = rect.getCopy();
- this.getParent().translateToAbsolute(c);
-
- super.setBounds(rect);
- }
-
- /**
- * Update the arrow polyline taking in account new figure's size
- *
- * @param figureWidth
- * the new figure width
- * @param figureHeight
- * the new figure height
- */
- public void updateArrow(int figureWidth, int figureHeight) {
- // handle insets to avoid figure growing indefinitely
- figureWidth -= getInsets().left + getInsets().right;
- figureHeight -= getInsets().top + getInsets().bottom;
- if (getDurationArrow() != null) {
- int halfLineWidth = getLineWidth() / 2;
- if (vertical) {
- PointList points = new PointList(8);
- int centerX = figureWidth / 2;
- points.addPoint(centerX - ARROW_SEMI_WIDTH, halfLineWidth + ARROW_HEIGHT);
- points.addPoint(centerX, halfLineWidth);
- points.addPoint(centerX + ARROW_SEMI_WIDTH, halfLineWidth + ARROW_HEIGHT);
- points.addPoint(centerX, halfLineWidth);
- points.addPoint(centerX, figureHeight - halfLineWidth);
- points.addPoint(centerX - ARROW_SEMI_WIDTH, figureHeight - halfLineWidth - ARROW_HEIGHT);
- points.addPoint(centerX, figureHeight - halfLineWidth);
- points.addPoint(centerX + ARROW_SEMI_WIDTH, figureHeight - halfLineWidth - ARROW_HEIGHT);
- getDurationArrow().setPoints(points);
- Point topLeft = getLocation().getTranslated(getInsets().left, getInsets().top);
- getDurationArrow().setBounds(new Rectangle(topLeft, new Dimension(figureWidth, figureHeight)));
- } else {
- PointList points = new PointList(8);
- int centerY = figureHeight / 2;
- points.addPoint(halfLineWidth + ARROW_HEIGHT, centerY - ARROW_SEMI_WIDTH);
- points.addPoint(halfLineWidth, centerY);
- points.addPoint(halfLineWidth + ARROW_HEIGHT, centerY + ARROW_SEMI_WIDTH);
- points.addPoint(halfLineWidth, centerY);
- points.addPoint(figureWidth - halfLineWidth, centerY);
-
- points.addPoint(figureWidth - halfLineWidth - ARROW_HEIGHT, centerY - ARROW_SEMI_WIDTH);
- points.addPoint(figureWidth - halfLineWidth, centerY);
- points.addPoint(figureWidth - halfLineWidth - ARROW_HEIGHT, centerY + ARROW_SEMI_WIDTH);
-
- getDurationArrow().setPoints(points);
- Point topLeft = getLocation().getTranslated(getInsets().left, getInsets().top);
- getDurationArrow().setBounds(new Rectangle(topLeft, new Dimension(figureWidth, figureHeight)));
- }
- }
- }
-
- @Override
- public boolean containsPoint(int x, int y) {
- boolean containsPoint = super.containsPoint(x, y);
- if (!containsPoint) {
- return false;
- }
- PolylineShape durationArrow = getDurationArrow();
- if (durationArrow != null) {
- return PointListUtilities.containsPoint(durationArrow.getPoints(), new Point(x, y));
- // return fDurationArrow.containsPoint(x, y);
- }
- return containsPoint;
- }
-
- @Override
- public void paintFigure(Graphics graphics) {
- graphics.setLineWidth(lineWidth);
- super.paintFigure(graphics);
- }
-
- @Override
- public void setLineWidth(int w) {
- LinesBorder lb = (LinesBorder) getBorder();
- lb.setWidth(w);
- getDurationArrow().setLineWidth(w);
- super.setLineWidth(w);
- }
- }
-
- public static Rectangle fixMessageBounds(Rectangle newBounds, Request cvr, LifelineEditPart host) {
- Object oc1 = getFirstElement(cvr.getExtendedData().get(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION));
- Object oc2 = getFirstElement(cvr.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2));
- if (oc1 != null && oc2 != null && (oc1 instanceof MessageOccurrenceSpecification || oc2 instanceof MessageOccurrenceSpecification)) {
- Point start = null, end = null;
- Rectangle bounds = null;
- if (oc1 instanceof InteractionFragment) {
- start = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc1, true);
- }
- if (oc2 instanceof InteractionFragment) {
- end = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc2, true);
- }
- if (start != null && end != null) {
- bounds = (start.y < end.y) ? new Rectangle(start, end) : new Rectangle(end, start);
- }
- if (bounds != null) {
- IFigure parentFigure = host.getFigure();
- Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate();
- parentFigure.translateToRelative(bounds);
- bounds.translate(parentFigDelta);
- if (bounds.y != newBounds.y || newBounds.height != bounds.height) {
- newBounds.y = bounds.y;
- newBounds.height = bounds.height;
- }
- }
- }
- return newBounds;
- }
-
- static class DurationConstraintLabelLocator extends ExternalLabelPositionLocator {
-
- private CustomDurationConstraintEditPart durationConstraintEditPart;
-
- public DurationConstraintLabelLocator(IFigure mainFigure) {
- super(mainFigure);
- }
-
- public void setParentEditPart(CustomDurationConstraintEditPart durationConstraintEditPart) {
- this.durationConstraintEditPart = durationConstraintEditPart;
- }
-
- @Override
- public void relocate(IFigure target) {
- if (constraint.y == 0) {
- if (durationConstraintEditPart.getCurrentSideOfParent() == PositionConstants.WEST) {
- Point r = parentFigure.getBounds().getLeft().translate(-20, -5);
- target.setBounds(new Rectangle(r, target.getPreferredSize()));
- } else {
- Point r = parentFigure.getBounds().getRight().translate(5, -5);
- target.setBounds(new Rectangle(r, target.getPreferredSize()));
- }
- } else {
- super.relocate(target);
- }
- }
- }
-
- static Object getFirstElement(Object obj) {
- if (obj != null && obj instanceof List) {
- List list = (List) obj;
- if (list.size() > 0) {
- return list.get(0);
- }
- }
- return null;
- }
-
-
- protected void refreshArrowDirection(EAnnotation newValue) {
- CustomDurationConstraintFigure dc = (CustomDurationConstraintFigure) getPrimaryShape();
- dc.setVertical(isArrowVertical());
- refreshBounds();
- }
-
- public void setArrowDirection(String dir) {
- View view = this.getNotationView();
- if (view == null) {
- return;
- }
-
- EAnnotation ea = view.getEAnnotation(ARROW);
- if (ea == null) {
- ea = EcoreFactory.eINSTANCE.createEAnnotation();
- ea.setSource(ARROW);
- ea.getDetails().put(DIRECTION, dir);
- view.getEAnnotations().add(ea);
- } else {
- ea.getDetails().clear();
- ea.getDetails().put(DIRECTION, dir);
- }
- }
-
- public String getArrowDirection() {
- View view = this.getNotationView();
- if (view == null) {
- return "";
- }
- EAnnotation ea = view.getEAnnotation(ARROW);
- if (ea != null) {
- String pos = ea.getDetails().get(DIRECTION);
- if (pos != null) {
- return pos;
- }
- }
- return VERTICAL;
- }
-
- public boolean isArrowVertical() {
- return VERTICAL.equals(getArrowDirection());
- }
-
- public void rotateArrow() {
- if (isArrowVertical()) {
- setArrowDirection(HORIZONTAL);
- } else {
- setArrowDirection(VERTICAL);
- }
- }
-
- private Object getStructuralFeatureValue(View view, EStructuralFeature feature) {
- return ViewUtil.getPropertyValue(view, feature, feature.getEContainingClass());
- }
-
- public Rectangle getBounds() {
- View view = this.getNotationView();
- int width = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width())).intValue();
- int height = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height())).intValue();
- int x = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- String prefElementId = ViewUtil.resolveSemanticElement(view).eClass().getName();
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(view, prefElementId, PreferencesConstantsHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(view, prefElementId, PreferencesConstantsHelper.HEIGHT);
- if (width <= 0) {
- width = store.getInt(preferenceConstantWitdh);
- }
- if (height <= 0) {
- height = store.getInt(preferenceConstantHeight);
- }
- return new Rectangle(x, y, width, height);
- }
-
- public static class RotateArrowCommand extends org.eclipse.emf.transaction.RecordingCommand {
-
- private CustomDurationConstraintEditPart part;
-
- public RotateArrowCommand(TransactionalEditingDomain domain, CustomDurationConstraintEditPart part) {
- super(domain);
- this.part = part;
- }
-
- @Override
- protected void doExecute() {
- List list = part.getSourceConnections();
- if (part.isArrowVertical()) {
- part.setArrowDirection(HORIZONTAL);
- } else {
- part.setArrowDirection(VERTICAL);
- }
- }
- }
-
- class RotateAnchor extends FixedAnchorEx {
-
- public RotateAnchor(IFigure f, int location) {
- super(f, location);
- }
-
- @Override
- public Point getLocation(Point reference) {
- double zoom = 0;
- if (CustomDurationConstraintEditPart.this.getRoot() instanceof RenderedDiagramRootEditPart) {
- RenderedDiagramRootEditPart render = (RenderedDiagramRootEditPart) CustomDurationConstraintEditPart.this.getRoot();
- zoom = render.getZoomManager().getZoom();
- }
- if (position == PositionConstants.TOP) {
- return new PrecisionPoint(getBox().getTop().preciseX(), getBox().getTop().preciseY() + 1 * zoom);
- } else if (position == PositionConstants.BOTTOM) {
- if (zoom > 1) {
- zoom = zoom - 1;
- }
- return new PrecisionPoint(getBox().getBottom().preciseX(), getBox().getBottom().preciseY() - 1 * zoom);
- } else if (position == PositionConstants.LEFT) {
- if (zoom > 1) {
- zoom = zoom - 1;
- }
- return new PrecisionPoint(getBox().getLeft().preciseX(), getBox().getLeft().preciseY() + 1 * zoom);
- } else if (position == PositionConstants.RIGHT) {
- if (zoom > 1) {
- zoom = zoom - 1;
- }
- return new PrecisionPoint(getBox().getRight().preciseX(), getBox().getRight().preciseY() + 1 * zoom);
- }
- return super.getLocation(reference);
- }
-
- @Override
- public String getTerminal() {
- if (isDefaultAnchor()) {
- return StringStatics.BLANK;
- }
- if (position == PositionConstants.TOP) {
- return "(0.5,0){T}";
- } else if (position == PositionConstants.BOTTOM) {
- return "(0.5,1){D}";
- } else if (position == PositionConstants.LEFT) {
- return "(0,0.5){L}";
- } else if (position == PositionConstants.RIGHT) {
- return "(1,0.5){R}";
- }
- return "(0.5,0){T}";
- }
-
- }
-
- private int parseLocation(String terminal) {
- if (terminal.length() > 0) {
- int start = terminal.indexOf("{") + 1;
- if (start > 0) {
- char ch = Character.toUpperCase(terminal.charAt(start));
- switch (ch) {
- case 'L':
- return PositionConstants.LEFT;
- case 'R':
- return PositionConstants.RIGHT;
- case 'D':
- return PositionConstants.BOTTOM;
- default:
- return PositionConstants.TOP;
- }
- }
- }
- return PositionConstants.TOP;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageAppliedStereotypeEditPart.java
deleted file mode 100644
index 3f5391b6cbb..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageAppliedStereotypeEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationConstraintInMessageAppliedStereotypeEditPart extends DurationConstraintInMessageAppliedStereotypeEditPart implements IPapyrusEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationConstraintInMessageAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- public IFigure getPrimaryShape() {
- return getFigure();
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageEditPart.java
deleted file mode 100644
index df29a5de062..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationConstraintInMessageEditPart.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.ConnectionLocator;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editparts.AbstractConnectionEditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationConstraintInMessageEditPart extends DurationConstraintInMessageEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationConstraintInMessageEditPart(View view) {
- super(view);
- }
-
- /**
- * Make sure bounds are also refreshed.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#refresh()
- * @Override
- */
- @Override
- public void refresh() {
- super.refresh();
- refreshBounds();
- }
-
- /**
- * Handles refresh bounds the same way as for a non resizable label
- *
- * @Override
- */
- @Override
- protected void refreshBounds() {
- int dx = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int dy = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point offset = new Point(dx, dy);
- if (getParent() instanceof AbstractConnectionEditPart) {
- ((AbstractGraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new LabelLocator(((AbstractConnectionEditPart) getParent()).getConnectionFigure(), offset, ConnectionLocator.MIDDLE));
- } else {
- getFigure().getParent().setConstraint(getFigure(), new LabelLocator(getFigure().getParent(), offset, ConnectionLocator.MIDDLE));
- }
- }
-
- /**
- * @Override use ExternalLabelPrimaryDragRoleEditPolicy
- */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- @Override
- protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID:
- // use ExternalLabelPrimaryDragRoleEditPolicy
- return new ExternalLabelPrimaryDragRoleEditPolicy();
- }
- EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @Override use ExternalLabelPositionLocator
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof DurationConstraintInMessageAppliedStereotypeEditPart) {
- // use ExternalLabelPositionLocator
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationAppliedStereotypeEditPart.java
deleted file mode 100644
index e8a5ce3fa9f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationAppliedStereotypeEditPart.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeExternalNodeLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.AppliedStereotypeLabelFigure;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationObservationAppliedStereotypeEditPart extends DurationObservationAppliedStereotypeEditPart implements IPapyrusEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationObservationAppliedStereotypeEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- public IFigure getPrimaryShape() {
- return getFigure();
- }
-
- @Override
- protected void refreshLabel() {
- // We do NOT want to update label with the Parser.
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- removeEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY);
- View view = getPrimaryView();
- View stereotypeChangedView = view;
- if (view != null) {
- // stereotypeChangedView = ViewUtil.getChildBySemanticHint(view, UMLVisualIDRegistry.getType(DurationObservationLabelEditPart.VISUAL_ID));
- }
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeLabelEditPolicy(stereotypeChangedView));
- }
-
- @Override
- protected IFigure createFigurePrim() {
- return new AppliedStereotypeLabelFigure();
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationEditPart.java
deleted file mode 100644
index 99ac21598fa..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomDurationObservationEditPart.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.LayoutEditPolicy;
-import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
-import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomConnectionHandleEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomDurationObservationEditPart extends DurationObservationEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomDurationObservationEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE, new CustomConnectionHandleEditPolicy());
- removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- removeEditPolicy(DeleteTimeElementWithoutEventPolicy.KEY);
- }
-
- /**
- * Make sure bounds are also refreshed.
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#refresh()
- * @Override
- */
- @Override
- public void refresh() {
- super.refresh();
- refreshBounds();
- }
-
- /**
- * @Override use ExternalLabelPrimaryDragRoleEditPolicy
- */
- @Override
- protected LayoutEditPolicy createLayoutEditPolicy() {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
-
- @Override
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
- case DurationObservationAppliedStereotypeEditPart.VISUAL_ID:
- // use ExternalLabelPrimaryDragRoleEditPolicy
- return new CustomExternalLabelPrimaryDragRoleEditPolicy();
- }
- org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new NonResizableEditPolicy();
- }
- return result;
- }
-
- @Override
- protected Command getMoveChildrenCommand(Request request) {
- return null;
- }
-
- @Override
- protected Command getCreateCommand(CreateRequest request) {
- return null;
- }
- };
- return lep;
- }
-
- /**
- * @Override use ExternalLabelPositionLocator
- */
- @Override
- protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof DurationObservationAppliedStereotypeEditPart) {
- // use ExternalLabelPositionLocator
- IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
-
- @Override
- protected NodeFigure createNodePlate() {
- return new RoundedRectangleNodePlateFigure(20, 20);
- }
-
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new RoundedCompartmentFigure() {
-
- @Override
- public Border getBorder() {
- return null;
- }
-
- @Override
- public boolean isUsingGradient() {
- return false;
- }
- };
- return primaryShape;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java
index 90d5ee3692c..c64f0ad68b3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ObservationLinkEditPart.java
@@ -13,7 +13,6 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.TimeObservation;
/**
@@ -55,9 +54,6 @@ public class ObservationLinkEditPart extends AnnotatedLinkEditPart {
if (source instanceof TimeObservationLabelEditPart) {
TimeObservation timeObservation = (TimeObservation) ((TimeObservationLabelEditPart) source).resolveSemanticElement();
timeObservation.setEvent(null);
- } else if (source instanceof DurationObservationEditPart) {
- DurationObservation durationObservation = (DurationObservation) ((DurationObservationEditPart) source).resolveSemanticElement();
- durationObservation.getEvents().clear();
}
return CommandResult.newOKCommandResult();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkEndEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkEndEditPolicy.java
index a61068dd600..469bd2a079b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkEndEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkEndEditPolicy.java
@@ -141,63 +141,9 @@ public class AnnotatedLinkEndEditPolicy extends GraphicalNodeEditPolicy {
return UnexecutableCommand.INSTANCE;
}
command.setTarget(getHost());
- // update bendpoints
- // if((request.getSourceEditPart() instanceof CustomDurationConstraintEditPart) && !(request.getTargetEditPart() instanceof CustomDurationConstraintEditPart)) {
- // updateConnectionBendpoints(request, proxy);
- // }
return proxy;
}
- // private void updateConnectionBendpoints(CreateConnectionRequest request, ICommandProxy proxy) {
- // ICommand iCommand = proxy.getICommand();
- // if(!(iCommand instanceof CompositeCommand)) {
- // return;
- // }
- // INodeEditPart targetEP = getConnectionCompleteEditPart(request);
- // if(targetEP == null) {
- // return;
- // }
- // CompositeCommand cc = (CompositeCommand)iCommand;
- // SetConnectionAnchorsCommand scaCommand = null;
- // SetConnectionBendpointsCommand sbbCommand = null;
- // Iterator it = cc.iterator();
- // while(it.hasNext()) {
- // Object next = it.next();
- // if(next instanceof SetConnectionBendpointsCommand) {
- // sbbCommand = (SetConnectionBendpointsCommand)next;
- // } else if(next instanceof SetConnectionAnchorsCommand) {
- // scaCommand = (SetConnectionAnchorsCommand)next;
- // }
- // if(sbbCommand != null && scaCommand != null) {
- // break;
- // }
- // }
- // if(sbbCommand == null || scaCommand == null) {
- // return;
- // }
- // ConnectionAnchor targetAnchor = targetEP.getTargetConnectionAnchor(request);
- // INodeEditPart sourceEditPart = (INodeEditPart)request.getSourceEditPart();
- // ConnectionAnchor sourceAnchor = sourceEditPart.getSourceConnectionAnchor(request);// sourceEditPart.mapTerminalToConnectionAnchor(scaCommand.getNewSourceTerminal());
- // Point sourcePoint = sourceAnchor.getLocation(sourceAnchor.getReferencePoint());
- // Point targetPoint = targetAnchor.getLocation(targetAnchor.getReferencePoint());
- //
- // if(sourcePoint.y != targetPoint.y) {
- // PointList newList = new PointList(3);
- // newList.addPoint(sourcePoint);
- // Point p = new Point(DurationConstraintAutomaticRouter.BENDPOINT_GATE,0);//addBendpoint(sourcePoint.x, targetPoint.x, sourcePoint.y);
- // newList.addPoint(p);
- // newList.addPoint(targetPoint);
- // sbbCommand.setNewPointList(newList, sourceAnchor.getReferencePoint(), targetAnchor.getReferencePoint());
- // }
- // }
- //
- // private Point addBendpoint(int x, int x2, int y) {
- // if(Math.abs(x - x2) > 20) {
- // return new PrecisionPoint(x2 + 20 * Math.signum(x - x2), y);
- // } else {
- // return new PrecisionPoint(x2 + (x - x2) * 0.5, y);
- // }
- // }
@Override
public void eraseTargetFeedback(Request request) {
if (REQ_ANNOTATED_LINK_END.equals(request.getType())) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkStartEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkStartEditPolicy.java
index e4eefd867e9..4e16d9f178c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkStartEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AnnotatedLinkStartEditPolicy.java
@@ -35,7 +35,6 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.sequence.command.AnnotatedLinkEditCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AnnotatedLinkEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
import org.eclipse.uml2.uml.TimeObservation;
/**
@@ -137,10 +136,6 @@ public class AnnotatedLinkStartEditPolicy extends GraphicalNodeEditPolicy {
return null;
}
if (request.getConnectionEditPart() instanceof AnnotatedLinkEditPart) {
- if (getHost() instanceof CustomDurationConstraintEditPart && !((CustomDurationConstraintEditPart) getHost()).canCreateLink(request.getLocation())) {
- return UnexecutableCommand.INSTANCE; // only 2 links are allowed, one for each side
- }
-
CompositeCommand cc = (CompositeCommand) c.getICommand();
AnnotatedLinkEditCommand ac = new AnnotatedLinkEditCommand(getEditingDomain());
ac.setAnnotatedLink((AnnotatedLinkEditPart) request.getConnectionEditPart());
@@ -161,12 +156,6 @@ public class AnnotatedLinkStartEditPolicy extends GraphicalNodeEditPolicy {
if (element instanceof TimeObservation && ((TimeObservation) element).getEvent() != null) {
return UnexecutableCommand.INSTANCE;
}
- if (host instanceof CustomDurationConstraintEditPart) {
- boolean can = ((CustomDurationConstraintEditPart) host).canCreateLink(request.getLocation());
- if (!can) {
- return UnexecutableCommand.INSTANCE;
- }
- }
}
Command command = super.getConnectionCreateCommand(request);
if (command instanceof ICommandProxy) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
index d75ac51a896..09bc6634efc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/AppliedStereotypeCommentCreationEditPolicyEx.java
@@ -27,7 +27,6 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.sequence.command.CreateAppliedStereotypeCommentViewCommandEx;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
import org.eclipse.swt.widgets.Display;
@@ -70,10 +69,8 @@ public class AppliedStereotypeCommentCreationEditPolicyEx extends AppliedStereot
}
boolean isBorderElement = false;
- if (!(hostEditPart instanceof CustomDurationConstraintEditPart)) {
- if (hostEditPart instanceof BorderedBorderItemEditPart) {
- isBorderElement = true;
- }
+ if (hostEditPart instanceof BorderedBorderItemEditPart) {
+ isBorderElement = true;
}
if (helper.getStereotypeComment((View) getHost().getModel()) == null) {
CreateAppliedStereotypeCommentViewCommandEx command = new CreateAppliedStereotypeCommentViewCommandEx(domain, (View) hostEditPart.getModel(), x, y, semanticElement, isBorderElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java
index 73527941042..3099c9ced89 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CreationOnMessageEditPolicy.java
@@ -118,21 +118,7 @@ public class CreationOnMessageEditPolicy extends CreationEditPolicy {
* @return true if creation on an occurrence specification
*/
private boolean isCreatedOnOccurrenceSpecification(String requestHint) {
- return isTimeHint(requestHint) || isDurationHint(requestHint);
- }
-
- /**
- * Return true if hint is for creating a duration observation/constraint
- *
- * @param requestHint
- * the hint of object to create
- * @return true if correct hint
- */
- private boolean isDurationHint(String requestHint) {
- String durCstOnLifelineHint = ((IHintedType) UMLElementTypes.DurationConstraint_Shape).getSemanticHint();
- String durCstOnMessage = ((IHintedType) UMLElementTypes.DurationConstraint_Shape_CN).getSemanticHint();
- String durObsOnMessage = ((IHintedType) UMLElementTypes.DurationObservation_Shape).getSemanticHint();
- return durCstOnLifelineHint.equals(requestHint) /* || durCstOnMessage.equals(requestHint) */ || durObsOnMessage.equals(requestHint);
+ return isTimeHint(requestHint);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java
index e41297e55b8..e63ff79ba87 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java
@@ -24,7 +24,6 @@ import java.util.Set;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -34,18 +33,14 @@ import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
@@ -65,11 +60,8 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DeferredCreateCommand;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper;
import org.eclipse.papyrus.uml.diagram.sequence.command.CreateLocatedConnectionViewCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.OLDCreateGateViewCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.command.RestoreDurationConstraintLinkCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart;
@@ -85,9 +77,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintConstrained
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
@@ -118,22 +107,17 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.ConnectableElement;
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
import org.eclipse.uml2.uml.ExecutionSpecification;
import org.eclipse.uml2.uml.Gate;
import org.eclipse.uml2.uml.GeneralOrdering;
import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.Message;
import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.PackageableElement;
import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.TimeObservation;
@@ -176,7 +160,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
elementsVisualId.add(ConstraintConstrainedElementEditPart.VISUAL_ID);
elementsVisualId.add(TimeConstraintEditPart.VISUAL_ID);
elementsVisualId.add(TimeObservationEditPart.VISUAL_ID);
- elementsVisualId.add(DurationConstraintEditPart.VISUAL_ID);
elementsVisualId.add(SequenceDiagramEditPart.VISUAL_ID);
elementsVisualId.add(MessageSyncEditPart.VISUAL_ID);
elementsVisualId.add(MessageAsyncEditPart.VISUAL_ID);
@@ -191,10 +174,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
elementsVisualId.add(DestructionOccurrenceSpecificationEditPart.VISUAL_ID);
elementsVisualId.add(StateInvariantEditPart.VISUAL_ID);
elementsVisualId.add(TimeConstraintEditPart.VISUAL_ID);
- elementsVisualId.add(DurationConstraintEditPart.VISUAL_ID);
- elementsVisualId.add(DurationConstraintInMessageEditPart.VISUAL_ID);
elementsVisualId.add(TimeObservationEditPart.VISUAL_ID);
- elementsVisualId.add(DurationObservationEditPart.VISUAL_ID);
elementsVisualId.add(LifelineEditPart.VISUAL_ID);
// elementsVisualId.add(GateEditPart.VISUAL_ID);
// handle nodes on messages (no visual ID detected for them)
@@ -266,11 +246,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
if (semanticElement instanceof DurationObservation) {
return new ICommandProxy(getDefaultDropNodeCommand(nodeVISUALID, location, semanticElement, dropRequest));
}
- // handle specifically the case when node is on a message
- Command cmd = handleNodeOnMessage(semanticElement, nodeVISUALID, linkVISUALID, location);
- if (cmd != null) {
- return cmd;
- }
if (nodeVISUALID != null) {
switch (nodeVISUALID) {
case ActionExecutionSpecificationEditPart.VISUAL_ID:
@@ -282,15 +257,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
case StateInvariantEditPart.VISUAL_ID:
return dropStateInvariant((StateInvariant) semanticElement, nodeVISUALID, location);
case TimeConstraintEditPart.VISUAL_ID:
- case DurationConstraintEditPart.VISUAL_ID:
- return dropIntervalConstraintInLifeline((IntervalConstraint) semanticElement, nodeVISUALID);
case TimeObservationEditPart.VISUAL_ID:
return dropTimeObservationInLifeline((TimeObservation) semanticElement, nodeVISUALID, location);
case CommentEditPart.VISUAL_ID:
case ConstraintEditPart.VISUAL_ID:
- if (semanticElement instanceof DurationConstraint) {
- return dropDurationConstraint((DurationConstraint) semanticElement, location);
- }
+ return UnexecutableCommand.INSTANCE;
case Constraint2EditPart.VISUAL_ID:
case InteractionUseEditPart.VISUAL_ID:
case LifelineEditPart.VISUAL_ID:
@@ -503,317 +474,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
/**
- * Get the drop command in case the element can be handled as a node on a message
- *
- * @param semanticElement
- * the element being dropped from the model
- * @param nodeVISUALID
- * node visual id or -1
- * @param linkVISUALID
- * link visual id or -1
- * @param location
- * @return the drop command if the element can be dropped as a message label node, or null otherwise
- */
- private Command handleNodeOnMessage(Element semanticElement, String nodeVISUALID, String linkVISUALID, Point location) {
- if (nodeVISUALID == null && linkVISUALID == null) {
- // detect duration observation on a message
- if (semanticElement instanceof DurationObservation) {
- List<NamedElement> events = ((DurationObservation) semanticElement).getEvents();
- if (events.size() >= 2) {
- return dropMessageNodeBetweenEvents(semanticElement, events.get(0), events.get(1));
- }
- }
- }
- if (isDurationConstraintHint(nodeVISUALID, linkVISUALID)) {
- // detect duration constraint on a message
- if (semanticElement instanceof DurationConstraint) {
- return dropDurationConstraint((DurationConstraint) semanticElement, location);
- }
- }
- return null;
- }
-
- /**
- * Drop DurationConstraint at given location. The constrained elements would also be restored if existed.
- *
- * @see dropDurationConstraint(Element durationConstraint, Element event1, Element event2, Point location)
- * @param durationConstraint
- * @param location
- */
- protected Command dropDurationConstraint(DurationConstraint durationConstraint, Point location) {
- List<Element> events = durationConstraint.getConstrainedElements();
- Element event1 = null, event2 = null;
- if (events.size() >= 2) {
- event1 = events.get(0);
- event2 = events.get(1);
- } else if (events.size() == 1) {
- event1 = event2 = events.get(0);
- }
- return dropDurationConstraint(durationConstraint, event1, event2, location);
- }
-
- /**
- * Drop DurationConstraint at given location. The constrained elements would also be restored if existed.
- *
- * @param durationConstraint
- * @param event1
- * @param event2
- * @param location
- * @return
- */
- private Command dropDurationConstraint(Element durationConstraint, Element event1, Element event2, Point location) {
- List<View> existingViews = DiagramEditPartsUtil.findViews(durationConstraint, getViewer());
- // only allow one view instance of a single element by diagram
- if (!existingViews.isEmpty()) {
- return UnexecutableCommand.INSTANCE;
- }
- IAdaptable elementAdapter = new EObjectAdapter(durationConstraint);
- IHintedType elementType = (IHintedType) UMLElementTypes.getElementType(DurationConstraintEditPart.VISUAL_ID);
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, elementType.getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
- CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
- createViewRequest.setLocation(location);
- // "ask" the host for a command associated with the
- // CreateViewRequest
- Command command = getHost().getCommand(createViewRequest);
- if (command == null || !command.canExecute()) {
- return UnexecutableCommand.INSTANCE;
- }
- // restore links.
- CompositeCommand result = new CompositeCommand(command.getLabel());
- result.add(new CommandProxyWithResult(command, descriptor));
- Point[] constraintLocations = getLocationForDurationConstraint((DurationConstraint) durationConstraint, event1, event2, location);
- if (constraintLocations[0] != null && constraintLocations[1] != null) {
- if (constraintLocations[0].y <= constraintLocations[1].y) {
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), true, constraintLocations[0], getDiagramPreferencesHint()));
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), false, constraintLocations[1], getDiagramPreferencesHint()));
- } else if (constraintLocations[0].y > constraintLocations[1].y) {
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), false, constraintLocations[0], getDiagramPreferencesHint()));
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), true, constraintLocations[1], getDiagramPreferencesHint()));
- }
- } else if (constraintLocations[0] != null) {
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), null, constraintLocations[0], getDiagramPreferencesHint()));
- } else if (constraintLocations[1] != null) {
- result.add(new RestoreDurationConstraintLinkCommand(getEditingDomain(), descriptor, getViewer(), null, constraintLocations[1], getDiagramPreferencesHint()));
- }
- // it then can be used as an adaptable to retrieve the View
- return new ICommandProxy(result);
- }
-
- /**
- * Collect the locations of constrained elements.
- *
- * @param durationConstraint
- * @param event1
- * @param event2
- * @param location
- * @return
- */
- private Point[] getLocationForDurationConstraint(DurationConstraint durationConstraint, Element event1, Element event2, Point location) {
- Point[] constraintLocations = new Point[2];
- if (event1 instanceof OccurrenceSpecification) {
- constraintLocations[0] = getLocationForDurationConstraintOnEvent((OccurrenceSpecification) event1);
- }
- if (event2 instanceof OccurrenceSpecification) {
- constraintLocations[1] = getLocationForDurationConstraintOnEvent((OccurrenceSpecification) event2);
- }
- if (constraintLocations[0] == null && event1 != null) {
- EditPart editPart = lookForEditPart(event1);
- if (editPart instanceof INodeEditPart) {
- constraintLocations[0] = getLocationForDurationConstraintOnEditPart((INodeEditPart) editPart, location);
- }
- }
- if (constraintLocations[1] == null && event2 != null) {
- EditPart editPart = lookForEditPart(event2);
- if (editPart instanceof INodeEditPart) {
- constraintLocations[1] = getLocationForDurationConstraintOnEditPart((INodeEditPart) editPart, location.getTranslated(0, 40));
- }
- }
- if (event1 != null && event1 == event2 && constraintLocations[0] != null && constraintLocations[0].equals(constraintLocations[1])) {
- EditPart editPart = lookForEditPart(event1);
- if (editPart instanceof IGraphicalEditPart) {
- Rectangle rect = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) editPart);
- if (rect.contains(constraintLocations[0].getTranslated(0, 40))) {
- constraintLocations[1] = constraintLocations[0].getTranslated(0, 40);
- } else if (rect.contains(constraintLocations[0].getTranslated(0, -40))) {
- constraintLocations[1] = constraintLocations[0].getTranslated(0, -40);
- }
- }
- }
- return constraintLocations;
- }
-
- /**
- * Get location from a INodeEditPart.
- *
- * @param nodeEditPart
- * @param reference
- * @return
- */
- private Point getLocationForDurationConstraintOnEditPart(INodeEditPart nodeEditPart, Point reference) {
- Rectangle rect = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) nodeEditPart);
- Point location = new Point();
- if (reference.y < rect.y) {
- location.y = rect.y + 1;
- } else if (reference.y > rect.bottom()) {
- location.y = rect.bottom() - 1;
- } else {
- location.y = reference.y;
- }
- for (int x = rect.x; x <= rect.right(); x++) {
- CreateConnectionRequest request = new CreateConnectionRequest();
- request.setType(REQ_CONNECTION_END);
- request.setTargetEditPart(nodeEditPart);
- location.x = x;
- request.setLocation(location);
- ConnectionAnchor targetAnchor = nodeEditPart.getTargetConnectionAnchor(request);
- if (targetAnchor != null) {
- location = targetAnchor.getLocation(reference);
- break;
- }
- }
- return location;
- }
-
- /**
- * Get location of OccurrenceSpecification.
- *
- * @param event
- * @return
- */
- private Point getLocationForDurationConstraintOnEvent(OccurrenceSpecification event) {
- Point targetLocation = null;
- if (event instanceof MessageOccurrenceSpecification) {
- Message message = ((MessageOccurrenceSpecification) event).getMessage();
- if (message == null) {
- return null;
- }
- ConnectionNodeEditPart MessageSyncEditPart = null;
- DiagramEditPart diag = DiagramEditPartsUtil.getDiagramEditPart(getHost());
- for (Object conn : diag.getConnections()) {
- if (conn instanceof ConnectionNodeEditPart) {
- EObject connElt = ((ConnectionNodeEditPart) conn).resolveSemanticElement();
- if (message.equals(connElt)) {
- MessageSyncEditPart = (ConnectionNodeEditPart) conn;
- break;
- }
- }
- }
- if (MessageSyncEditPart == null) {
- return null;
- }
- if (event == message.getSendEvent()) {
- targetLocation = SequenceUtil.getAbsoluteEdgeExtremity(MessageSyncEditPart, true);
- } else if (event == message.getReceiveEvent()) {
- targetLocation = SequenceUtil.getAbsoluteEdgeExtremity(MessageSyncEditPart, false);
- }
- } else if (event instanceof ExecutionOccurrenceSpecification) {
- ExecutionSpecification execution = ((ExecutionOccurrenceSpecification) event).getExecution();
- if (execution != null) {
- List<View> existingViews = DiagramEditPartsUtil.findViews(execution, getViewer());
- for (View view : existingViews) {
- if (CCombinedCompartmentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getVisualID(view)) || BehaviorExecutionSpecificationEditPart.VISUAL_ID.equals(UMLVisualIDRegistry.getVisualID(view))) {
- Object object = getViewer().getEditPartRegistry().get(view);
- if (object instanceof IGraphicalEditPart) {
- Rectangle bounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) object);
- if (event == execution.getStart()) {
- targetLocation = bounds.getTop();
- } else if (event == execution.getFinish()) {
- targetLocation = bounds.getBottom();
- }
- }
- }
- }
- }
- }
- return targetLocation;
- }
-
- /**
- * Get the command to drop an element between two events in order to create a message label
- *
- * @param droppedElement
- * the dropped element
- * @param event1
- * first event (of type MessageOccurrenceSpecification)
- * @param event2
- * second event (of type MessageOccurrenceSpecification)
- * @param element
- * @return the command or false if the elements can not be dropped as message label
- */
- private Command dropMessageNodeBetweenEvents(Element droppedElement, Element event1, Element event2) {
- if (event1 instanceof MessageOccurrenceSpecification && event2 instanceof MessageOccurrenceSpecification) {
- if (!event1.equals(event2)) {
- boolean endsOfSameMessage = false;
- String visualId = null;
- if (droppedElement instanceof DurationConstraint) {
- visualId = DurationConstraintInMessageEditPart.VISUAL_ID;
- endsOfSameMessage = DurationConstraintHelper.endsOfSameMessage((OccurrenceSpecification) event1, (OccurrenceSpecification) event2);
- } else if (droppedElement instanceof DurationObservation) {
- visualId = DurationObservationEditPart.VISUAL_ID;
- endsOfSameMessage = DurationObservationHelper.endsOfSameMessage((OccurrenceSpecification) event1, (OccurrenceSpecification) event2);
- }
- if (endsOfSameMessage) {
- Message message = ((MessageOccurrenceSpecification) event1).getMessage();
- // search a connection which matches the possessing message
- DiagramEditPart diag = DiagramEditPartsUtil.getDiagramEditPart(getHost());
- for (Object conn : diag.getConnections()) {
- if (conn instanceof ConnectionNodeEditPart) {
- EObject connElt = ((ConnectionNodeEditPart) conn).resolveSemanticElement();
- if (message.equals(connElt)) {
- // check that node isn't already represented, or dropping is impossible
- for (Object child : ((ConnectionNodeEditPart) conn).getChildren()) {
- if (child instanceof GraphicalEditPart) {
- EObject childElt = ((GraphicalEditPart) child).resolveSemanticElement();
- if (droppedElement.equals(childElt)) {
- return null;
- }
- }
- }
- return dropNodeOnMessage((PackageableElement) droppedElement, (ConnectionNodeEditPart) conn, visualId);
- }
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Test whether visual ids are compatible with a duration constraint element
- *
- * @param nodeVISUALID
- * the detected node visual id
- * @param linkVISUALID
- * the detected link visual id
- * @return true if element may be a duration constraint
- */
- private boolean isDurationConstraintHint(String nodeVISUALID, String linkVISUALID) {
- if (linkVISUALID != null) {
- return false;
- } else {
- return nodeVISUALID == null || ConstraintEditPart.VISUAL_ID.equals(nodeVISUALID) || DurationConstraintEditPart.VISUAL_ID.equals(nodeVISUALID) || DurationConstraintInMessageEditPart.VISUAL_ID.equals(nodeVISUALID);
- }
- }
-
- /**
- * Drop a duration observation or a duration constraint on a message edit part
- *
- * @param durationLabelElement
- * the duration observation or duration constraint to display as message label
- * @param MessageSyncEditPart
- * the containing message edit part
- * @param nodeVISUALID
- * the label node visual id
- * @return the command or UnexecutableCommand
- */
- private Command dropNodeOnMessage(PackageableElement durationLabelElement, ConnectionNodeEditPart MessageSyncEditPart, String nodeVISUALID) {
- IAdaptable elementAdapter = new EObjectAdapter(durationLabelElement);
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType) getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, false, getDiagramPreferencesHint());
- return MessageSyncEditPart.getCommand(new CreateViewRequest(descriptor));
- }
-
- /**
* Drop a time observation on a lifeline.
*
* @param observation
@@ -860,66 +520,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
/**
- * Drop an interval constraint (duration or time) on a lifeline.
- *
- * @param constraint
- * the interval constraint
- * @param nodeVISUALID
- * the node visual id
- * @return the command if the lifeline is the correct one or UnexecutableCommand
- */
- private Command dropIntervalConstraintInLifeline(IntervalConstraint constraint, String nodeVISUALID) {
- CompoundCommand cc = new CompoundCommand("Drop");
- IAdaptable elementAdapter = new EObjectAdapter(constraint);
- ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, ((IHintedType) getUMLElementType(nodeVISUALID)).getSemanticHint(), ViewUtil.APPEND, true, getDiagramPreferencesHint());
- cc.add(getHost().getCommand(new CreateViewRequest(descriptor)));
- LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(getHost());
- if (lifelinePart != null && constraint.getConstrainedElements().size() >= 2) {
- Element occ1 = constraint.getConstrainedElements().get(0);
- Element occ2 = constraint.getConstrainedElements().get(1);
- if (occ1 instanceof OccurrenceSpecification && occ2 instanceof OccurrenceSpecification) {
- Point startPoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification) occ1);
- Point endPoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification) occ2);
- if (startPoint != null && endPoint != null) {
- int height = endPoint.y - startPoint.y;
- Rectangle newBounds = null;
- if (height < 0) {
- newBounds = new Rectangle(endPoint, new Dimension(-1, -height));
- } else {
- newBounds = new Rectangle(startPoint, new Dimension(-1, height));
- }
- lifelinePart.getFigure().translateToRelative(newBounds);
- Point parentLoc = lifelinePart.getLocation();
- newBounds.translate(parentLoc.getNegated());
- ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds);
- cc.add(new ICommandProxy(setBoundsCommand));
- return cc;
- }
- }
- } else if (lifelinePart != null && constraint.getConstrainedElements().size() == 1) {
- Element occ1 = constraint.getConstrainedElements().get(0);
- if (occ1 instanceof OccurrenceSpecification) {
- Point middlePoint = SequenceUtil.findLocationOfEvent(lifelinePart, (OccurrenceSpecification) occ1);
- if (middlePoint != null) {
- int height = getDefaultDropHeight(nodeVISUALID);
- Point startPoint = middlePoint.getCopy();
- if (height > 0) {
- startPoint.translate(0, -height / 2);
- }
- Rectangle newBounds = new Rectangle(startPoint, new Dimension(-1, height));
- lifelinePart.getFigure().translateToRelative(newBounds);
- Point parentLoc = lifelinePart.getLocation();
- newBounds.translate(parentLoc.getNegated());
- ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds);
- cc.add(new ICommandProxy(setBoundsCommand));
- return cc;
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
* Get the default height to set to a drop object. This method is useful for dropped objects which must be positioned relatively to their center.
*
* @param nodeVISUALID
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java
index 24c89b5c782..0f5c52eb5e7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/DeleteTimeElementWithoutEventPolicy.java
@@ -53,7 +53,6 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart;
@@ -219,13 +218,6 @@ public class DeleteTimeElementWithoutEventPolicy extends AbstractEditPolicy impl
} else if (hostSemanticElement instanceof TimeConstraint) {
return ((TimeConstraint) hostSemanticElement).getConstrainedElements().size() > 0;
}
- // else if(hostSemanticElement instanceof DurationConstraint) {
- // /*
- // * Note that DurationConstraint may have only one ConstrainedElement.
- // * But in such a case, we suppose it has not been created as one of the concerned edit parts.
- // */
- // return ((DurationConstraint)hostSemanticElement).getConstrainedElements().size() >= 2;
- // }
return true;
}
@@ -255,22 +247,6 @@ public class DeleteTimeElementWithoutEventPolicy extends AbstractEditPolicy impl
}
}
return Collections.emptyList();
- } else if (getHost() instanceof DurationConstraintEditPart && hostSemanticElement instanceof TimeConstraint) {
- LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
- List<Element> occs = ((TimeConstraint) hostSemanticElement).getConstrainedElements();
- if (occs.size() >= 2 && occs.get(0) instanceof OccurrenceSpecification && occs.get(1) instanceof OccurrenceSpecification) {
- EditPart part1 = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification) occs.get(0));
- EditPart part2 = SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification) occs.get(1));
- List<View> list = new ArrayList<>(2);
- if (part1 != null) {
- list.add((View) part1.getModel());
- }
- if (part2 != null) {
- list.add((View) part2.getModel());
- }
- return list;
- }
- return Collections.emptyList();
}
// a label on a message always has its parent message
return Collections.emptyList();
@@ -297,15 +273,6 @@ public class DeleteTimeElementWithoutEventPolicy extends AbstractEditPolicy impl
}
return true;
}
- // else if(getHost() instanceof DurationConstraintEditPart && hostSemanticElement instanceof DurationConstraint) {
- // LifelineEditPart lifeline = SequenceUtil.getParentLifelinePart(getHost());
- // List<Element> occs = ((DurationConstraint)hostSemanticElement).getConstrainedElements();
- // if(occs.size() >= 2 && occs.get(0) instanceof OccurrenceSpecification && occs.get(1) instanceof OccurrenceSpecification) {
- // return SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(0)) == null || SequenceUtil.getLinkedEditPart(lifeline, (OccurrenceSpecification)occs.get(1)) == null;
- // }
- // return true;
- // }
- // a label on a message always has its parent message
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java
index 8fd591346fc..c44fa7f7bcf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java
@@ -21,8 +21,6 @@ import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Polyline;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -32,7 +30,6 @@ import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.requests.CreateConnectionRequest;
-import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.ReconnectRequest;
import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
@@ -42,7 +39,6 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElemen
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Connector;
import org.eclipse.gmf.runtime.notation.View;
@@ -75,9 +71,6 @@ import org.eclipse.uml2.uml.MessageEnd;
*/
public class LifelineChildGraphicalNodeEditPolicy extends OLDSequenceGraphicalNodeEditPolicy {
- /** the feedback for creating a duration constraint node */
- private Polyline durationCreationFeedback = null;
-
/** the router to use for messages */
public static ConnectionRouter messageRouter = new MessageRouter();
@@ -173,7 +166,7 @@ public class LifelineChildGraphicalNodeEditPolicy extends OLDSequenceGraphicalNo
} else {
// Get the start command for each individual request, this will
// update each request as required.
- final List commands = new ArrayList();
+ final List<Command> commands = new ArrayList<>();
for (Iterator iter = request.getAllRequests().iterator(); iter.hasNext();) {
Request individualRequest = (Request) iter.next();
Command cmd = null;
@@ -270,62 +263,6 @@ public class LifelineChildGraphicalNodeEditPolicy extends OLDSequenceGraphicalNo
}
/**
- * Show the feedback for creating a duration constraint from this edit part
- *
- * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#showSourceFeedback(org.eclipse.gef.Request)
- * @param request
- * creation request
- */
- @Override
- public void showSourceFeedback(Request request) {
- if (request instanceof CreateUnspecifiedTypeRequest) {
- Object hintedType = ((CreateUnspecifiedTypeRequest) request).getElementTypes().get(0);
- CreateRequest req = null;
- if (UMLElementTypes.DurationConstraint_Shape.equals(hintedType)) {
- req = ((CreateUnspecifiedTypeRequest) request).getRequestForType(UMLElementTypes.DurationConstraint_Shape);
- } else if (UMLElementTypes.DurationObservation_Shape.equals(hintedType)) {
- req = ((CreateUnspecifiedTypeRequest) request).getRequestForType(UMLElementTypes.DurationObservation_Shape);
- }
- if (req != null) {
- Object initLocation = req.getExtendedData().get(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION);
- if (initLocation instanceof Point) {
- Point startPoint = ((Point) initLocation).getCopy();
- Point targetPoint = ((CreateUnspecifiedTypeRequest) request).getLocation().getCopy();
- getFeedbackLayer().translateToRelative(startPoint);
- getFeedbackLayer().translateToRelative(targetPoint);
- if (durationCreationFeedback == null) {
- durationCreationFeedback = new Polyline();
- durationCreationFeedback.setLineWidth(1);
- durationCreationFeedback.setLineStyle(Graphics.LINE_DASHDOT);
- durationCreationFeedback.setForegroundColor(((IGraphicalEditPart) getHost()).getFigure().getLocalForegroundColor());
- addFeedback(durationCreationFeedback);
- }
- durationCreationFeedback.setStart(startPoint);
- durationCreationFeedback.setEnd(targetPoint);
- return;
- }
- }
- }
- super.showSourceFeedback(request);
- }
-
- /**
- * Erase the feedback for creating a duration constraint from this edit part
- *
- * @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#eraseSourceFeedback(org.eclipse.gef.Request)
- * @param request
- * creation request
- */
- @Override
- public void eraseSourceFeedback(Request request) {
- super.eraseSourceFeedback(request);
- if (durationCreationFeedback != null) {
- removeFeedback(durationCreationFeedback);
- }
- durationCreationFeedback = null;
- }
-
- /**
* Get the replacing connection router for routing messages correctly
*
* @see org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getDummyConnectionRouter(org.eclipse.gef.requests.CreateConnectionRequest)
@@ -372,12 +309,12 @@ public class LifelineChildGraphicalNodeEditPolicy extends OLDSequenceGraphicalNo
IAdaptable gateAdapter = new IAdaptable() {
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if (Gate.class == adapter) {
Message message = elementAdapter.getAdapter(Message.class);
MessageEnd sendEvent = message.getSendEvent();
if (sendEvent instanceof Gate) {
- return sendEvent;
+ return adapter.cast(sendEvent);
}
}
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java
index c075383ff73..c0c53c4be12 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ObservationLinkPolicy.java
@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.commands.ExecutionException;
@@ -15,7 +14,6 @@ import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
@@ -28,7 +26,6 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
@@ -44,18 +41,13 @@ import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl;
import org.eclipse.papyrus.uml.diagram.sequence.ObservationLinkMetamodelType;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ObservationLinkEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineEditPartUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
-import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Message;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.OccurrenceSpecification;
import org.eclipse.uml2.uml.TimeObservation;
@@ -145,11 +137,6 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
if (timeObservationLabelEditPart.getSourceConnections().size() > 0) {
return null;
}
- } else if (host instanceof DurationObservationEditPart) {
- DurationObservationEditPart durationObservationEditPart = (DurationObservationEditPart) host;
- if (durationObservationEditPart.getSourceConnections().size() > 0) {
- return null;
- }
} else {
return null;
}
@@ -168,8 +155,6 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
EditPart sourceEditPart = request.getSourceEditPart();
if ((sourceEditPart instanceof TimeObservationLabelEditPart) && !(getHost() instanceof LifelineEditPart)) {
return null;
- } else if (sourceEditPart instanceof DurationObservationEditPart && !(getHost() instanceof AbstractMessageEditPart)) {
- return null;
}
ICommandProxy proxy = (ICommandProxy) request.getStartCommand();
if (proxy == null) {
@@ -178,12 +163,10 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
CompositeCommand result = new CompositeCommand("Add observation link command");
if (sourceEditPart instanceof TimeObservationLabelEditPart) {
result.add(new UpdateTimeObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
- } else if (sourceEditPart instanceof DurationObservationEditPart) {
- result.add(new UpdateDurationObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
}
// 1:
CompositeCommand cc = (CompositeCommand) proxy.getICommand();
- Iterator commandItr = cc.iterator();
+ Iterator<?> commandItr = cc.iterator();
CreateObservationLinkCommand createConnectorViewCommand = (CreateObservationLinkCommand) commandItr.next();
createConnectorViewCommand.setSourceEditPart(request.getSourceEditPart());
createConnectorViewCommand.setTargetEditPart(request.getTargetEditPart());
@@ -203,12 +186,6 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
return null;
}
cc.add(new UpdateTimeObservationLinkSourceElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
- } else if (request.getConnectionEditPart().getSource() instanceof DurationObservationEditPart && getHost() instanceof DurationObservationEditPart) {
- DurationObservationEditPart durationObservationEditPart = (DurationObservationEditPart) getHost();
- if (durationObservationEditPart.getSourceConnections().size() > 0) {
- return null;
- }
- cc.add(new UpdateDurationObservationLinkSourceElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
}
return reconnectSourceCommand;
}
@@ -221,8 +198,6 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
// update semantic model
if (request.getConnectionEditPart().getSource() instanceof TimeObservationLabelEditPart) {
cc.add(new UpdateTimeObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
- } else if (request.getConnectionEditPart().getSource() instanceof DurationObservationEditPart) {
- cc.add(new UpdateDurationObservationLinkTargetElementCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), "Update semantic model", null, request, getHost()));
}
return proxy;
}
@@ -273,108 +248,6 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
}
}
- private class UpdateDurationObservationLinkSourceElementCommand extends AbstractTransactionalCommand {
-
- private final ReconnectRequest request;
-
- private EditPart hostPart;
-
- private DurationObservationEditPart sourceTolEP;
-
- List<OccurrenceSpecification> occList = Collections.emptyList();
-
- public UpdateDurationObservationLinkSourceElementCommand(TransactionalEditingDomain domain, String label, List affectedFiles, ReconnectRequest request, EditPart hostPart) {
- super(domain, label, affectedFiles);
- this.request = request;
- sourceTolEP = (DurationObservationEditPart) request.getConnectionEditPart().getSource();
- this.hostPart = hostPart;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (sourceTolEP == hostPart) {
- return CommandResult.newCancelledCommandResult();
- }
- View sourceView = (View) sourceTolEP.getModel();
- DurationObservation sourceDurationObservation = (DurationObservation) sourceView.getElement();
- DurationObservationEditPart targetDoEP = (DurationObservationEditPart) hostPart;
- View targetView = (View) targetDoEP.getModel();
- DurationObservation targetDurationObservation = (DurationObservation) targetView.getElement();
- targetDurationObservation.getEvents().addAll(sourceDurationObservation.getEvents());
- sourceDurationObservation.getEvents().clear();
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- public boolean canExecute() {
- if (hostPart instanceof DurationObservationEditPart) {
- return true;
- }
- return false;
- }
- }
-
- public class UpdateDurationObservationLinkTargetElementCommand extends AbstractTransactionalCommand {
-
- private final Request request;
-
- private EditPart hostPart;
-
- public UpdateDurationObservationLinkTargetElementCommand(TransactionalEditingDomain domain, String label, List affectedFiles, Request request, EditPart hostPart) {
- super(domain, label, affectedFiles);
- this.request = request;
- this.hostPart = hostPart;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DurationObservationEditPart doEP = null;
- if (request instanceof CreateConnectionRequest) {
- doEP = (DurationObservationEditPart) (((CreateConnectionRequest) request).getSourceEditPart());
- } else if (request instanceof ReconnectRequest) {
- doEP = (DurationObservationEditPart) (((ReconnectRequest) request).getConnectionEditPart().getSource());
- }
- View view = (View) doEP.getModel();
- DurationObservation durationObservation = (DurationObservation) view.getElement();
- EList<NamedElement> events = durationObservation.getEvents();
- // if is reconnect operation, first remove orginal message event of DurationObservation
- if (request instanceof ReconnectRequest) {
- events.clear();
- }
- Map<String, Object> extendedData = request.getExtendedData();
- // assign the occurrence specification
- Object paramOcc1 = extendedData.get(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION);
- Object paramOcc2 = extendedData.get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2);
- if (paramOcc1 != null && paramOcc2 != null) {
- events.add((OccurrenceSpecification) paramOcc1);
- events.add((OccurrenceSpecification) paramOcc2);
- }
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- public boolean canExecute() {
- if (hostPart instanceof ConnectionNodeEditPart) {
- Map<String, Object> extendedData = request.getExtendedData();
- if (hostPart instanceof AbstractMessageEditPart) {
- AbstractMessageEditPart messageEP = (AbstractMessageEditPart) hostPart;
- View view = (View) messageEP.getModel();
- Message message = (Message) view.getElement();
- if (message.getSendEvent() != null) {
- extendedData.put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION, message.getSendEvent());
- }
- if (message.getReceiveEvent() != null) {
- extendedData.put(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2, message.getReceiveEvent());
- }
- }
- if (extendedData.containsKey(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION) && extendedData.containsKey(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2)) {
- return true;
- }
- }
- return false;
- }
- }
-
private class UpdateTimeObservationLinkSourceElementCommand extends AbstractTransactionalCommand {
private final ReconnectRequest request;
@@ -424,7 +297,7 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
List<OccurrenceSpecification> occList = Collections.emptyList();
- public UpdateTimeObservationLinkTargetElementCommand(TransactionalEditingDomain domain, String label, List affectedFiles, Request request, EditPart hostPart) {
+ public UpdateTimeObservationLinkTargetElementCommand(TransactionalEditingDomain domain, String label, List<?> affectedFiles, Request request, EditPart hostPart) {
super(domain, label, affectedFiles);
this.request = request;
this.hostPart = hostPart;
@@ -534,7 +407,7 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
private String newSourceTerminal;
- public CreateObservationLinkCommand(TransactionalEditingDomain domain, String label, List affectedFiles) {
+ public CreateObservationLinkCommand(TransactionalEditingDomain domain, String label, List<?> affectedFiles) {
super(domain, label, affectedFiles);
}
@@ -615,7 +488,7 @@ public class ObservationLinkPolicy extends GraphicalNodeEditPolicy {
pointList.addPoint(sourceAnchor.getLocation(request.getLocation()));
pointList.addPoint(targetAnchor.getLocation(request.getLocation()));
}
- List newBendpoints = new ArrayList();
+ List<RelativeBendpoint> newBendpoints = new ArrayList<>();
int numOfPoints = pointList.size();
for (short i = 0; i < numOfPoints; i++) {
Dimension s = pointList.getPoint(i).getDifference(sourceAnchor.getReferencePoint());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java
index 4adc38ab280..4eec1894c15 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/TimeRelatedSelectionEditPolicy.java
@@ -15,28 +15,18 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.util.OccurrenceSpecificationMoveHelper;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
-import org.eclipse.uml2.uml.ExecutionSpecification;
/**
* Edit policy to restrict border item movement. This edit policy moves the related events when a Time/Duration Observation/Constraint is moved.
@@ -53,68 +43,12 @@ public class TimeRelatedSelectionEditPolicy extends BorderItemSelectionEditPolic
// In fact, BorderItem can not be moved out of parent bounds, so the moveDelta if not correctly when move out parent.
Command command = super.getMoveCommand(request);
if (command != null) {
- if (invalidMoveDurationConstraint(request.getMoveDelta())) {
- return UnexecutableCommand.INSTANCE;
- }
command = OccurrenceSpecificationMoveHelper.completeMoveTimeRelatedElementCommand(command, request, getHost(), getHostFigure());
}
return command;
}
/**
- * Bug description:
- * When we move down the Duration Constraint which attached to a Execution Specification, the Execution Specification can be moved out it's Parent
- * Execution Specification. This would not happen when move Execution Specification directly.
- *
- * At present, we just avoid this kind of moving.
- */
- private boolean invalidMoveDurationConstraint(Point moveDelta) {
- if (!(getHost() instanceof DurationConstraintEditPart) || moveDelta == null || moveDelta.y == 0) {
- return false;
- }
- DurationConstraintEditPart editPart = (DurationConstraintEditPart) getHost();
- DurationConstraint durationConstraint = (DurationConstraint) editPart.resolveSemanticElement();
- EList<Element> constrainedElements = durationConstraint.getConstrainedElements();
- List<ExecutionSpecification> executions = new ArrayList<>();
- for (Element element : constrainedElements) {
- if (!(element instanceof ExecutionOccurrenceSpecification)) {
- continue;
- }
- ExecutionSpecification execution = ((ExecutionOccurrenceSpecification) element).getExecution();
- if (execution != null && !executions.contains(execution)) {
- executions.add(execution);
- }
- }
- if (executions.isEmpty()) {
- return false;
- }
- // LifelineEditPart lifelineEditPart = (LifelineEditPart)getHost().getParent();
- // for(ExecutionSpecification executionSpecification : executions) {
- // Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(executionSpecification);
- // for(Setting ref : settings) {
- // if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
- // View view = (View)ref.getEObject();
- // EditPart part = DiagramEditPartsUtil.getEditPartFromView(view, getHost());
- // if(!(part instanceof ShapeNodeEditPart)) {
- // continue;
- // }
- // Rectangle childBounds = ((ShapeNodeEditPart)part).getFigure().getBounds().getCopy();
- // List<ShapeNodeEditPart> toCheckExecutionSpecificationList = new ArrayList<ShapeNodeEditPart>(lifelineEditPart.getChildShapeNodeEditPart());
- // toCheckExecutionSpecificationList.remove(part);
- // ShapeNodeEditPart parent = LifelineXYLayoutEditPolicy.getParent(lifelineEditPart, childBounds, toCheckExecutionSpecificationList);
- // if(parent != null) {
- // Rectangle parentBounds = parent.getFigure().getBounds().getCopy();
- // if(childBounds.y + moveDelta.y >= parentBounds.bottom() - 1) {
- // return true;
- // }
- // }
- // }
- // }
- // }
- return true;
- }
-
- /**
* By default, the IBorderItemEditPart can not be moved out of the parent.
*
* @param request
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java
index 26c8cc36cfc..bac5c403d1b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java
@@ -149,7 +149,7 @@ public class UpdateWeakReferenceForMessageSpecEditPolicy extends UpdateWeakRefer
}
for (Object editPart : connectionsAndChildren) {
- if (editPart instanceof ConnectionEditPart) {
+ if (editPart instanceof AbstractMessageEditPart) {
EObject element = ((View) ((AbstractMessageEditPart) editPart).getAdapter(View.class)).getElement();
if (element instanceof Message && null != ((Message) element).getSendEvent() && ((Message) element).getSendEvent().equals(nextEvent)
|| element instanceof Message && null != ((Message) element).getReceiveEvent() && ((Message) element).getReceiveEvent().equals(nextEvent)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/DurationConstraintFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/DurationConstraintFigure.java
deleted file mode 100644
index afc3993eb65..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/DurationConstraintFigure.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Copyright (c) 2017 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- */
-package org.eclipse.papyrus.uml.diagram.sequence.figures;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolylineShape;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.CenterLayout;
-import org.eclipse.papyrus.uml.diagram.common.draw2d.LinesBorder;
-import org.eclipse.swt.SWT;
-
-public class DurationConstraintFigure extends RectangleFigure {
-
-
-
- /**
- * The delta number of pixel to paint the Arrow.
- */
- private static final int ARROW_SIZE = 10;
-
- /**
- *
- * Constructor.
- *
- */
- public DurationConstraintFigure() {
- CenterLayout layoutThis = new CenterLayout();
- this.setLayoutManager(layoutThis);
-
- }
-
- /**
- * Create and display the top and bottom line of the figure.
- *
- * @return the created Border
- */
- private Border createBorder() {
- LinesBorder result = new LinesBorder();
- result.setSides(PositionConstants.TOP | PositionConstants.BOTTOM);
- result.setStyle(SWT.BORDER_DASH);
- return result;
- }
-
-
- /**
- * @see org.eclipse.draw2d.Figure#paint(org.eclipse.draw2d.Graphics)
- *
- * @param graphics
- */
- @Override
- public void paint(Graphics graphics) {
- super.paint(graphics);
- Rectangle rect = this.getBounds();
- graphics.pushState();
- graphics.setForegroundColor(getForegroundColor());
- Point top = new Point(rect.getTop());
- Point bottom = new Point(rect.getBottom());
- graphics.drawLine(top, bottom);
- // draw arrows
-
- // Top Arrow
- Point left = new Point(top);
- left = left.getTranslated(-ARROW_SIZE, ARROW_SIZE);
- Point right = new Point(top);
- right = right.getTranslated(ARROW_SIZE, ARROW_SIZE);
- // Create list of point
- PointList list = new PointList();
- list.addPoint(right);
- list.addPoint(top);
- list.addPoint(left);
- graphics.drawPolyline(list);
-
- // Bottom Arrow
- left = new Point(bottom);
- left = left.getTranslated(-ARROW_SIZE, -ARROW_SIZE);
- right = new Point(bottom);
- right = right.getTranslated(ARROW_SIZE, -ARROW_SIZE);
- // Create list of point
- list = new PointList();
- list.addPoint(right);
- list.addPoint(bottom);
- list.addPoint(left);
- graphics.drawPolyline(list);
-
- this.setFill(false);
- this.setOutline(false);
- this.setBorder(createBorder());
- graphics.popState();
-
- }
-
- /**
- * Not used anymore (present for compilation purpose of CustomDurationConstraintFigure that is no more called )
- *
- * @return null
- * @deprecated Use paint instead.
- *
- */
- @Deprecated
- protected PolylineShape getDurationArrow() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/DurationConstraintLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/DurationConstraintLocator.java
deleted file mode 100644
index 2ae0b926ab2..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/DurationConstraintLocator.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Celine Janssens (celine.janssens@all4tec.net) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.locator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-
-/**
- * @author Celine JANSSENS
- * This class is used for Duration Constraint (@see {@link LifelineEditPart}) in order to locate it just next to the middle of it's parent (the Lifeline) on the X axe.
- * The Y Axe is free except if the top is upper than its Parent.
- */
-public class DurationConstraintLocator extends AdvancedBorderItemLocator {
-
- /**
- * Constructor.
- *
- * @param borderItem
- * @param parentFigure
- * @param constraint
- */
- public DurationConstraintLocator(IFigure borderItem, IFigure parentFigure, Rectangle constraint) {
- super(borderItem, parentFigure, constraint);
-
- }
-
- /**
- * Constructor.
- *
- */
- public DurationConstraintLocator(IFigure parentFigure) {
- super(parentFigure);
- }
-
-
- /**
- * Constructor.
- *
- */
- public DurationConstraintLocator(IFigure parentFigure, int position) {
- super(parentFigure, position);
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator#relocate(org.eclipse.draw2d.IFigure)
- *
- * @param borderItem
- */
- @Override
- public void relocate(IFigure borderItem) {
- Dimension size = getSize(borderItem);
- // The returned constraint is relative to the parent
- Rectangle rectSuggested = getConstraint();
- rectSuggested.setSize(size);
- // transform it to absolute
- Rectangle suggestedRectIndiagram = rectSuggested.getCopy();
- suggestedRectIndiagram.x = suggestedRectIndiagram.x + getParentFigure().getBounds().x;
- suggestedRectIndiagram.y = suggestedRectIndiagram.y + getParentFigure().getBounds().y;
- // get the valid Location in Absolute coordinates
- suggestedRectIndiagram = getValidLocation(suggestedRectIndiagram, borderItem);
-
- // transform it back in relative coordinate to its parent.
- borderItem.setBounds(suggestedRectIndiagram.getCopy());
- suggestedRectIndiagram.x = suggestedRectIndiagram.x - getParentFigure().getBounds().x;
- suggestedRectIndiagram.y = suggestedRectIndiagram.y - getParentFigure().getBounds().y;
-
- // Set the new Constraint in Relative.
- setConstraint(suggestedRectIndiagram);
-
- }
-
- /**
- *
- * The Valid location for a Duration Constraint is just next to the center of its parent (the lifeline).
- *
- * @see org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle, org.eclipse.draw2d.IFigure)
- *
- * @param proposedLocation
- * @param borderItem
- * @return
- */
- @Override
- public Rectangle getValidLocation(Rectangle proposedLocation, IFigure borderItem) {
- // the offset required to take the Lifeline Header height into account
- int headerYOffset = 20;
-
- int parentMiddleX = getParentFigure().getBounds().x + (getParentFigure().getBounds().width / 2);
-
- // Place the DurationConstraint Just next to the lifeline (right or left depends on the proposedLocation )
- if (proposedLocation.x < parentMiddleX) {
- proposedLocation.setX(parentMiddleX - proposedLocation.width());
- } else {
- proposedLocation.setX(parentMiddleX);
-
- }
-
- // If the proposed Location is upper than the Parent Figure (The lifeline) , then set the location as close as possible from the top of the parent.
- if (proposedLocation.y < getParentFigure().getBounds().y + headerYOffset) {
- proposedLocation.setY(getParentFigure().getBounds().y + headerYOffset);
- }
-
- // If the DurationConstraint is out of the Lifeline bottom then relocate it into the Lifeline
- if (proposedLocation.y + proposedLocation.height > getParentFigure().getBounds().bottom()) {
- proposedLocation.setY(getParentFigure().getBounds().bottom() - proposedLocation.height);
- }
-
-
- return super.getValidLocation(proposedLocation, borderItem);
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java
deleted file mode 100644
index b95b6d63723..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Specific Parser for the DurationObservation.
- */
-public class DurationObservationParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a line break */
- private static final String LINE_BREAK = System.getProperty("line.separator");
-
- public DurationObservationParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public DurationObservationParser(EAttribute[] features) {
- super(features);
- }
-
- public DurationObservationParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if (notification instanceof Notification) {
- Object feature = ((Notification) notification).getFeature();
- if (feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature) feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPrintString(IAdaptable element, int flags) {
- Object adapter = element.getAdapter(EObject.class);
- if (adapter instanceof DurationObservation) {
- return DurationObservationHelper.getLabelString((DurationObservation) adapter);
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<>();
- if (element instanceof DurationObservation) {
- DurationObservation observation = (DurationObservation) element;
- semanticElementsBeingParsed.add(observation);
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getMessage_SendEvent().equals(feature) || UMLPackage.eINSTANCE.getMessage_ReceiveEvent().equals(feature)
- || UMLPackage.eINSTANCE.getDurationObservation_Event().equals(feature);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
index 9f84304f685..b05cb810c5c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
@@ -29,8 +29,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConsiderIgnoreFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationObservationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationObservationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomGeneralOrderingEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomMessageName2EditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomMessageName3EditPart;
@@ -41,8 +39,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomMessageName7Edi
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomMessageNameEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomStateInvariantEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomStateInvariantLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
@@ -142,8 +138,6 @@ public class CustomEditPartProvider extends UMLEditPartProvider {
// return new CustomTimeObservationLabelEditPart(view);
// case TimeObservationAppliedStereotypeEditPart.VISUAL_ID:
// return new CustomTimeObservationAppliedStereotypeEditPart(view);
- // case DurationConstraintEditPart.VISUAL_ID:
- // return new CustomDurationConstraintEditPart(view);
// case DurationConstraintAppliedStereotypeEditPart.VISUAL_ID:
// return new CustomDurationConstraintAppliedStereotypeEditPart(view);
// case DestructionOccurrenceSpecificationEditPart.VISUAL_ID:
@@ -160,10 +154,6 @@ public class CustomEditPartProvider extends UMLEditPartProvider {
// return new CustomDurationConstraintInMessageEditPart(view);
// case DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID:
// return new CustomDurationConstraintInMessageAppliedStereotypeEditPart(view);
- case DurationObservationEditPart.VISUAL_ID:
- return new CustomDurationObservationEditPart(view);
- case DurationObservationAppliedStereotypeEditPart.VISUAL_ID:
- return new CustomDurationObservationAppliedStereotypeEditPart(view);
case InteractionInteractionCompartmentEditPart.VISUAL_ID:
return new CInteractionInteractionCompartmentEditPart(view);
// case CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID:
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
index 3bd259b527b..5c02a58e47d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
@@ -41,16 +41,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombi
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConsiderIgnoreFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationAppliedStereotypeEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPart;
@@ -71,17 +61,6 @@ public class CustomViewProvider extends UMLViewProvider {
if (op.getContainerView() == null) {
return false;
}
- String visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
- if (DurationConstraintEditPart.VISUAL_ID.equals(visualID)) {
- // avoid to
- // modify
- // UMLVisualIDRegistry.getNodeVisualID(View,
- // EObject)
- if (InteractionInteractionCompartmentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry
- .getVisualID(op.getContainerView()))) {
- return true;
- }
- }
return super.provides(op);
}
@@ -90,16 +69,6 @@ public class CustomViewProvider extends UMLViewProvider {
if (op.getContainerView() == null) {
return false;
}
- String visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
- if (DurationConstraintEditPart.VISUAL_ID.equals(visualID)) { // avoid to
- // modify
- // UMLVisualIDRegistry.getNodeVisualID(View,
- // EObject)
- if (InteractionInteractionCompartmentEditPart.VISUAL_ID.equals(UMLVisualIDRegistry
- .getVisualID(op.getContainerView()))) {
- return true;
- }
- }
return super.provides(op);
}
@@ -169,45 +138,6 @@ public class CustomViewProvider extends UMLViewProvider {
return node;
}
- @Override
- public Node createDurationConstraint_Shape(EObject domainElement,
- View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
- Shape node = NotationFactory.eINSTANCE.createShape();
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry
- .getType(DurationConstraintEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
- .getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node,
- prefStore, "DurationConstraint");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node,
- prefStore, "DurationConstraint");
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
- prefStore, "DurationConstraint");
- Node durationConstraint_BodyLabel = createLabel(node,
- UMLVisualIDRegistry
- .getType(DurationConstraintLabelEditPart.VISUAL_ID));
- durationConstraint_BodyLabel.setLayoutConstraint(NotationFactory.eINSTANCE
- .createLocation());
- Location durationConstraint_BodyLabel_Location = (Location) durationConstraint_BodyLabel.getLayoutConstraint();
- durationConstraint_BodyLabel_Location.setX(25);
- durationConstraint_BodyLabel_Location.setY(0);
- Node durationConstraint_StereotypeLabel = createLabel(
- node,
- UMLVisualIDRegistry
- .getType(DurationConstraintAppliedStereotypeEditPart.VISUAL_ID));
- durationConstraint_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE
- .createLocation());
- Location durationConstraint_StereotypeLabel_Location = (Location) durationConstraint_StereotypeLabel.getLayoutConstraint();
- durationConstraint_StereotypeLabel_Location.setX(0);
- durationConstraint_StereotypeLabel_Location.setY(-22);
- return node;
- }
-
/**
* This class has bee overloaded in order to set the combined fragment under the lifelines
*
@@ -261,82 +191,6 @@ public class CustomViewProvider extends UMLViewProvider {
return i;
}
-
- @Override
- public Node createDurationConstraint_Shape_CN(EObject domainElement,
- View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
- Node node = NotationFactory.eINSTANCE.createShape();
- node.getStyles()
- .add(NotationFactory.eINSTANCE.createDescriptionStyle());
- node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry
- .getType(DurationConstraintInMessageEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // custom layout for location
- Location durationConstraint_Shape_CN_Location = (Location) node.getLayoutConstraint();
- durationConstraint_Shape_CN_Location.setX(0);
- durationConstraint_Shape_CN_Location.setY(20);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
- .getPreferenceStore();
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
- prefStore, "DurationConstraint");
- Node durationConstraint_BodyLabel_CN = createLabel(
- node,
- UMLVisualIDRegistry
- .getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID));
- Node durationConstraint_StereotypeLabel_CN = createLabel(
- node,
- UMLVisualIDRegistry
- .getType(DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID));
- durationConstraint_StereotypeLabel_CN.setLayoutConstraint(NotationFactory.eINSTANCE
- .createLocation());
- Location durationConstraint_StereotypeLabel_CN_Location = (Location) durationConstraint_StereotypeLabel_CN.getLayoutConstraint();
- durationConstraint_StereotypeLabel_CN_Location.setX(0);
- durationConstraint_StereotypeLabel_CN_Location.setY(-22);
- return node;
- }
-
- @Override
- public Node createDurationObservation_Shape(EObject domainElement,
- View containerView, int index, boolean persisted,
- PreferencesHint preferencesHint) {
- Node node = NotationFactory.eINSTANCE.createShape();
- node.getStyles()
- .add(NotationFactory.eINSTANCE.createDescriptionStyle());
- node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
- node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry
- .getType(DurationObservationEditPart.VISUAL_ID));
- ViewUtil.insertChildView(containerView, node, index, persisted);
- node.setElement(domainElement);
- // custom layout for location
- Location durationObservation_Shape_Location = (Location) node.getLayoutConstraint();
- durationObservation_Shape_Location.setX(0);
- durationObservation_Shape_Location.setY(0);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
- .getPreferenceStore();
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
- prefStore, "DurationObservation");
- Node durationObservation_NameLabel = createLabel(node,
- UMLVisualIDRegistry
- .getType(DurationObservationLabelEditPart.VISUAL_ID));
- Node durationObservation_StereotypeLabel = createLabel(
- node,
- UMLVisualIDRegistry
- .getType(DurationObservationAppliedStereotypeEditPart.VISUAL_ID));
- durationObservation_StereotypeLabel.setLayoutConstraint(NotationFactory.eINSTANCE
- .createLocation());
- Location durationObservation_StereotypeLabel_Location = (Location) durationObservation_StereotypeLabel.getLayoutConstraint();
- durationObservation_StereotypeLabel_Location.setX(0);
- durationObservation_StereotypeLabel_Location.setY(0);
- return node;
- }
-
@Override
public Node createConsiderIgnoreFragment_Shape(EObject domainElement,
View containerView, int index, boolean persisted,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java
deleted file mode 100644
index a7a44e3a929..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package org.eclipse.papyrus.uml.diagram.sequence.providers;
-
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PrecisionPoint;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomCommentAnnotatedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-import org.eclipse.uml2.uml.DurationConstraint;
-
-//org.eclipse.papyrus.extensionpoints.editors.ui.DirectEditorsContributionItem
-public class DurationConstraintContributionItem extends ContributionItem implements IWorkbenchContribution {
-
- /**
- * Service locator given to this contribution item using the {@link IWorkbenchContribution} interface.
- */
- private IServiceLocator serviceLocator;
-
- private MenuItem subMenuItem;
-
- /**
- *
- */
- public DurationConstraintContributionItem() {
- setId("org.eclipse.papyrus.sequence.duraitonconstraint.menuitem");
- }
-
- /**
- * @param id
- */
- public DurationConstraintContributionItem(String id) {
- super(id);
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void dispose() {
- if (subMenuItem != null && !subMenuItem.isDisposed()) {
- subMenuItem.dispose();
- }
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(Composite parent) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(Menu menu, int index) {
- // retrieves current selection
- final Object selectedElement = getSelectedElement();
-
- // first case: this class was not able to retrieve the selection service
- // or does not understand the current selection.
- // does not build any sub-menu and returns.
- if (selectedElement == null) {
- return;
- }
-
- // get the uml object type of this element, using the business resolver
- final Object businessObject = EMFHelper.getEObject(selectedElement);
- // no object found: exit
- if (businessObject == null || !(businessObject instanceof DurationConstraint)) {
- return;
- }
-
- createSubMenu(menu, index, (DurationConstraint) businessObject);
- }
-
- protected void createSubMenu(Menu menu, int index, DurationConstraint businessObject) {
- subMenuItem = new MenuItem(menu, SWT.PUSH);// SWT.CASCADE);
- subMenuItem.setText("Rotate Duration Constraint");
-
- subMenuItem.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- doRotate();
- }
- });
- }
-
- /**
- * Retrieves and return the current selected element
- *
- * @return the current selected element
- */
- protected Object getSelectedElement() {
- ISelection selection = getSelection();
- // this checks if it is the good instance AND if it is not null
- if (selection instanceof IStructuredSelection) {
- return ((IStructuredSelection) selection).getFirstElement();
- }
- return null;
- }
-
- /**
- * Retrieves and return the current selection
- *
- * @return the current selection
- */
- protected ISelection getSelection() {
- ISelectionService selectionService = getSelectionService();
- if (selectionService != null) {
- return selectionService.getSelection();
- }
- return null;
- }
-
- /**
- * Returns the selection service for the current workbench
- *
- * @return the selection service for the current workbench or <code>null</code> if no selection
- * service was found.
- */
- protected ISelectionService getSelectionService() {
- ISelectionService selectionService = serviceLocator.getService(ISelectionService.class);
- return selectionService;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void fill(ToolBar parent, int index) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- *
- * @since 3.0
- */
- @Override
- public void fill(CoolBar parent, int index) {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- *
- * @since 3.0
- */
- @Override
- public void saveWidgetState() {
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isDirty() {
- // @issue should this be false instead of calling isDynamic()?
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>true</code>. Subclasses may override.
- */
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isDynamic() {
- return true;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isGroupMarker() {
- return false;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method returns <code>false</code>. Subclasses may override.
- */
- @Override
- public boolean isSeparator() {
- return false;
- }
-
- /**
- * Returns a string representation of this contribution item suitable only for debugging.
- */
- @Override
- public String toString() {
- return getClass().getName() + "(id=" + getId() + ")";//$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code> method does nothing.
- * Subclasses may override.
- */
- @Override
- public void update() {
- }
-
- /**
- * The <code>ContributionItem</code> implementation of this method declared on <code>IContributionItem</code> does nothing. Subclasses should
- * override to update their
- * state.
- */
- @Override
- public void update(String id) {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void initialize(IServiceLocator serviceLocator) {
- assert (serviceLocator != null);
- this.serviceLocator = serviceLocator;
- }
-
- private void doRotate() {
- Object element = getSelectedElement();
- if (!(element instanceof CustomDurationConstraintEditPart)) {
- return;
- }
-
- CustomDurationConstraintEditPart durationPart = (CustomDurationConstraintEditPart) element;
- boolean isVertical = durationPart.isArrowVertical();
-
- CompositeCommand compositeCmd = new CompositeCommand("rotate");
- Command rotateCmd = new CustomDurationConstraintEditPart.RotateArrowCommand(durationPart.getEditingDomain(), durationPart);
- compositeCmd.add(new EMFtoGMFCommandWrapper(rotateCmd));
-
- // set bounds command
- ICommand boundsCommand = new SetResizeAndLocationCommand(durationPart.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(durationPart.getNotationView()), getNewBounds(durationPart.getBounds()));
- compositeCmd.add(boundsCommand);
-
- // update anchor
- List list = durationPart.getSourceConnections();
- for (Object o : list) {
- if (o instanceof CustomCommentAnnotatedElementEditPart) {
- CustomCommentAnnotatedElementEditPart connectionPart = (CustomCommentAnnotatedElementEditPart) o;
- String terminal = AnchorHelper.getAnchorId(connectionPart.getEditingDomain(), connectionPart, true);
- if (terminal.length() > 0) {
- PrecisionPoint pt = BaseSlidableAnchor.parseTerminalString(terminal);
- SetConnectionAnchorsCommand rotateAnchorsCommand = new SetConnectionAnchorsCommand(connectionPart.getEditingDomain(), "Rotate Duration Anchors");
- rotateAnchorsCommand.setEdgeAdaptor(new EObjectAdapter(connectionPart.getNotationView()));
- if (isVertical) {
- if (pt.y < 0.3) {
- rotateAnchorsCommand.setNewSourceTerminal("(0,0.5){L}");
- } else if (pt.y > 0.7) {
- rotateAnchorsCommand.setNewSourceTerminal("(1,0.5){R}");
- }
- } else {
- if (pt.x < 0.3) {
- rotateAnchorsCommand.setNewSourceTerminal("(0.5,0){T}");
- } else if (pt.x > 0.7) {
- rotateAnchorsCommand.setNewSourceTerminal("(0.5,1){D}");
- }
- }
- compositeCmd.add(rotateAnchorsCommand);
- }
- }
- }
- // execute command
- durationPart.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(compositeCmd));
- }
-
- private Rectangle getNewBounds(Rectangle bounds) {
- Point p = bounds.getCenter();
- return new Rectangle(p.x - bounds.height / 2, p.y - bounds.width / 2, bounds.height, bounds.width);
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
index 530c165c78b..dcb3cddd04f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
@@ -27,7 +27,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpec
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomContinuationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDestructionOccurrenceSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomStateInvariantEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeConstraintLabelEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeObservationLabelEditPart;
@@ -96,7 +95,7 @@ public class PostEditPolicyProvider implements IEditPolicyProvider {
@Override
public void createEditPolicies(EditPart editPart) {
// Replace AppliedStereotypeCommentCreationEditPolicy to a custom one.
- if (editPart instanceof AbstractExecutionSpecificationEditPart || editPart instanceof CustomDestructionOccurrenceSpecificationEditPart || editPart instanceof CustomDurationConstraintEditPart || editPart instanceof CustomDurationConstraintEditPart
+ if (editPart instanceof AbstractExecutionSpecificationEditPart || editPart instanceof CustomDestructionOccurrenceSpecificationEditPart
|| editPart instanceof CustomStateInvariantEditPart || editPart instanceof CustomTimeConstraintLabelEditPart || editPart instanceof CustomTimeObservationLabelEditPart || editPart instanceof AbstractMessageEditPart
|| editPart instanceof GeneralOrderingEditPart || editPart instanceof CustomContinuationEditPart) {
editPart.installEditPolicy(AppliedStereotypeCommentEditPolicy.APPLIED_STEREOTYPE_COMMENT, new AppliedStereotypeCommentCreationEditPolicyEx());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java
index 90fed8a3295..c0a36098eb4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/service/DurationCreationTool.java
@@ -464,47 +464,6 @@ public class DurationCreationTool extends AspectUnspecifiedTypeCreationTool {
return null;
}
Request req = getTargetRequest();
- /*
- * if(targetPart instanceof ConnectionNodeEditPart) {
- * // a message part is targeted. Instead, we must take the nearby lifeline part.
- * // redirect to the message part will be performed later in case we really want to draw a duration on a message
- * ConnectionNodeEditPart conn = (ConnectionNodeEditPart)targetPart;
- * EditPart source = ((ConnectionNodeEditPart)targetPart).getSource();
- * EditPart target = ((ConnectionNodeEditPart)targetPart).getTarget();
- * if(source instanceof NodeEditPart && target instanceof NodeEditPart) {
- * ConnectionAnchor sourceAnch = ((NodeEditPart)source).getSourceConnectionAnchor(conn);
- * ConnectionAnchor targetAnch = ((NodeEditPart)target).getSourceConnectionAnchor(conn);
- * double sourceDist = getLocation().getDistance(sourceAnch.getReferencePoint());
- * double targetDist = getLocation().getDistance(targetAnch.getReferencePoint());
- * if(sourceDist > targetDist) {
- * targetPart = target;
- * } else {
- * targetPart = source;
- * }
- * }
- * }
- * LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(targetPart);
- * if(lifelinePart instanceof LifelineEditPart) {
- * Object paramOcc1 = req.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION);
- * List<OccurrenceSpecification> occ1List = SequenceUtil.getAsOccSpecList(paramOcc1);
- * Object paramOcc2 = req.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2);
- * List<OccurrenceSpecification> occ2List = SequenceUtil.getAsOccSpecList(paramOcc2);
- * if(!occ1List.isEmpty() && !occ2List.isEmpty() && Collections.disjoint(occ1List, occ2List)) {
- * OccurrenceSpecification[] pair = SequenceUtil.getPairOfCorrespondingOccSpec(occ1List, occ2List);
- * if(pair != null && pair.length > 1) {
- * OccurrenceSpecification occ1 = pair[0];
- * OccurrenceSpecification occ2 = pair[1];
- * if(DurationConstraintHelper.endsOfSameMessage(occ1, occ2)) {
- * // call request on the link
- * EditPart part = SequenceUtil.getLinkedEditPart(lifelinePart, occ2);
- * if(part != null) {
- * return part.getCommand(req);
- * }
- * }
- * }
- * }
- * }
- */
if (targetPart instanceof InteractionInteractionCompartmentEditPart || targetPart instanceof ConnectionNodeEditPart) {
return targetPart.getCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LinkRouteModelElementFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LinkRouteModelElementFactory.java
deleted file mode 100644
index 7408f80110a..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LinkRouteModelElementFactory.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2014 CEA and others
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- * Christian W. Damus (CEA) - bug 417409
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.databinding.observable.Diffs;
-import org.eclipse.core.databinding.observable.IObservable;
-import org.eclipse.core.databinding.observable.value.ValueDiff;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.infra.properties.contexts.DataContextElement;
-import org.eclipse.papyrus.infra.properties.ui.modelelement.AnnotationModelElement;
-import org.eclipse.papyrus.infra.properties.ui.modelelement.AnnotationModelElementFactory;
-import org.eclipse.papyrus.infra.ui.emf.databinding.AnnotationObservableValue;
-import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-
-public class LinkRouteModelElementFactory extends AnnotationModelElementFactory {
-
- public static final String STYLE = "style";
-
- public static final String ROUTING = "routing";
-
- public static final String MANUAL = "Manual";
-
- public static final String AUTOMATIC = "Automatic";
-
- public static final Map<Object, LinkRouteModelElement> elements = new HashMap<>();
-
- @Override
- protected AnnotationModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
- View view = NotationHelper.findView(sourceElement);
- if (view != null && view instanceof Edge) {
- EditingDomain domain = EMFHelper.resolveEditingDomain(view);
- LinkRouteModelElement m = new LinkRouteModelElement((Edge) view, domain);
- elements.put(view, m);
- return m;
- }
- return null;
- }
-
- public static LinkRouteModelElement getElement(Object sourceElement) {
- if (elements.get(sourceElement) == null) {
- View view = NotationHelper.findView(sourceElement);
- EditingDomain domain = EMFHelper.resolveEditingDomain(view);
- LinkRouteModelElement m = new LinkRouteModelElement((Edge) view, domain);
- elements.put(view, m);
- }
- return elements.get(sourceElement);
- }
-
- public static boolean isRoutingNotification(Notification event) {
- if (event.getNewValue() instanceof EAnnotation && LinkRouteModelElementFactory.ROUTING.equals(((EAnnotation) event.getNewValue()).getSource())) {
- return true;
- }
- return false;
- }
-
- public static String getRoutingStyle(View view) {
- EAnnotation ea = view.getEAnnotation(ROUTING);
- if (ea != null && ea.getDetails().containsKey(STYLE)) {
- return ea.getDetails().get(STYLE);
- }
- return AUTOMATIC;
- }
-
- public static boolean isAutomaticRouting(View view) {
- return AUTOMATIC.equalsIgnoreCase(getRoutingStyle(view));
- }
-
- public static void switchToManualRouting(View edge) {
- if (LinkRouteModelElementFactory.isAutomaticRouting(edge)) {
- LinkRouteModelElement element = LinkRouteModelElementFactory.getElement(edge);
- AnnotationObservableValue observable = (AnnotationObservableValue) element.getObservable(STYLE);
- observable.setValue(LinkRouteModelElementFactory.MANUAL);
- }
- }
-
- public static class LinkRouteModelElement extends AnnotationModelElement {
-
- public LinkRouteModelElement(Edge source, EditingDomain domain) {
- super(source, domain, ROUTING);
- }
-
- @Override
- public IStaticContentProvider getContentProvider(String propertyPath) {
- if (propertyPath.equals(STYLE)) {
- return new AbstractStaticContentProvider() {
-
- @Override
- public Object[] getElements() {
- return new String[] { AUTOMATIC, MANUAL };
- }
-
- };
- }
- return EmptyContentProvider.instance;
- }
-
- @Override
- public ILabelProvider getLabelProvider(String propertyPath) {
- return new org.eclipse.jface.viewers.LabelProvider();
- }
-
- @Override
- public IObservable doGetObservable(String propertyPath) {
- return new AnnotationObservableValue(source, domain, ROUTING, STYLE) {
-
- @Override
- protected Command getCommand(final Object value) {
- return new CreateEAnnotationCommand((TransactionalEditingDomain) domain, source, ROUTING) {
-
- @Override
- protected void doExecute() {
- EAnnotation annotation = createEAnnotation();
- replaceEannotation(annotation, getObject());
- replaceEntry(annotation, STYLE, value == null ? "" : value.toString());
- }
- };
- }
-
- @Override
- protected Object doGetValue() {
- Object value = super.doGetValue();
- if (value == null) {
- return AUTOMATIC;
- }
- return value;
- }
-
- @Override
- protected void doSetValue(Object value) {
- Object oldValue = doGetValue();
-
- Command emfCommand = getCommand(value);
- if (emfCommand != null) {
- domain.getCommandStack().execute(emfCommand);
- }
- ValueDiff createValueDiff = Diffs.createValueDiff(oldValue, value);
- fireValueChange(createValueDiff);
- }
- };
- }
-
- @Override
- public boolean forceRefresh(String propertyPath) {
- return true;
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
index d9429add8b7..064a0d2dacc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
@@ -31,7 +31,6 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
@@ -49,18 +48,14 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ObservationLinkEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart;
@@ -516,16 +511,6 @@ public class OccurrenceSpecificationMoveHelper {
newBounds = new Rectangle(referencePoint2.x, Math.min(top, bottom), -1, Math.abs(bottom - top));
}
}
- if (newBounds != null) {
- TransactionalEditingDomain editingDomain = timePart.getEditingDomain();
- if (timePart instanceof CustomDurationConstraintEditPart) {
- CustomDurationConstraintEditPart dcep = (CustomDurationConstraintEditPart) timePart;
- newBounds = dcep.updateMoveBounds(newBounds);
- }
- // return the resize command
- ICommandProxy resize = new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) timePart.getModel()), newBounds));
- return resize;
- }
return null;
}
@@ -1119,7 +1104,7 @@ public class OccurrenceSpecificationMoveHelper {
if (timeElement instanceof TimeObservation) {
NamedElement occurence = ((TimeObservation) timeElement).getEvent();
occurrences = Collections.singletonList(occurence);
- } else if (timeElement instanceof TimeConstraint || timeElement instanceof DurationConstraint) {
+ } else if (timeElement instanceof TimeConstraint) {
occurrences = ((IntervalConstraint) timeElement).getConstrainedElements();
}
// check whether one of the time occurrences correspond to a DestructionEvent
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
index 30b1e48a67c..4c47a5dc6c2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
@@ -86,7 +86,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
@@ -122,7 +121,6 @@ import org.eclipse.uml2.common.util.CacheAdapter;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Continuation;
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
import org.eclipse.uml2.uml.ExecutionSpecification;
@@ -829,32 +827,6 @@ public class SequenceUtil {
} else {
return PositionConstants.NONE;
}
- } else if (timeElement instanceof DurationConstraint) {
- if (((DurationConstraint) timeElement).getConstrainedElements().contains(occSpec)) {
- List<Element> events = ((DurationConstraint) timeElement).getConstrainedElements();
- LifelineEditPart lifelinePart = getParentLifelinePart(timeElementPart);
- if (lifelinePart != null && events.size() >= 2) {
- OccurrenceSpecification otherEvent = null;
- if (!occSpec.equals(events.get(0)) && events.get(0) instanceof OccurrenceSpecification) {
- otherEvent = (OccurrenceSpecification) events.get(0);
- } else if (!occSpec.equals(events.get(1)) && events.get(1) instanceof OccurrenceSpecification) {
- otherEvent = (OccurrenceSpecification) events.get(1);
- }
- if (otherEvent != null) {
- Point otherLoc = findLocationOfEvent(lifelinePart, otherEvent);
- Point thisLoc = findLocationOfEvent(lifelinePart, occSpec);
- if (otherLoc != null && thisLoc != null) {
- if (otherLoc.y > thisLoc.y) {
- return PositionConstants.TOP;
- } else {
- return PositionConstants.BOTTOM;
- }
- }
- }
- }
- } else {
- return PositionConstants.NONE;
- }
}
return PositionConstants.NONE;
}
@@ -1732,9 +1704,6 @@ public class SequenceUtil {
if (editPart instanceof LifelineEditPart || editPart instanceof TimeObservationLabelEditPart) {
editPart.installEditPolicy(editPolicy, new ObservationLinkPolicy(editPart));
}
- if (editPart instanceof DurationObservationEditPart) {
- editPart.installEditPolicy(editPolicy, new ObservationLinkPolicy(editPart));
- }
if (editPart instanceof MessageSyncEditPart || editPart instanceof MessageAsyncEditPart || editPart instanceof MessageReplyEditPart || editPart instanceof MessageCreateEditPart || editPart instanceof MessageDeleteEditPart
|| editPart instanceof MessageLostEditPart
|| editPart instanceof MessageFoundEditPart) {

Back to the top