diff options
59 files changed, 88 insertions, 11011 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF index 4294ef024c9..c4d23b7344f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF @@ -15,7 +15,7 @@ Bundle-ClassPath: . Bundle-Name: %pluginName Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibility:=reexport, +Require-Bundle: org.eclipse.ui.navigator;visibility:=reexport;bundle-version="[3.6.0,4.0.0)", org.eclipse.ui.navigator.resources;bundle-version="[3.5.0,4.0.0)", org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)", org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide;bundle-version="[1.7.0,2.0.0)", @@ -25,10 +25,10 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili org.eclipse.gmf.runtime.diagram.ui.providers.ide;bundle-version="[1.7.0,2.0.0)", org.eclipse.papyrus.uml.service.types;bundle-version="[4.0.0,5.0.0)", org.eclipse.papyrus.uml.appearance;bundle-version="[2.0.0,3.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, - org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, - org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport, - org.eclipse.emf.validation;bundle-version="[1.8.0,2.0.0)";visibility:=reexport, + org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12.0,3.0.0)", + org.eclipse.emf.ecore;visibility:=reexport;bundle-version="[2.12.0,3.0.0)", + org.eclipse.emf.ecore.edit;visibility:=reexport;bundle-version="[2.9.0,3.0.0)", + org.eclipse.emf.validation;visibility:=reexport;bundle-version="[1.8.0,2.0.0)", org.eclipse.papyrus.infra.gmfdiag.hyperlink;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)", org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)", @@ -53,8 +53,8 @@ Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibili org.eclipse.gmf.runtime.diagram.ui.properties, org.eclipse.gmf.runtime.diagram.ui.providers, org.eclipse.gmf.runtime.diagram.ui.resources.editor, - org.eclipse.uml2.uml;bundle-version="[5.3.0,6.0.0)";visibility:=reexport, - org.eclipse.uml2.uml.edit;bundle-version="[5.3.0,6.0.0)";visibility:=reexport, + org.eclipse.uml2.uml;visibility:=reexport;bundle-version="[5.3.0,6.0.0)", + org.eclipse.uml2.uml.edit;visibility:=reexport;bundle-version="[5.3.0,6.0.0)", org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport, org.eclipse.gef, org.eclipse.papyrus.extensionpoints.editors;bundle-version="[3.0.0,4.0.0)", 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) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen index 4422b7f4bef..8df0c765622 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen @@ -155,7 +155,7 @@ itemSemanticEditPolicyClassName="CombinedFragmentItemSemanticEditPolicy" notationViewFactoryClassName="CombinedFragmentViewFactory" canonicalEditPolicyClassName="CombinedFragmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.17" + childNodes="/0/@diagram/@childNodes.14" compartments="/0/@diagram/@compartments.1" graphicalNodeEditPolicyClassName="CombinedFragmentGraphicalNodeEditPolicy" createCommandClassName="CombinedFragmentCreateCommand" @@ -247,7 +247,7 @@ itemSemanticEditPolicyClassName="InteractionUseItemSemanticEditPolicy" notationViewFactoryClassName="InteractionUseViewFactory" canonicalEditPolicyClassName="InteractionUseCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.17" + childNodes="/0/@diagram/@childNodes.14" graphicalNodeEditPolicyClassName="InteractionUseGraphicalNodeEditPolicy" createCommandClassName="InteractionUseCreateCommand" containers="/0/@diagram/@childNodes.2 /0/@diagram/@compartments.0"> @@ -388,7 +388,7 @@ itemSemanticEditPolicyClassName="LifelineItemSemanticEditPolicy" notationViewFactoryClassName="LifelineViewFactory" canonicalEditPolicyClassName="LifelineCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12" + childNodes="/0/@diagram/@childNodes.6 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11" graphicalNodeEditPolicyClassName="LifelineGraphicalNodeEditPolicy" createCommandClassName="LifelineCreateCommand" containers="/0/@diagram/@compartments.0"> @@ -635,7 +635,7 @@ getterName="getInvariantFigure" figureQualifiedClassName="org.eclipse.draw2d.IFigure"/> <modelFacet - parser="/0/@labelParsers/@implementations.10"/> + parser="/0/@labelParsers/@implementations.9"/> </labels> </childNodes> <childNodes @@ -702,7 +702,7 @@ xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.figures.MultilineLabelFigure"/> <modelFacet - parser="/0/@labelParsers/@implementations.7"/> + parser="/0/@labelParsers/@implementations.6"/> </labels> <labels xsi:type="gmfgen:GenExternalNodeLabel" @@ -726,7 +726,7 @@ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> </childNodes> <childNodes @@ -782,7 +782,7 @@ xsi:type="gmfgen:FigureViewmap" figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.figures.MultilineLabelFigure"/> <modelFacet - parser="/0/@labelParsers/@implementations.8"/> + parser="/0/@labelParsers/@implementations.7"/> </labels> <labels xsi:type="gmfgen:GenExternalNodeLabel" @@ -806,102 +806,7 @@ key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> - </labels> - </childNodes> - <childNodes - xsi:type="gmfgen:GenChildSideAffixedNode" - visualID="3021" - editPartClassName="DurationConstraintEditPart" - itemSemanticEditPolicyClassName="DurationConstraintItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintViewFactory" - canonicalEditPolicyClassName="DurationConstraintCanonicalEditPolicy" - graphicalNodeEditPolicyClassName="DurationConstraintGraphicalNodeEditPolicy" - createCommandClassName="DurationConstraintCreateCommand" - containers="/0/@diagram/@childNodes.5"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <elementType - xsi:type="gmfgen:MetamodelType" - uniqueIdentifier="org.eclipse.papyrus.umldi.DurationConstraint_Shape" - definedExternally="true" - editHelperClassName="DurationConstraintEditHelper"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.figures.DurationConstraintFigure"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy.KEY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy"/> - <modelFacet> - <metaClass - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationConstraint"/> - <containmentMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/> - <childMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/> - <modelElementInitializer - xsi:type="gmfgen:GenFeatureSeqInitializer"> - <initializers - xsi:type="gmfgen:GenReferenceNewElementSpec"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/> - <newElementInitializers> - <initializers - xsi:type="gmfgen:GenFeatureValueSpec" - value="/0/@expressionProviders/@providers.0/@expressions.11"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> - </initializers> - <elementClass - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationInterval"/> - </newElementInitializers> - </initializers> - <initializers - xsi:type="gmfgen:GenFeatureValueSpec" - value="/0/@expressionProviders/@providers.0/@expressions.12"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> - </initializers> - </modelElementInitializer> - </modelFacet> - <labels - xsi:type="gmfgen:GenExternalNodeLabel" - visualID="5011" - editPartClassName="DurationConstraintLabelEditPart" - itemSemanticEditPolicyClassName="DurationConstraintLabelItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintLabelViewFactory"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.figures.MultilineLabelFigure"/> - <modelFacet - parser="/0/@labelParsers/@implementations.7"/> - </labels> - <labels - xsi:type="gmfgen:GenExternalNodeLabel" - visualID="5015" - editPartClassName="DurationConstraintAppliedStereotypeEditPart" - itemSemanticEditPolicyClassName="DurationConstraintAppliedStereotypeItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintLabelViewFactory" - readOnly="true" - elementIcon="true"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"> - <attributes - xsi:type="gmfgen:LabelOffsetAttributes" - y="-22"/> - </viewmap> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> - <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> </childNodes> <childNodes @@ -1024,7 +929,7 @@ getterName="getConstraintFigure" figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.ConstraintFigure"/> <modelFacet - parser="/0/@labelParsers/@implementations.10"/> + parser="/0/@labelParsers/@implementations.9"/> </labels> </childNodes> <childNodes @@ -1096,204 +1001,6 @@ </labels> </childNodes> <childNodes - visualID="3023" - editPartClassName="DurationConstraintInMessageEditPart" - itemSemanticEditPolicyClassName="DurationConstraintInMessageItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintViewFactory" - canonicalEditPolicyClassName="DurationConstraintInMessageCanonicalEditPolicy" - graphicalNodeEditPolicyClassName="DurationConstraintInMessageGraphicalNodeEditPolicy" - createCommandClassName="DurationConstraintInMessageCreateCommand" - containers="/0/@diagram/@topLevelNodes.0"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <elementType - xsi:type="gmfgen:SpecializationType" - uniqueIdentifier="org.eclipse.papyrus.umldi.DurationConstraint_Shape_CN" - definedExternally="true" - metamodelType="/0/@diagram/@childNodes.11/@elementType"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.COMPONENT_ROLE" - editPolicyQualifiedClassName="org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MoveableNonResizableLabelEditPolicy"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy.KEY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy"/> - <modelFacet> - <metaClass - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationConstraint"/> - <containmentMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/> - <childMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Namespace/ownedRule"/> - <modelElementInitializer - xsi:type="gmfgen:GenFeatureSeqInitializer"> - <initializers - xsi:type="gmfgen:GenReferenceNewElementSpec"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Constraint/specification"/> - <newElementInitializers> - <initializers - xsi:type="gmfgen:GenFeatureValueSpec" - value="/0/@expressionProviders/@providers.0/@expressions.15"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> - </initializers> - <elementClass - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationInterval"/> - </newElementInitializers> - </initializers> - <initializers - xsi:type="gmfgen:GenFeatureValueSpec" - value="/0/@expressionProviders/@providers.0/@expressions.16"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> - </initializers> - </modelElementInitializer> - </modelFacet> - <labels - visualID="5018" - editPartClassName="DurationConstraintInMessageLabelEditPart" - itemSemanticEditPolicyClassName="DurationConstraintInMessageLabelItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintLabelViewFactory"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:ParentAssignedViewmap" - getterName="getNameLabel" - figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy"/> - <modelFacet - parser="/0/@labelParsers/@implementations.7"/> - </labels> - <labels - xsi:type="gmfgen:GenExternalNodeLabel" - visualID="5019" - editPartClassName="DurationConstraintInMessageAppliedStereotypeEditPart" - itemSemanticEditPolicyClassName="DurationConstraintInMessageAppliedStereotypeItemSemanticEditPolicy" - notationViewFactoryClassName="DurationConstraintLabelViewFactory" - readOnly="true" - elementIcon="true"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"> - <attributes - xsi:type="gmfgen:LabelOffsetAttributes" - y="-22"/> - </viewmap> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> - <modelFacet - parser="/0/@labelParsers/@implementations.9"/> - </labels> - </childNodes> - <childNodes - visualID="3024" - editPartClassName="DurationObservationEditPart" - itemSemanticEditPolicyClassName="DurationObservationItemSemanticEditPolicy" - notationViewFactoryClassName="DurationObservationViewFactory" - canonicalEditPolicyClassName="DurationObservationCanonicalEditPolicy" - graphicalNodeEditPolicyClassName="DurationObservationGraphicalNodeEditPolicy" - createCommandClassName="DurationObservationCreateCommand" - containers="/0/@diagram/@compartments.0"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <elementType - xsi:type="gmfgen:MetamodelType" - uniqueIdentifier="org.eclipse.papyrus.umldi.DurationObservation_Shape" - definedExternally="true" - editHelperClassName="DurationObservationEditHelper"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.COMPONENT_ROLE" - editPolicyQualifiedClassName="org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MoveableNonResizableLabelEditPolicy"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy.KEY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy"/> - <modelFacet> - <metaClass - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DurationObservation"/> - <containmentMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> - <childMetaFeature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> - <modelElementInitializer - xsi:type="gmfgen:GenFeatureSeqInitializer"> - <initializers - xsi:type="gmfgen:GenFeatureValueSpec" - value="/0/@expressionProviders/@providers.0/@expressions.17"> - <feature - href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> - </initializers> - </modelElementInitializer> - </modelFacet> - <labels - visualID="5016" - editPartClassName="DurationObservationLabelEditPart" - itemSemanticEditPolicyClassName="DurationObservationLabelItemSemanticEditPolicy" - notationViewFactoryClassName="DurationObservationLabelViewFactory" - elementIcon="true"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:ParentAssignedViewmap" - getterName="getNameLabel" - figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy"/> - <modelFacet - parser="/0/@labelParsers/@implementations.6"/> - </labels> - <labels - xsi:type="gmfgen:GenExternalNodeLabel" - visualID="5017" - editPartClassName="DurationObservationAppliedStereotypeEditPart" - itemSemanticEditPolicyClassName="DurationObservationAppliedStereotypeItemSemanticEditPolicy" - notationViewFactoryClassName="DurationObservationLabelViewFactory" - readOnly="true" - elementIcon="true"> - <diagramRunTimeClass - href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> - <viewmap - xsi:type="gmfgen:FigureViewmap" - figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"> - <attributes - xsi:type="gmfgen:LabelOffsetAttributes" - y="-22"/> - </viewmap> - <behaviour - xsi:type="gmfgen:CustomBehaviour" - key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" - editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy"/> - <modelFacet - parser="/0/@labelParsers/@implementations.9"/> - </labels> - </childNodes> - <childNodes xsi:type="gmfgen:GenChildSideAffixedNode" visualID="3025" editPartClassName="GateEditPart" @@ -1358,7 +1065,7 @@ itemSemanticEditPolicyClassName="InteractionItemSemanticEditPolicy" notationViewFactoryClassName="InteractionViewFactory" canonicalEditPolicyClassName="InteractionCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17" + childNodes="/0/@diagram/@childNodes.14" compartments="/0/@diagram/@compartments.0" graphicalNodeEditPolicyClassName="InteractionGraphicalNodeEditPolicy" createCommandClassName="InteractionCreateCommand"> @@ -1514,7 +1221,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.2" @@ -1605,7 +1312,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.22" @@ -1696,7 +1403,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.8" @@ -1788,7 +1495,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.11" @@ -1879,7 +1586,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.14" @@ -1971,7 +1678,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.22" @@ -2062,7 +1769,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> <creationConstraints sourceEnd="/0/@expressionProviders/@providers.1/@expressions.20" @@ -2174,7 +1881,7 @@ y="-33"/> </viewmap> <modelFacet - parser="/0/@labelParsers/@implementations.9"/> + parser="/0/@labelParsers/@implementations.8"/> </labels> </links> <links @@ -2230,7 +1937,7 @@ itemSemanticEditPolicyClassName="InteractionInteractionCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="InteractionInteractionCompartmentViewFactory" canonicalEditPolicyClassName="InteractionInteractionCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.16" + childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13" title="InteractionCompartment" canCollapse="false" needsTitle="false" @@ -2313,7 +2020,7 @@ <plugin iD="org.eclipse.papyrus.uml.diagram.sequence" provider="CEA" - version="4.0.0.qualifier"> + version="5.1.0.qualifier"> <requiredPlugins>org.eclipse.draw2d</requiredPlugins> <requiredPlugins>org.eclipse.papyrus.uml.diagram.common</requiredPlugins> <requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins> @@ -2472,7 +2179,7 @@ uses="/0/@diagram/@links.10/@labels.0/@modelFacet"/> <implementations xsi:type="gmfgen:PredefinedParser" - uses="/0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@childNodes.17/@labels.0/@modelFacet"/> + uses="/0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet"/> <implementations xsi:type="gmfgen:CustomParser" uses="/0/@diagram/@childNodes.5/@labels.0/@modelFacet" @@ -2487,15 +2194,11 @@ qualifiedName=" org.eclipse.papyrus.uml.diagram.sequence.parser.custom.MessageCustomParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.14/@labels.0/@modelFacet" + uses="/0/@diagram/@childNodes.13/@labels.0/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.CommentParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.16/@labels.0/@modelFacet" - qualifiedName="org.eclipse.papyrus.uml.diagram.sequence.parser.custom.DurationObservationParser"/> - <implementations - xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.11/@labels.0/@modelFacet /0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet" + uses="/0/@diagram/@childNodes.9/@labels.0/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.sequence.parser.custom.TimeConstraintParser"/> <implementations xsi:type="gmfgen:CustomParser" @@ -2503,11 +2206,11 @@ qualifiedName="org.eclipse.papyrus.uml.diagram.sequence.parser.custom.TimeObservationParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@links.2/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@links.9/@labels.0/@modelFacet /0/@diagram/@links.1/@labels.1/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet /0/@diagram/@links.0/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@links.6/@labels.1/@modelFacet /0/@diagram/@links.5/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.1/@modelFacet /0/@diagram/@links.4/@labels.1/@modelFacet" + uses="/0/@diagram/@links.2/@labels.1/@modelFacet /0/@diagram/@links.9/@labels.0/@modelFacet /0/@diagram/@links.1/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@links.0/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@links.6/@labels.1/@modelFacet /0/@diagram/@links.5/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.1/@modelFacet /0/@diagram/@links.4/@labels.1/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet" + uses="/0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.ConstraintParser"/> </labelParsers> <contextMenus @@ -2545,28 +2248,28 @@ xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Affixed locator for Lifelines to place element with a time bar" classpath="org.eclipse.papyrus.uml.diagram.sequence.locator.CenterLocator" - genChildSideAffixedNode="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11"/> + genChildSideAffixedNode="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Specific locator for the itemBorder of the lifeline." classpath="org.eclipse.papyrus.uml.diagram.sequence.locator.CenterLocator" - genChildSideAffixedNode="/0/@diagram/@childNodes.12 /0/@diagram/@childNodes.8"/> + genChildSideAffixedNode="/0/@diagram/@childNodes.11 /0/@diagram/@childNodes.8"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="this is an extension to manage the comment" - genView="/0/@diagram/@childNodes.14" + genView="/0/@diagram/@childNodes.13" name="comment extended node" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="ConstraintEditPart extension" - genView="/0/@diagram/@childNodes.13" + genView="/0/@diagram/@childNodes.12" name="ConstraintEditPart extension" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractConstraintEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService" comment="" - genView="/0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.6 /0/@diagram/@links.0 /0/@diagram/@links.1 /0/@diagram/@links.2 /0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.12 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.0"/> + genView="/0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.6 /0/@diagram/@links.0 /0/@diagram/@links.1 /0/@diagram/@links.2 /0/@diagram/@links.3 /0/@diagram/@links.4 /0/@diagram/@links.5 /0/@diagram/@links.6 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.11 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.0"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="Add custom super class for Message EditParts" @@ -2594,7 +2297,7 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="Add extension of PapyrusLabelEditPart" - genView="/0/@diagram/@childNodes.11/@labels.0 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0" + genView="/0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0" name="PapyrusLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart"/> <extensionNodes @@ -2607,16 +2310,16 @@ xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel" comment="specific locator to move Gate name" classpath="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" - genExternalNodeLabel="/0/@diagram/@childNodes.17/@labels.0"/> + genExternalNodeLabel="/0/@diagram/@childNodes.14/@labels.0"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocator" comment="specific locator to move gates" classpath="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator" - genChildSideAffixedNode="/0/@diagram/@childNodes.17"/> + genChildSideAffixedNode="/0/@diagram/@childNodes.14"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="add superclass for floating Label" - genView="/0/@diagram/@childNodes.17/@labels.0" + genView="/0/@diagram/@childNodes.14/@labels.0" name="FloatingLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/> <extensionNodes @@ -2625,7 +2328,7 @@ role="Name" iconPathRole="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/label_role/name.png" linkLabels="/0/@diagram/@links.0/@labels.0 /0/@diagram/@links.1/@labels.0 /0/@diagram/@links.2/@labels.0 /0/@diagram/@links.3/@labels.0 /0/@diagram/@links.4/@labels.0 /0/@diagram/@links.5/@labels.0 /0/@diagram/@links.6/@labels.0" - externalNodeLabels="/0/@diagram/@childNodes.17/@labels.0"/> + externalNodeLabels="/0/@diagram/@childNodes.14/@labels.0"/> <extensionNodes xsi:type="papyrusgmfgenextension:LabelVisibilityPreference" comment="Stereotype" @@ -2635,7 +2338,7 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="precise the super class of the GateEditPart" - genView="/0/@diagram/@childNodes.17" + genView="/0/@diagram/@childNodes.14" name="GateEditPart superclass" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedBorderNamedElementEditPart"/> </papyrusgmfgenextension:PapyrusExtensionRootNode> @@ -2681,16 +2384,6 @@ </child> <child genView="/0/@diagram/@childNodes.11" - visualID="DurationConstraint_Shape"> - <child - genView="/0/@diagram/@childNodes.11/@labels.0" - visualID="DurationConstraint_BodyLabel"/> - <child - genView="/0/@diagram/@childNodes.11/@labels.1" - visualID="DurationConstraint_StereotypeLabel"/> - </child> - <child - genView="/0/@diagram/@childNodes.12" visualID="DestructionOccurrenceSpecification_Shape"/> <child genView="/0/@diagram/@childNodes.0" @@ -2727,43 +2420,23 @@ <child visualID="CombinedFragment_CoRegionShape"/> <child - genView="/0/@diagram/@childNodes.13" + genView="/0/@diagram/@childNodes.12" visualID="Constraint_Shape"> <child - genView="/0/@diagram/@childNodes.13/@labels.0" + genView="/0/@diagram/@childNodes.12/@labels.0" visualID="Constraint_NameLabel"/> <child - genView="/0/@diagram/@childNodes.13/@labels.1" + genView="/0/@diagram/@childNodes.12/@labels.1" visualID="Constraint_BodyLabel"/> </child> <child - genView="/0/@diagram/@childNodes.14" + genView="/0/@diagram/@childNodes.13" visualID="Comment_Shape"> <child - genView="/0/@diagram/@childNodes.14/@labels.0" + genView="/0/@diagram/@childNodes.13/@labels.0" visualID="Comment_BodyLabel"/> </child> <child - genView="/0/@diagram/@childNodes.15" - visualID="DurationConstraint_Shape_CN"> - <child - genView="/0/@diagram/@childNodes.15/@labels.0" - visualID="DurationConstraint_BodyLabel_CN"/> - <child - genView="/0/@diagram/@childNodes.15/@labels.1" - visualID="DurationConstraint_StereotypeLabel_CN"/> - </child> - <child - genView="/0/@diagram/@childNodes.16" - visualID="DurationObservation_Shape"> - <child - genView="/0/@diagram/@childNodes.16/@labels.0" - visualID="DurationObservation_NameLabel"/> - <child - genView="/0/@diagram/@childNodes.16/@labels.1" - visualID="DurationObservation_StereotypeLabel"/> - </child> - <child genView="/0/@diagram/@compartments.0" visualID="Interaction_SubfragmentCompartment"/> <child @@ -2867,10 +2540,10 @@ visualID="Constraint_KeywordLabel"/> </child> <child - genView="/0/@diagram/@childNodes.17" + genView="/0/@diagram/@childNodes.14" visualID="Gate_Shape"> <child - genView="/0/@diagram/@childNodes.17/@labels.0" + genView="/0/@diagram/@childNodes.14/@labels.0" visualID="Gate_NameLabel"/> </child> </papyrusgmfgenextension:VisualIDOverride> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml index b77bce0dd9b..f19a91abcca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml @@ -135,7 +135,7 @@ <viewProvider class="org.eclipse.papyrus.uml.diagram.sequence.providers.UMLViewProvider"> <Priority name="Lowest"/> <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLSequenceDiagram"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="Interaction_Shape,ConsiderIgnoreFragment_Shape,CombinedFragment_Shape,InteractionOperand_Shape,InteractionUse_Shape,Continuation_Shape,Lifeline_Shape,ActionExecutionSpecification_Shape,BehaviorExecutionSpecification_Shape,StateInvariant_Shape,TimeConstraint_Shape,TimeObservation_Shape,DurationConstraint_Shape,DestructionOccurrenceSpecification_Shape,Constraint_Shape,Comment_Shape,DurationConstraint_Shape_CN,DurationObservation_Shape,Gate_Shape"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="Interaction_Shape,ConsiderIgnoreFragment_Shape,CombinedFragment_Shape,InteractionOperand_Shape,InteractionUse_Shape,Continuation_Shape,Lifeline_Shape,ActionExecutionSpecification_Shape,BehaviorExecutionSpecification_Shape,StateInvariant_Shape,TimeConstraint_Shape,TimeObservation_Shape,DestructionOccurrenceSpecification_Shape,Constraint_Shape,Comment_Shape,Gate_Shape"/> <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="Message_SynchEdge,Message_AsynchEdge,Message_ReplyEdge,Message_CreateEdge,Message_DeleteEdge,Message_LostEdge,Message_FoundEdge,Comment_AnnotatedElementEdge,Constraint_ConstrainedElementEdge,GeneralOrdering_Edge,Constraint_ContextEdge"/> </viewProvider> </extension> @@ -148,13 +148,13 @@ <method name="getType()" value="PapyrusUMLSequenceDiagram"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="Interaction_Shape,ConsiderIgnoreFragment_Shape,CombinedFragment_Shape,InteractionOperand_Shape,InteractionUse_Shape,Continuation_Shape,Lifeline_Shape,ActionExecutionSpecification_Shape,BehaviorExecutionSpecification_Shape,StateInvariant_Shape,TimeConstraint_Shape,TimeObservation_Shape,DurationConstraint_Shape,DestructionOccurrenceSpecification_Shape,Constraint_Shape,Comment_Shape,DurationConstraint_Shape_CN,DurationObservation_Shape,Gate_Shape"/> + <method name="getType()" value="Interaction_Shape,ConsiderIgnoreFragment_Shape,CombinedFragment_Shape,InteractionOperand_Shape,InteractionUse_Shape,Continuation_Shape,Lifeline_Shape,ActionExecutionSpecification_Shape,BehaviorExecutionSpecification_Shape,StateInvariant_Shape,TimeConstraint_Shape,TimeObservation_Shape,DestructionOccurrenceSpecification_Shape,Constraint_Shape,Comment_Shape,Gate_Shape"/> </object> <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> <method name="getType()" value="Message_SynchEdge,Message_AsynchEdge,Message_ReplyEdge,Message_CreateEdge,Message_DeleteEdge,Message_LostEdge,Message_FoundEdge,Comment_AnnotatedElementEdge,Constraint_ConstrainedElementEdge,GeneralOrdering_Edge,Constraint_ContextEdge"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="Interaction_NameLabel,InteractionUse_NameLabel,InteractionUse_TypeLabel,Continuation_NameLabel,Lifeline_NameLabel,StateInvariant_NameLabel,StateInvariant_ConstraintLabel,TimeConstraint_ConstraintLabel,TimeConstraint_StereotypeLabel,TimeObservation_NameLabel,TimeObservation_StereotypeLabel,DurationConstraint_BodyLabel,DurationConstraint_StereotypeLabel,Constraint_NameLabel,Constraint_BodyLabel,Comment_BodyLabel,DurationConstraint_BodyLabel_CN,DurationConstraint_StereotypeLabel_CN,DurationObservation_NameLabel,DurationObservation_StereotypeLabel,Gate_NameLabel"/> + <method name="getType()" value="Interaction_NameLabel,InteractionUse_NameLabel,InteractionUse_TypeLabel,Continuation_NameLabel,Lifeline_NameLabel,StateInvariant_NameLabel,StateInvariant_ConstraintLabel,TimeConstraint_ConstraintLabel,TimeConstraint_StereotypeLabel,TimeObservation_NameLabel,TimeObservation_StereotypeLabel,Constraint_NameLabel,Constraint_BodyLabel,Comment_BodyLabel,Gate_NameLabel"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> <method name="getType()" value="Interaction_SubfragmentCompartment,CombinedFragment_SubfragmentCompartment"/> @@ -480,10 +480,6 @@ <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu"> <dynamic - class="org.eclipse.papyrus.uml.diagram.sequence.providers.DurationConstraintContributionItem" - id="org.eclipse.papyrus.sequence.duraitonconstraint.DynamicMenu"> - </dynamic> - <dynamic class="org.eclipse.papyrus.uml.diagram.sequence.providers.DisplayBehaviorContributionItem" id="org.eclipse.papyrus.uml.diagram.sequence.displayBehaviorMenu"> </dynamic> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContextLinkEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContextLinkEditPart.java index 60910738d20..ab893c787ca 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContextLinkEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ContextLinkEditPart.java @@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomAppliedStereotypeContextLinkLabelDisplayEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.figures.CustomContextLinkFigure; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintAppliedStereotypeEditPart.java deleted file mode 100644 index 7fa3a60a383..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintAppliedStereotypeEditPart.java +++ /dev/null @@ -1,856 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationConstraintAppliedStereotypeEditPart extends PapyrusLabelEditPart - implements ITextAwareEditPart, IBorderItemEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_StereotypeLabel"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - static { - registerSnapBackPosition(UMLVisualIDRegistry.getType( - org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintAppliedStereotypeEditPart.VISUAL_ID), - new Point(0, 0)); - } - - /** - * @generated - */ - public DurationConstraintAppliedStereotypeEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, - new AppliedStereotypeExternalNodeEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); - } - - /** - * @generated - */ - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * @generated - */ - @Override - public void refreshBounds() { - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString( - ParserUtil.getParserAdapter(getParserElement(), - DurationConstraintAppliedStereotypeEditPart.this), - (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationConstraint_Shape, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - // The label is read-only (defined in GMFGen model) - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - /** - * @generated - */ - protected IFigure createFigurePrim() { - return new AppliedStereotypeWrappingLabelFigure(); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintEditPart.java deleted file mode 100644 index 56b0f35ba68..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintEditPart.java +++ /dev/null @@ -1,256 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -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.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart; -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.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.figures.DurationConstraintFigure; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.swt.graphics.Color; - -/** - * @generated - */ -public class DurationConstraintEditPart extends BorderedBorderItemEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_Shape"; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public DurationConstraintEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(DeleteTimeElementWithoutEventPolicy.KEY, new DeleteTimeElementWithoutEventPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - 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(); - String vid = UMLVisualIDRegistry.getVisualID(childView); - if (vid != null) { - switch (vid) { - case DurationConstraintLabelEditPart.VISUAL_ID: - case DurationConstraintAppliedStereotypeEditPart.VISUAL_ID: - return new BorderItemSelectionEditPolicy() { - - @Override - protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - } - 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; - } - - /** - * @generated - */ - protected IFigure createNodeShape() { - return primaryShape = new DurationConstraintFigure(); - } - - /** - * org.eclipse.papyrus.uml.diagram.sequence.figures.DurationConstraintFigure - * org.eclipse.papyrus.uml.diagram.sequence.figures.DurationConstraintFigure - * - * @generated - */ - public DurationConstraintFigure getPrimaryShape() { - return (DurationConstraintFigure) primaryShape; - } - - /** - * @generated - */ - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if (borderItemEditPart instanceof DurationConstraintLabelEditPart - || borderItemEditPart instanceof DurationConstraintAppliedStereotypeEditPart) { - BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); - locator.setBorderItemOffset(new Dimension(-20, -20)); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else { - super.addBorderItem(borderItemContainer, borderItemEditPart); - } - } - - /** - * @generated - */ - protected NodeFigure createNodePlate() { - RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createMainFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated - */ - protected IFigure setupContentPane(IFigure nodeShape) { - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - if (primaryShape != null) { - primaryShape.setForegroundColor(color); - } - } - - /** - * @generated - */ - @Override - protected void setLineWidth(int width) { - super.setLineWidth(width); - } - - /** - * @generated - */ - @Override - protected void setLineType(int style) { - if (primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); - } - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry.getType(DurationConstraintLabelEditPart.VISUAL_ID)); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageAppliedStereotypeEditPart.java deleted file mode 100644 index d397b27deb5..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageAppliedStereotypeEditPart.java +++ /dev/null @@ -1,856 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationConstraintInMessageAppliedStereotypeEditPart extends PapyrusLabelEditPart - implements ITextAwareEditPart, IBorderItemEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_StereotypeLabel_CN"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - static { - registerSnapBackPosition(UMLVisualIDRegistry.getType( - org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID), - new Point(0, 0)); - } - - /** - * @generated - */ - public DurationConstraintInMessageAppliedStereotypeEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, - new AppliedStereotypeExternalNodeEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); - } - - /** - * @generated - */ - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * @generated - */ - @Override - public void refreshBounds() { - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString( - ParserUtil.getParserAdapter(getParserElement(), - DurationConstraintInMessageAppliedStereotypeEditPart.this), - (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationConstraint_Shape_CN, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - // The label is read-only (defined in GMFGen model) - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - /** - * @generated - */ - protected IFigure createFigurePrim() { - return new AppliedStereotypeWrappingLabelFigure(); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageEditPart.java deleted file mode 100644 index a80f94c1fd9..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageEditPart.java +++ /dev/null @@ -1,317 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -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.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MoveableNonResizableLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.swt.graphics.Color; - -/** - * @generated - */ -public class DurationConstraintInMessageEditPart extends NodeEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_Shape_CN"; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public DurationConstraintInMessageEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new MoveableNonResizableLabelEditPolicy()); - installEditPolicy(DeleteTimeElementWithoutEventPolicy.KEY, new DeleteTimeElementWithoutEventPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - 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(); - String vid = UMLVisualIDRegistry.getVisualID(childView); - if (vid != null) { - switch (vid) { - case DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID: - return new BorderItemSelectionEditPolicy() { - - @Override - protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - } - 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; - } - - /** - * @generated - */ - @Override - protected IFigure createNodeShape() { - return primaryShape = new RoundedCompartmentFigure(); - } - - /** - * org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure - * - * @generated - */ - @Override - public RoundedCompartmentFigure getPrimaryShape() { - return (RoundedCompartmentFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DurationConstraintInMessageLabelEditPart) { - ((DurationConstraintInMessageLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DurationConstraintInMessageLabelEditPart) { - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - return getContentPane(); - } - - /** - * @generated - */ - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if (borderItemEditPart instanceof DurationConstraintInMessageAppliedStereotypeEditPart) { - BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); - locator.setBorderItemOffset(new Dimension(-20, -20)); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else { - super.addBorderItem(borderItemContainer, borderItemEditPart); - } - } - - /** - * @generated - */ - @Override - protected NodeFigure createNodePlate() { - RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createMainFigure() { - return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); - - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated - */ - @Override - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(5); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - if (primaryShape != null) { - primaryShape.setForegroundColor(color); - } - } - - /** - * @generated - */ - @Override - protected void setLineWidth(int width) { - super.setLineWidth(width); - } - - /** - * @generated - */ - @Override - protected void setLineType(int style) { - if (primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); - } - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry.getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID)); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageLabelEditPart.java deleted file mode 100644 index a4e841dd1ad..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintInMessageLabelEditPart.java +++ /dev/null @@ -1,875 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationConstraintInMessageLabelEditPart extends PapyrusCompartmentEditPart - implements ITextAwareEditPart, IControlParserForDirectEdit { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_BodyLabel_CN"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - public DurationConstraintInMessageLabelEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - @Override - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString( - ParserUtil.getParserAdapter(getParserElement(), - DurationConstraintInMessageLabelEditPart.this), - (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationConstraint_Shape_CN, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - refreshLabel(); - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } - - /** - * @generated - */ - private static final String ADD_PARENT_MODEL = "AddParentModel"; - - /** - * @generated - */ - @Override - public void activate() { - super.activate(); - addOwnerElementListeners(); - } - - /** - * @generated - */ - protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); - - } - - /** - * @generated - */ - @Override - public void deactivate() { - removeOwnerElementListeners(); - super.deactivate(); - - } - - /** - * @generated - */ - protected void removeOwnerElementListeners() { - removeListenerFilter(ADD_PARENT_MODEL); - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintLabelEditPart.java deleted file mode 100644 index 3b437f5fd15..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationConstraintLabelEditPart.java +++ /dev/null @@ -1,859 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.figures.MultilineLabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationConstraintLabelEditPart extends PapyrusLabelEditPart - implements ITextAwareEditPart, IBorderItemEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationConstraint_BodyLabel"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - static { - registerSnapBackPosition( - UMLVisualIDRegistry.getType( - org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart.VISUAL_ID), - new Point(0, 0)); - } - - /** - * @generated - */ - public DurationConstraintLabelEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); - } - - /** - * @generated - */ - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * @generated - */ - @Override - public void refreshBounds() { - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult( - parser.isValidEditString(ParserUtil.getParserAdapter(getParserElement(), - DurationConstraintLabelEditPart.this), (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationConstraint_Shape, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - /** - * @generated - */ - protected IFigure createFigurePrim() { - return new MultilineLabelFigure(); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationAppliedStereotypeEditPart.java deleted file mode 100644 index a4ab73622fd..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationAppliedStereotypeEditPart.java +++ /dev/null @@ -1,856 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationObservationAppliedStereotypeEditPart extends PapyrusLabelEditPart - implements ITextAwareEditPart, IBorderItemEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationObservation_StereotypeLabel"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - static { - registerSnapBackPosition(UMLVisualIDRegistry.getType( - org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationObservationAppliedStereotypeEditPart.VISUAL_ID), - new Point(0, 0)); - } - - /** - * @generated - */ - public DurationObservationAppliedStereotypeEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, - new AppliedStereotypeExternalNodeEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); - } - - /** - * @generated - */ - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * @generated - */ - @Override - public void refreshBounds() { - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return false; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult(parser.isValidEditString( - ParserUtil.getParserAdapter(getParserElement(), - DurationObservationAppliedStereotypeEditPart.this), - (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationObservation_Shape, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - // The label is read-only (defined in GMFGen model) - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - /** - * @generated - */ - protected IFigure createFigurePrim() { - return new AppliedStereotypeWrappingLabelFigure(); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationEditPart.java deleted file mode 100644 index 57abb7ed4a4..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationEditPart.java +++ /dev/null @@ -1,317 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -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.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.DeleteTimeElementWithoutEventPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MoveableNonResizableLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; -import org.eclipse.swt.graphics.Color; - -/** - * @generated - */ -public class DurationObservationEditPart extends NodeEditPart { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationObservation_Shape"; - - /** - * @generated - */ - protected IFigure contentPane; - - /** - * @generated - */ - protected IFigure primaryShape; - - /** - * @generated - */ - public DurationObservationEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new MoveableNonResizableLabelEditPolicy()); - installEditPolicy(DeleteTimeElementWithoutEventPolicy.KEY, new DeleteTimeElementWithoutEventPolicy()); - // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); - } - - /** - * @generated - */ - 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(); - String vid = UMLVisualIDRegistry.getVisualID(childView); - if (vid != null) { - switch (vid) { - case DurationObservationAppliedStereotypeEditPart.VISUAL_ID: - return new BorderItemSelectionEditPolicy() { - - @Override - protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - } - 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; - } - - /** - * @generated - */ - @Override - protected IFigure createNodeShape() { - return primaryShape = new RoundedCompartmentFigure(); - } - - /** - * org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure - * - * @generated - */ - @Override - public RoundedCompartmentFigure getPrimaryShape() { - return (RoundedCompartmentFigure) primaryShape; - } - - /** - * @generated - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DurationObservationLabelEditPart) { - ((DurationObservationLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - - return false; - } - - /** - * @generated - */ - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DurationObservationLabelEditPart) { - return true; - } - return false; - } - - /** - * @generated - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * @generated - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * @generated - */ - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - return getContentPane(); - } - - /** - * @generated - */ - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if (borderItemEditPart instanceof DurationObservationAppliedStereotypeEditPart) { - BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); - locator.setBorderItemOffset(new Dimension(-20, -20)); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else { - super.addBorderItem(borderItemContainer, borderItemEditPart); - } - } - - /** - * @generated - */ - @Override - protected NodeFigure createNodePlate() { - RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40); - return result; - } - - /** - * Creates figure for this edit part. - * - * Body of this method does not depend on settings in generation model - * so you may safely remove <i>generated</i> tag and modify it. - * - * @generated - */ - @Override - protected NodeFigure createMainFigure() { - return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); - - } - - /** - * Default implementation treats passed figure as content pane. - * Respects layout one may have set for generated figure. - * - * @param nodeShape - * instance of generated figure class - * @generated - */ - @Override - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(5); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - /** - * @generated - */ - @Override - protected void setForegroundColor(Color color) { - if (primaryShape != null) { - primaryShape.setForegroundColor(color); - } - } - - /** - * @generated - */ - @Override - protected void setLineWidth(int width) { - super.setLineWidth(width); - } - - /** - * @generated - */ - @Override - protected void setLineType(int style) { - if (primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); - } - } - - /** - * @generated - */ - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLVisualIDRegistry.getType(DurationObservationLabelEditPart.VISUAL_ID)); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationLabelEditPart.java deleted file mode 100644 index 523f2e4d845..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/DurationObservationLabelEditPart.java +++ /dev/null @@ -1,882 +0,0 @@ - -/** - * Copyright (c) 2016 CEA LIST. - * - * 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.edit.parts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; -import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Feature; - -/** - * @generated - */ -public class DurationObservationLabelEditPart extends PapyrusCompartmentEditPart - implements ITextAwareEditPart, IControlParserForDirectEdit { - - /** - * @generated - */ - public static final String VISUAL_ID = "DurationObservation_NameLabel"; - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * @generated - */ - private String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - public DurationObservationLabelEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - @Override - public void setParser(IParser parser) { - this.parser = parser; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - 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(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain() - .runExclusive(new RunnableWithResult.Impl<java.lang.Object>() { - - @Override - public void run() { - setResult( - parser.isValidEditString( - ParserUtil.getParserAdapter(getParserElement(), - DurationObservationLabelEditPart.this), - (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(ParserUtil.getParserAdapter(getParserElement(), this)); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserUtil.getParser(UMLElementTypes.DurationObservation_Shape, getParserElement(), this, - VISUAL_ID); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { - - @Override - public void run() { - getManager().show(); - } - }); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new MultilineLabelDirectEditManager(this, - MultilineLabelDirectEditManager.getTextCellEditorClass(this), - UMLEditPartFactory.getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof ICustomDirectEditorConfiguration) { - setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration) - .createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog( - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), - configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), - ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } - - /** - * @generated - */ - protected void initializeDirectEditManager(final Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - @Override - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - 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(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), - (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - /** - * @generated - */ - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, - resolveSemanticElement(), this); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString( - IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") - && !languagePreferred.equals(configuration.getLanguage())) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), - this); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData() - .get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) - && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - refreshLabel(); - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON - .equals(((EAnnotation) event.getNewValue()).getSource())) { - refreshLabel(); - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } - - /** - * @generated - */ - private static final String ADD_PARENT_MODEL = "AddParentModel"; - - /** - * @generated - */ - @Override - public void activate() { - super.activate(); - addOwnerElementListeners(); - } - - /** - * @generated - */ - protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); - - } - - /** - * @generated - */ - @Override - public void deactivate() { - removeOwnerElementListeners(); - super.deactivate(); - - } - - /** - * @generated - */ - protected void removeOwnerElementListeners() { - removeListenerFilter(ADD_PARENT_MODEL); - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java index 38ecb782eae..613a13dc486 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java @@ -125,7 +125,6 @@ public class LifelineEditPart extends RoundedCompartmentEditPart { case StateInvariantEditPart.VISUAL_ID: case TimeConstraintEditPart.VISUAL_ID: case TimeObservationEditPart.VISUAL_ID: - case DurationConstraintEditPart.VISUAL_ID: case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return new BorderItemResizableEditPolicy(); } @@ -218,19 +217,6 @@ public class LifelineEditPart extends RoundedCompartmentEditPart { return true; } - - - - // Papyrus Gencode :Affixed locator for Lifelines to place element with a time bar - if (childEditPart instanceof DurationConstraintEditPart) { - IBorderItemLocator locator = new CenterLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((DurationConstraintEditPart) childEditPart).getFigure(), locator); - return true; - } - - - - // Papyrus Gencode :Specific locator for the itemBorder of the lifeline. if (childEditPart instanceof DestructionOccurrenceSpecificationEditPart) { IBorderItemLocator locator = new CenterLocator(getMainFigure(), PositionConstants.SOUTH); @@ -261,10 +247,6 @@ public class LifelineEditPart extends RoundedCompartmentEditPart { getBorderedFigure().getBorderItemContainer().remove(((TimeObservationEditPart) childEditPart).getFigure()); return true; } - if (childEditPart instanceof DurationConstraintEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((DurationConstraintEditPart) childEditPart).getFigure()); - return true; - } if (childEditPart instanceof DestructionOccurrenceSpecificationEditPart) { getBorderedFigure().getBorderItemContainer().remove(((DestructionOccurrenceSpecificationEditPart) childEditPart).getFigure()); return true; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageFoundAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageFoundAppliedStereotypeEditPart.java index c18c7217092..6fccbc19c37 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageFoundAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageFoundAppliedStereotypeEditPart.java @@ -22,7 +22,6 @@ import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Point; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RecordingCommand; import org.eclipse.emf.transaction.RunnableWithResult; @@ -60,7 +59,6 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; @@ -814,10 +812,6 @@ public class MessageFoundAppliedStereotypeEditPart extends PapyrusLabelEditPart } } - if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON - .equals(((EAnnotation) event.getNewValue()).getSource())) { - refreshLabel(); - } super.handleNotificationEvent(event); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/UMLEditPartFactory.java index 995453e3a29..126451eb9be 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/UMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/UMLEditPartFactory.java @@ -100,15 +100,6 @@ public class UMLEditPartFactory implements EditPartFactory { case TimeObservationAppliedStereotypeEditPart.VISUAL_ID: return new TimeObservationAppliedStereotypeEditPart(view); - case DurationConstraintEditPart.VISUAL_ID: - return new DurationConstraintEditPart(view); - - case DurationConstraintLabelEditPart.VISUAL_ID: - return new DurationConstraintLabelEditPart(view); - - case DurationConstraintAppliedStereotypeEditPart.VISUAL_ID: - return new DurationConstraintAppliedStereotypeEditPart(view); - case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return new DestructionOccurrenceSpecificationEditPart(view); @@ -127,24 +118,6 @@ public class UMLEditPartFactory implements EditPartFactory { case CommentBodyEditPart.VISUAL_ID: return new CommentBodyEditPart(view); - case DurationConstraintInMessageEditPart.VISUAL_ID: - return new DurationConstraintInMessageEditPart(view); - - case DurationConstraintInMessageLabelEditPart.VISUAL_ID: - return new DurationConstraintInMessageLabelEditPart(view); - - case DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID: - return new DurationConstraintInMessageAppliedStereotypeEditPart(view); - - case DurationObservationEditPart.VISUAL_ID: - return new DurationObservationEditPart(view); - - case DurationObservationLabelEditPart.VISUAL_ID: - return new DurationObservationLabelEditPart(view); - - case DurationObservationAppliedStereotypeEditPart.VISUAL_ID: - return new DurationObservationAppliedStereotypeEditPart(view); - case GateEditPart.VISUAL_ID: return new GateEditPart(view); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java index 6930fea96d3..969c5333fe7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java @@ -24,7 +24,6 @@ import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.KeyHandler; import org.eclipse.gef.Tool; import org.eclipse.gef.commands.CommandStackListener; -import org.eclipse.gef.palette.PaletteRoot; import org.eclipse.gef.ui.palette.PaletteViewer; import org.eclipse.gef.ui.palette.PaletteViewerProvider; import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener; @@ -130,22 +129,6 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh * @generated */ @Override - protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) { - PaletteRoot paletteRoot; - if (existingPaletteRoot == null) { - paletteRoot = PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent()); - } else { - PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent()); - paletteRoot = existingPaletteRoot; - } - applyCustomizationsToPalette(paletteRoot); - return paletteRoot; - } - - /** - * @generated - */ - @Override protected PreferencesHint getPreferencesHint() { return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdater.java index 952d248d15c..7288526f8e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramUpdater.java @@ -27,7 +27,6 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater; -import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper; import org.eclipse.papyrus.uml.diagram.common.helper.TimeConstraintHelper; import org.eclipse.papyrus.uml.diagram.common.helper.TimeObservationHelper; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart; @@ -43,9 +42,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContextLinkEditPart; 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.GateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart; @@ -73,8 +69,6 @@ import org.eclipse.uml2.uml.ConsiderIgnoreFragment; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Continuation; 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.Gate; import org.eclipse.uml2.uml.GeneralOrdering; @@ -301,10 +295,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { */ public static List<UMLNodeDescriptor> getInteraction_Shape_SemanticChildren(View view) { if (!view.isSetElement()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } Interaction modelElement = (Interaction) view.getElement(); - List result = new LinkedList(); + List<UMLNodeDescriptor> result = new LinkedList<>(); // remove fake children for messages (DurationConstraintInMessageEditPart/DurationObservationEditPart) return result; } @@ -331,7 +325,7 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated NOT (update at each lifeline modification) Added code for manage ExecutionSpecification, handle TimeConstraintEditPart and - * DurationConstraintEditPart children, handle TimeObservationEditPart children + * handle TimeObservationEditPart children */ public static List<UMLNodeDescriptor> getLifeline_Shape_SemanticChildren(View view) { if (!view.isSetElement()) { @@ -384,14 +378,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { continue; } } - for (DurationConstraint childElement : DurationConstraintHelper.getDurationConstraintsOn(covering)) { - // block from generated code - String visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); - if (DurationConstraintEditPart.VISUAL_ID.equals(visualID)) { - result.add(new UMLNodeDescriptor(childElement, visualID)); - continue; - } - } } } // handle TimeObservationEditPart children @@ -444,18 +430,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getTimeConstraint_Shape_ContainedLinks(view); case TimeObservationEditPart.VISUAL_ID: return getTimeObservation_Shape_ContainedLinks(view); - case DurationConstraintEditPart.VISUAL_ID: - return getDurationConstraint_Shape_ContainedLinks(view); case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return getDestructionOccurrenceSpecification_Shape_ContainedLinks(view); case ConstraintEditPart.VISUAL_ID: return getConstraint_Shape_ContainedLinks(view); case CommentEditPart.VISUAL_ID: return getComment_Shape_ContainedLinks(view); - case DurationConstraintInMessageEditPart.VISUAL_ID: - return getDurationConstraint_Shape_CN_ContainedLinks(view); - case DurationObservationEditPart.VISUAL_ID: - return getDurationObservation_Shape_ContainedLinks(view); case GateEditPart.VISUAL_ID: return getGate_Shape_ContainedLinks(view); case MessageSyncEditPart.VISUAL_ID: @@ -511,18 +491,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getTimeConstraint_Shape_IncomingLinks(view); case TimeObservationEditPart.VISUAL_ID: return getTimeObservation_Shape_IncomingLinks(view); - case DurationConstraintEditPart.VISUAL_ID: - return getDurationConstraint_Shape_IncomingLinks(view); case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return getDestructionOccurrenceSpecification_Shape_IncomingLinks(view); case ConstraintEditPart.VISUAL_ID: return getConstraint_Shape_IncomingLinks(view); case CommentEditPart.VISUAL_ID: return getComment_Shape_IncomingLinks(view); - case DurationConstraintInMessageEditPart.VISUAL_ID: - return getDurationConstraint_Shape_CN_IncomingLinks(view); - case DurationObservationEditPart.VISUAL_ID: - return getDurationObservation_Shape_IncomingLinks(view); case GateEditPart.VISUAL_ID: return getGate_Shape_IncomingLinks(view); case MessageSyncEditPart.VISUAL_ID: @@ -578,18 +552,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getTimeConstraint_Shape_OutgoingLinks(view); case TimeObservationEditPart.VISUAL_ID: return getTimeObservation_Shape_OutgoingLinks(view); - case DurationConstraintEditPart.VISUAL_ID: - return getDurationConstraint_Shape_OutgoingLinks(view); case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return getDestructionOccurrenceSpecification_Shape_OutgoingLinks(view); case ConstraintEditPart.VISUAL_ID: return getConstraint_Shape_OutgoingLinks(view); case CommentEditPart.VISUAL_ID: return getComment_Shape_OutgoingLinks(view); - case DurationConstraintInMessageEditPart.VISUAL_ID: - return getDurationConstraint_Shape_CN_OutgoingLinks(view); - case DurationObservationEditPart.VISUAL_ID: - return getDurationObservation_Shape_OutgoingLinks(view); case GateEditPart.VISUAL_ID: return getGate_Shape_OutgoingLinks(view); case MessageSyncEditPart.VISUAL_ID: @@ -745,17 +713,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_ContainedLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(modelElement)); - return result; - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_Shape_ContainedLinks(View view) { DestructionOccurrenceSpecification modelElement = (DestructionOccurrenceSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); @@ -787,24 +744,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_CN_ContainedLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(modelElement)); - return result; - } - - /** - * @generated - */ - public List<UMLLinkDescriptor> getDurationObservation_Shape_ContainedLinks(View view) { - return Collections.emptyList(); - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getGate_Shape_ContainedLinks(View view) { return Collections.emptyList(); } @@ -1122,27 +1061,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_IncomingLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter - .getCrossReferenceAdapter(view.eResource().getResourceSet()); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getIncomingTypeModelFacetLinks_Message_SynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_AsynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_ReplyEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_CreateEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_DeleteEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_LostEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_FoundEdge(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); - result.addAll( - getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); - return result; - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_Shape_IncomingLinks(View view) { DestructionOccurrenceSpecification modelElement = (DestructionOccurrenceSpecification) view.getElement(); CrossReferenceAdapter crossReferencer = CrossReferenceAdapter @@ -1207,48 +1125,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_CN_IncomingLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter - .getCrossReferenceAdapter(view.eResource().getResourceSet()); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getIncomingTypeModelFacetLinks_Message_SynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_AsynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_ReplyEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_CreateEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_DeleteEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_LostEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_FoundEdge(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); - result.addAll( - getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); - return result; - } - - /** - * @generated - */ - public List<UMLLinkDescriptor> getDurationObservation_Shape_IncomingLinks(View view) { - DurationObservation modelElement = (DurationObservation) view.getElement(); - CrossReferenceAdapter crossReferencer = CrossReferenceAdapter - .getCrossReferenceAdapter(view.eResource().getResourceSet()); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getIncomingTypeModelFacetLinks_Message_SynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_AsynchEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_ReplyEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_CreateEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_DeleteEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_LostEdge(modelElement, crossReferencer)); - result.addAll(getIncomingTypeModelFacetLinks_Message_FoundEdge(modelElement, crossReferencer)); - result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElementEdge(modelElement, crossReferencer)); - result.addAll( - getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement, crossReferencer)); - return result; - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getGate_Shape_IncomingLinks(View view) { Gate modelElement = (Gate) view.getElement(); CrossReferenceAdapter crossReferencer = CrossReferenceAdapter @@ -1632,24 +1508,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_OutgoingLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getOutgoingTypeModelFacetLinks_Message_SynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_AsynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_ReplyEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_CreateEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_DeleteEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_LostEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_FoundEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(modelElement)); - return result; - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getDestructionOccurrenceSpecification_Shape_OutgoingLinks(View view) { DestructionOccurrenceSpecification modelElement = (DestructionOccurrenceSpecification) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); @@ -1702,40 +1560,6 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ - public List<UMLLinkDescriptor> getDurationConstraint_Shape_CN_OutgoingLinks(View view) { - DurationConstraint modelElement = (DurationConstraint) view.getElement(); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getOutgoingTypeModelFacetLinks_Message_SynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_AsynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_ReplyEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_CreateEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_DeleteEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_LostEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_FoundEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ConstrainedElementEdge(modelElement)); - result.addAll(getOutgoingFeatureModelFacetLinks_Constraint_ContextEdge(modelElement)); - return result; - } - - /** - * @generated - */ - public List<UMLLinkDescriptor> getDurationObservation_Shape_OutgoingLinks(View view) { - DurationObservation modelElement = (DurationObservation) view.getElement(); - LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); - result.addAll(getOutgoingTypeModelFacetLinks_Message_SynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_AsynchEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_ReplyEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_CreateEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_DeleteEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_LostEdge(modelElement)); - result.addAll(getOutgoingTypeModelFacetLinks_Message_FoundEdge(modelElement)); - return result; - } - - /** - * @generated - */ public List<UMLLinkDescriptor> getGate_Shape_OutgoingLinks(View view) { Gate modelElement = (Gate) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<>(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java index 5d7aef810ba..95bfb7d04f5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java @@ -35,15 +35,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContextLinkEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart; -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.GateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingAppliedStereotypeEditPart; @@ -193,9 +184,6 @@ public class UMLVisualIDRegistry { } break; case InteractionEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getDurationConstraint().isSuperTypeOf(domainElement.eClass())) { - return DurationConstraintInMessageEditPart.VISUAL_ID; - } if (UMLPackage.eINSTANCE.getGate().isSuperTypeOf(domainElement.eClass())) { return GateEditPart.VISUAL_ID; } @@ -240,9 +228,6 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getTimeObservation().isSuperTypeOf(domainElement.eClass())) { return TimeObservationEditPart.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getDurationConstraint().isSuperTypeOf(domainElement.eClass())) { - return DurationConstraintEditPart.VISUAL_ID; - } if (UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification() .isSuperTypeOf(domainElement.eClass())) { return DestructionOccurrenceSpecificationEditPart.VISUAL_ID; @@ -267,9 +252,6 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { return CommentEditPart.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getDurationObservation().isSuperTypeOf(domainElement.eClass())) { - return DurationObservationEditPart.VISUAL_ID; - } break; case CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInteractionOperand().isSuperTypeOf(domainElement.eClass())) { @@ -315,9 +297,6 @@ public class UMLVisualIDRegistry { if (InteractionInteractionCompartmentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if (DurationConstraintInMessageEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } if (GateEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } @@ -379,9 +358,6 @@ public class UMLVisualIDRegistry { if (TimeObservationEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if (DurationConstraintEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } if (DestructionOccurrenceSpecificationEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } @@ -410,14 +386,6 @@ public class UMLVisualIDRegistry { return true; } break; - case DurationConstraintEditPart.VISUAL_ID: - if (DurationConstraintLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - if (DurationConstraintAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - break; case ConstraintEditPart.VISUAL_ID: if (ConstraintNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; @@ -431,22 +399,6 @@ public class UMLVisualIDRegistry { return true; } break; - case DurationConstraintInMessageEditPart.VISUAL_ID: - if (DurationConstraintInMessageLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - if (DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - break; - case DurationObservationEditPart.VISUAL_ID: - if (DurationObservationLabelEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - if (DurationObservationAppliedStereotypeEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } - break; case GateEditPart.VISUAL_ID: if (GateNameEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; @@ -471,9 +423,6 @@ public class UMLVisualIDRegistry { if (CommentEditPart.VISUAL_ID.equals(nodeVisualID)) { return true; } - if (DurationObservationEditPart.VISUAL_ID.equals(nodeVisualID)) { - return true; - } break; case CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID: if (InteractionOperandEditPart.VISUAL_ID.equals(nodeVisualID)) { @@ -705,10 +654,7 @@ public class UMLVisualIDRegistry { case StateInvariantEditPart.VISUAL_ID: case TimeConstraintEditPart.VISUAL_ID: case TimeObservationEditPart.VISUAL_ID: - case DurationConstraintEditPart.VISUAL_ID: case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: - case DurationConstraintInMessageEditPart.VISUAL_ID: - case DurationObservationEditPart.VISUAL_ID: case GateEditPart.VISUAL_ID: return true; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/ElementInitializers.java index e17be236cf6..6a27820360c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/ElementInitializers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/ElementInitializers.java @@ -28,9 +28,7 @@ import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Continuation; import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; import org.eclipse.uml2.uml.Duration; -import org.eclipse.uml2.uml.DurationConstraint; import org.eclipse.uml2.uml.DurationInterval; -import org.eclipse.uml2.uml.DurationObservation; import org.eclipse.uml2.uml.GeneralOrdering; import org.eclipse.uml2.uml.Interaction; import org.eclipse.uml2.uml.InteractionUse; @@ -186,24 +184,6 @@ public class ElementInitializers { } /** - * @generated NOT init Duration Interval - */ - public void init_DurationConstraint_Shape(DurationConstraint instance) { - try { - DurationInterval newInstance_0_0 = UMLFactory.eINSTANCE.createDurationInterval(); - instance.setSpecification(newInstance_0_0); - Object value_0_0_0 = name_specification_DurationConstraint_Shape(newInstance_0_0); - newInstance_0_0.setName((String) value_0_0_0); - // init Duration Interval - init_DurationInterval(newInstance_0_0); - Object value_1 = name_DurationConstraint_Shape(instance); - instance.setName((String) value_1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** * @generated */ public void init_DestructionOccurrenceSpecification_Shape(DestructionOccurrenceSpecification instance) { @@ -294,38 +274,6 @@ public class ElementInitializers { } /** - * @generated NOT init Duration Interval - */ - public void init_DurationConstraint_Shape_CN(DurationConstraint instance) { - try { - DurationInterval newInstance_0_0 = UMLFactory.eINSTANCE.createDurationInterval(); - instance.setSpecification(newInstance_0_0); - Object value_0_0_0 = name_specification_DurationConstraint_Shape_CN(newInstance_0_0); - newInstance_0_0.setName((String) value_0_0_0); - // init Duration Interval - init_DurationInterval(newInstance_0_0); - Object value_1 = name_DurationConstraint_Shape_CN(instance); - instance.setName((String) value_1); - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** - * @generated - */ - public void init_DurationObservation_Shape(DurationObservation instance) { - try { - Object value_0 = name_DurationObservation_Shape(instance); - if (value_0 != null) { - instance.setName((String) value_0); - } - } catch (RuntimeException e) { - UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ - } - } - - /** * @generated */ public void init_GeneralOrdering_Edge(GeneralOrdering instance) { @@ -412,20 +360,6 @@ public class ElementInitializers { /** * @generated */ - private String name_DurationConstraint_Shape(DurationConstraint it) { - return getNamedElement(it, "", it.eClass().getName(), ""); - } - - /** - * @generated - */ - private String name_specification_DurationConstraint_Shape(DurationInterval it) { - return getNamedElement(it, "", it.eClass().getName(), ""); - } - - /** - * @generated - */ private String name_DestructionOccurrenceSpecification_Shape(DestructionOccurrenceSpecification it) { return getNamedElement(it, "", it.eClass().getName(), ""); } @@ -440,27 +374,6 @@ public class ElementInitializers { /** * @generated */ - private String name_DurationConstraint_Shape_CN(DurationConstraint it) { - return getNamedElement(it, "", it.eClass().getName(), ""); - } - - /** - * @generated - */ - private String name_specification_DurationConstraint_Shape_CN(DurationInterval it) { - return getNamedElement(it, "", it.eClass().getName(), ""); - } - - /** - * @generated - */ - private String name_DurationObservation_Shape(DurationObservation it) { - return getNamedElement(it, "", "d", ""); - } - - /** - * @generated - */ private String name_GeneralOrdering_Edge(GeneralOrdering it) { return getNamedElement(it, "", it.eClass().getName(), ""); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLElementTypes.java index 66b5edf531c..1b796dd2dd1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLElementTypes.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLElementTypes.java @@ -37,9 +37,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContextLinkEditPart; 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.GateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart; @@ -156,11 +153,6 @@ public class UMLElementTypes { /** * @generated */ - public static final IElementType DurationConstraint_Shape = getElementTypeByUniqueId( - "org.eclipse.papyrus.umldi.DurationConstraint_Shape"); //$NON-NLS-1$ - /** - * @generated - */ public static final IElementType DestructionOccurrenceSpecification_Shape = getElementTypeByUniqueId( "org.eclipse.papyrus.umldi.DestructionOccurrenceSpecification_Shape"); //$NON-NLS-1$ /** @@ -176,16 +168,6 @@ public class UMLElementTypes { /** * @generated */ - public static final IElementType DurationConstraint_Shape_CN = getElementTypeByUniqueId( - "org.eclipse.papyrus.umldi.DurationConstraint_Shape_CN"); //$NON-NLS-1$ - /** - * @generated - */ - public static final IElementType DurationObservation_Shape = getElementTypeByUniqueId( - "org.eclipse.papyrus.umldi.DurationObservation_Shape"); //$NON-NLS-1$ - /** - * @generated - */ public static final IElementType Gate_Shape = getElementTypeByUniqueId("org.eclipse.papyrus.umldi.Gate_Shape"); //$NON-NLS-1$ /** @@ -309,8 +291,6 @@ public class UMLElementTypes { elements.put(TimeObservation_Shape, UMLPackage.eINSTANCE.getTimeObservation()); - elements.put(DurationConstraint_Shape, UMLPackage.eINSTANCE.getDurationConstraint()); - elements.put(DestructionOccurrenceSpecification_Shape, UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification()); @@ -318,10 +298,6 @@ public class UMLElementTypes { elements.put(Comment_Shape, UMLPackage.eINSTANCE.getComment()); - elements.put(DurationConstraint_Shape_CN, UMLPackage.eINSTANCE.getDurationConstraint()); - - elements.put(DurationObservation_Shape, UMLPackage.eINSTANCE.getDurationObservation()); - elements.put(Gate_Shape, UMLPackage.eINSTANCE.getGate()); elements.put(Message_SynchEdge, UMLPackage.eINSTANCE.getMessage()); @@ -375,12 +351,9 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(StateInvariant_Shape); KNOWN_ELEMENT_TYPES.add(TimeConstraint_Shape); KNOWN_ELEMENT_TYPES.add(TimeObservation_Shape); - KNOWN_ELEMENT_TYPES.add(DurationConstraint_Shape); KNOWN_ELEMENT_TYPES.add(DestructionOccurrenceSpecification_Shape); KNOWN_ELEMENT_TYPES.add(Constraint_Shape); KNOWN_ELEMENT_TYPES.add(Comment_Shape); - KNOWN_ELEMENT_TYPES.add(DurationConstraint_Shape_CN); - KNOWN_ELEMENT_TYPES.add(DurationObservation_Shape); KNOWN_ELEMENT_TYPES.add(Gate_Shape); KNOWN_ELEMENT_TYPES.add(Message_SynchEdge); KNOWN_ELEMENT_TYPES.add(Message_AsynchEdge); @@ -439,18 +412,12 @@ public class UMLElementTypes { return TimeConstraint_Shape; case TimeObservationEditPart.VISUAL_ID: return TimeObservation_Shape; - case DurationConstraintEditPart.VISUAL_ID: - return DurationConstraint_Shape; case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return DestructionOccurrenceSpecification_Shape; case ConstraintEditPart.VISUAL_ID: return Constraint_Shape; case CommentEditPart.VISUAL_ID: return Comment_Shape; - case DurationConstraintInMessageEditPart.VISUAL_ID: - return DurationConstraint_Shape_CN; - case DurationObservationEditPart.VISUAL_ID: - return DurationObservation_Shape; case GateEditPart.VISUAL_ID: return Gate_Shape; case MessageSyncEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLParserProvider.java index 803f55f7f11..9150268b332 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLParserProvider.java @@ -34,12 +34,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentBodyEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Constraint2EditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationNameEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintAppliedStereotypeEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintInMessageAppliedStereotypeEditPart; -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.DurationObservationLabelEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingAppliedStereotypeEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionNameEditPart; @@ -66,7 +60,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintApplied import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintLabelEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationAppliedStereotypeEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationLabelEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.parser.custom.DurationObservationParser; import org.eclipse.papyrus.uml.diagram.sequence.parser.custom.InteractionUseCustomParsers; import org.eclipse.papyrus.uml.diagram.sequence.parser.custom.LifelineCustomParsers; import org.eclipse.papyrus.uml.diagram.sequence.parser.custom.MessageCustomParser; @@ -263,36 +256,6 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid /** * @generated */ - private TimeConstraintParser durationConstraint_BodyLabel_Parser; - - /** - * @generated - */ - private IParser getDurationConstraint_BodyLabel_Parser() { - if (durationConstraint_BodyLabel_Parser == null) { - durationConstraint_BodyLabel_Parser = new TimeConstraintParser(); - } - return durationConstraint_BodyLabel_Parser; - } - - /** - * @generated - */ - private AppliedStereotypeParser durationConstraint_StereotypeLabel_Parser; - - /** - * @generated - */ - private IParser getDurationConstraint_StereotypeLabel_Parser() { - if (durationConstraint_StereotypeLabel_Parser == null) { - durationConstraint_StereotypeLabel_Parser = new AppliedStereotypeParser(); - } - return durationConstraint_StereotypeLabel_Parser; - } - - /** - * @generated - */ private IParser constraint_NameLabel_Parser; /** @@ -340,66 +303,6 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid /** * @generated */ - private TimeConstraintParser durationConstraint_BodyLabel_CN_Parser; - - /** - * @generated - */ - private IParser getDurationConstraint_BodyLabel_CN_Parser() { - if (durationConstraint_BodyLabel_CN_Parser == null) { - durationConstraint_BodyLabel_CN_Parser = new TimeConstraintParser(); - } - return durationConstraint_BodyLabel_CN_Parser; - } - - /** - * @generated - */ - private AppliedStereotypeParser durationConstraint_StereotypeLabel_CN_Parser; - - /** - * @generated - */ - private IParser getDurationConstraint_StereotypeLabel_CN_Parser() { - if (durationConstraint_StereotypeLabel_CN_Parser == null) { - durationConstraint_StereotypeLabel_CN_Parser = new AppliedStereotypeParser(); - } - return durationConstraint_StereotypeLabel_CN_Parser; - } - - /** - * @generated - */ - private DurationObservationParser durationObservation_NameLabel_Parser; - - /** - * @generated - */ - private IParser getDurationObservation_NameLabel_Parser() { - if (durationObservation_NameLabel_Parser == null) { - durationObservation_NameLabel_Parser = new DurationObservationParser(); - } - return durationObservation_NameLabel_Parser; - } - - /** - * @generated - */ - private AppliedStereotypeParser durationObservation_StereotypeLabel_Parser; - - /** - * @generated - */ - private IParser getDurationObservation_StereotypeLabel_Parser() { - if (durationObservation_StereotypeLabel_Parser == null) { - durationObservation_StereotypeLabel_Parser = new AppliedStereotypeParser(); - } - return durationObservation_StereotypeLabel_Parser; - } - - /** - * @generated - */ private IParser gate_NameLabel_Parser; /** @@ -674,11 +577,6 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid case TimeObservationAppliedStereotypeEditPart.VISUAL_ID: return getTimeObservation_StereotypeLabel_Parser(); - case DurationConstraintLabelEditPart.VISUAL_ID: - return getDurationConstraint_BodyLabel_Parser(); - case DurationConstraintAppliedStereotypeEditPart.VISUAL_ID: - return getDurationConstraint_StereotypeLabel_Parser(); - case ConstraintNameEditPart.VISUAL_ID: return getConstraint_NameLabel_Parser(); case Constraint2EditPart.VISUAL_ID: @@ -687,16 +585,6 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid case CommentBodyEditPart.VISUAL_ID: return getComment_BodyLabel_Parser(); - case DurationConstraintInMessageLabelEditPart.VISUAL_ID: - return getDurationConstraint_BodyLabel_CN_Parser(); - case DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID: - return getDurationConstraint_StereotypeLabel_CN_Parser(); - - case DurationObservationLabelEditPart.VISUAL_ID: - return getDurationObservation_NameLabel_Parser(); - case DurationObservationAppliedStereotypeEditPart.VISUAL_ID: - return getDurationObservation_StereotypeLabel_Parser(); - case GateNameEditPart.VISUAL_ID: return getGate_NameLabel_Parser(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLViewProvider.java index c9fc0ca2ef7..02cd3ec4eeb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLViewProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/providers/UMLViewProvider.java @@ -77,15 +77,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContextLinkEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ContinuationNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DestructionOccurrenceSpecificationEditPart; -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.GateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateNameEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingAppliedStereotypeEditPart; @@ -268,13 +259,10 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case StateInvariantEditPart.VISUAL_ID: case TimeConstraintEditPart.VISUAL_ID: case TimeObservationEditPart.VISUAL_ID: - case DurationConstraintEditPart.VISUAL_ID: case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: case ConstraintEditPart.VISUAL_ID: case CommentEditPart.VISUAL_ID: - case DurationObservationEditPart.VISUAL_ID: case GateEditPart.VISUAL_ID: - case DurationConstraintInMessageEditPart.VISUAL_ID: if (domainElement == null || !visualID .equals(UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement))) { return false; // visual id in semantic hint should match visual id for domain element @@ -370,8 +358,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createTimeConstraint_Shape(domainElement, containerView, index, persisted, preferencesHint); case TimeObservationEditPart.VISUAL_ID: return createTimeObservation_Shape(domainElement, containerView, index, persisted, preferencesHint); - case DurationConstraintEditPart.VISUAL_ID: - return createDurationConstraint_Shape(domainElement, containerView, index, persisted, preferencesHint); case DestructionOccurrenceSpecificationEditPart.VISUAL_ID: return createDestructionOccurrenceSpecification_Shape(domainElement, containerView, index, persisted, preferencesHint); @@ -379,11 +365,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createConstraint_Shape(domainElement, containerView, index, persisted, preferencesHint); case CommentEditPart.VISUAL_ID: return createComment_Shape(domainElement, containerView, index, persisted, preferencesHint); - case DurationConstraintInMessageEditPart.VISUAL_ID: - return createDurationConstraint_Shape_CN(domainElement, containerView, index, persisted, - preferencesHint); - case DurationObservationEditPart.VISUAL_ID: - return createDurationObservation_Shape(domainElement, containerView, index, persisted, preferencesHint); case GateEditPart.VISUAL_ID: return createGate_Shape(domainElement, containerView, index, persisted, preferencesHint); } @@ -694,36 +675,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - 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.initFontStyleFromPrefs(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(0); - durationConstraint_BodyLabel_Location.setY(15); - 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; - } - - /** - * @generated - */ public Node createDestructionOccurrenceSpecification_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); @@ -779,58 +730,6 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ - public Node createDurationConstraint_Shape_CN(EObject domainElement, View containerView, int index, - boolean persisted, PreferencesHint preferencesHint) { - Shape node = NotationFactory.eINSTANCE.createShape(); - node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); - node.setType(UMLVisualIDRegistry.getType(DurationConstraintInMessageEditPart.VISUAL_ID)); - ViewUtil.insertChildView(containerView, node, index, persisted); - node.setElement(domainElement); - // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); - - PreferenceInitializerForElementHelper.initFontStyleFromPrefs(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; - } - - /** - * @generated - */ - public Node createDurationObservation_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(DurationObservationEditPart.VISUAL_ID)); - ViewUtil.insertChildView(containerView, node, index, persisted); - node.setElement(domainElement); - // initializeFromPreferences - final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); - - PreferenceInitializerForElementHelper.initFontStyleFromPrefs(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(-22); - return node; - } - - /** - * @generated - */ public Node createGate_Shape(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters deleted file mode 100644 index 5c64599690b..00000000000 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<component id="org.eclipse.papyrus.uml.properties" version="2"> - <resource path="src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java" type="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint"> - <filter comment="Change type (& visibility) of a memory-leak field that should no longer be used" id="388018290"> - <message_arguments> - <message_argument value="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint"/> - <message_argument value="umlElement"/> - </message_arguments> - </filter> - </resource> -</component> diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java index 7234aa803a0..ac539452195 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/BugTests2.java @@ -1,21 +1,20 @@ package org.eclipse.papyrus.uml.diagram.sequence.tests.bug; -import org.junit.runner.RunWith; import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite; +import org.junit.runner.RunWith; import org.junit.runners.Suite.SuiteClasses; @RunWith(ClassificationSuite.class) /* TestLifelineAutoResize_383723.class, TestLifelineLabelCustomize_383722.class */ -@SuiteClasses({ - TestCombinedFragmentName_382951.class, - TestCreationUndo_384618.class, - TestDestructionNode_384201.class, - TestDurationConstraints_384596.class, - TestExecutionSpecificationDimension_384572.class, - TestInteractionConstraint_382966.class, - TestMessageCreate_379661.class, - TestMessageLostFound_384202.class, - TestNestedExecution_384616.class +@SuiteClasses({ + TestCombinedFragmentName_382951.class, + TestCreationUndo_384618.class, + TestDestructionNode_384201.class, + TestExecutionSpecificationDimension_384572.class, + TestInteractionConstraint_382966.class, + TestMessageCreate_379661.class, + TestMessageLostFound_384202.class, + TestNestedExecution_384616.class }) public class BugTests2 { } diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java deleted file mode 100644 index 997b94307f5..00000000000 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDurationConstraints_384596.java +++ /dev/null @@ -1,228 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * - * 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.tests.bug; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.papyrus.commands.ICreationCommand; -import org.eclipse.papyrus.junit.framework.classification.FailingTest; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintLabelEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; -import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants; -import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.CreateSequenceDiagramCommand; -import org.eclipse.papyrus.uml.diagram.sequence.tests.canonical.TestTopNode; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.uml2.uml.ActionExecutionSpecification; -import org.eclipse.uml2.uml.DurationConstraint; -import org.eclipse.uml2.uml.Interval; -import org.eclipse.uml2.uml.OccurrenceSpecification; -import org.eclipse.uml2.uml.ValueSpecification; -import org.junit.Test; - -/** - * An embedded textuel editor shall allow editing duration constraints. This editor shall be accessible on the diagram. - * When the two values of the interval are equal, the value shall be displayed only once. - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=384596 - * - */ -public class TestDurationConstraints_384596 extends TestTopNode { - - private static final String SEP = ".."; - - /** The occurrence specification(s) which are the nearest from a creation request */ - public static final String NEAREST_OCCURRENCE_SPECIFICATION = "Nearest occurrence specification"; //$NON-NLS-1$ - - /** The occurrence specification(s) which are the nearest from a creation request (2nd end of creation) */ - public static final String NEAREST_OCCURRENCE_SPECIFICATION_2 = "Nearest occurrence specification (end)"; //$NON-NLS-1$ - - private static final String EDIT = "Edit: "; - - @Override - protected ICreationCommand getDiagramCommandCreation() { - return new CreateSequenceDiagramCommand(); - } - - @Override - protected String getProjectName() { - return ISequenceDiagramTestsConstants.PROJECT_NAME; - } - - @Override - protected String getFileName() { - return ISequenceDiagramTestsConstants.FILE_NAME; - } - - @FailingTest ("To be erased or rewritten to take new architecture into account") - @Test - public void testDurationEdition() { - createNode(UMLElementTypes.Lifeline_Shape, getRootEditPart(), new Point(100, 100), new Dimension(62, 200), null); - final LifelineEditPart lifeline1 = (LifelineEditPart)getRootEditPart().getChildren().get(0); - waitForComplete(); - - createNode(UMLElementTypes.ActionExecutionSpecification_Shape, lifeline1, new Point(131, 200), new Dimension(20, 40), null); - waitForComplete(); - - ActionExecutionSpecificationEditPart esp = (ActionExecutionSpecificationEditPart)lifeline1.getChildren().get(1); - createDuraitonConstraint(lifeline1, esp); - - DurationConstraintEditPart dp = (DurationConstraintEditPart)lifeline1.getChildren().get(2); - - // edit text - WrappingLabel label = verifyEditText(dp, "1s", "2s"); - assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("1s..2s")); - - label = verifyEditText(dp, "d", "d+3"); - assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("d..d+3")); - - getEMFCommandStack().undo(); - assertTrue(EDIT + TEST_THE_UNDO, label.getText().contains("1s..2s")); - - label = verifyEditText(dp, "1", "1"); - assertTrue(EDIT + TEST_THE_EXECUTION, label.getText().contains("1") && !label.getText().contains(SEP)); - - } - - protected WrappingLabel verifyEditText(DurationConstraintEditPart dp, String min, String max) { - DurationConstraintLabelEditPart lp = (DurationConstraintLabelEditPart)dp.getChildren().get(0); - WrappingLabel label = performEditRequest(lp); - - Composite composite = (Composite)lp.getViewer().getControl(); - Text editor = findEditor(composite, label); - - editor.setText(min + SEP + max); - input(editor, SWT.CR); - - DurationConstraint constraint = (DurationConstraint)dp.resolveSemanticElement(); - ValueSpecification spec = constraint.getSpecification(); - assertTrue(EDIT + TEST_THE_EXECUTION, min.equals(ValueSpecificationUtil.getSpecificationValue(((Interval)spec).getMin()))); - assertTrue(EDIT + TEST_THE_EXECUTION, max.equals(ValueSpecificationUtil.getSpecificationValue(((Interval)spec).getMax()))); - - waitForComplete(); - return label; - } - - protected void createDuraitonConstraint(final LifelineEditPart lifeline1, ActionExecutionSpecificationEditPart esp) { - ActionExecutionSpecification aes = (ActionExecutionSpecification)esp.resolveSemanticElement(); - - Map<String, Object> extendedData = new HashMap<String, Object>(); - List<OccurrenceSpecification> events = new ArrayList<OccurrenceSpecification>(2); - events.add(aes.getStart()); - extendedData.put(NEAREST_OCCURRENCE_SPECIFICATION, events); - - events = new ArrayList<OccurrenceSpecification>(2); - events.add(aes.getFinish()); - extendedData.put(NEAREST_OCCURRENCE_SPECIFICATION_2, events); - - createNode(UMLElementTypes.DurationConstraint_Shape, lifeline1, getAbsoluteBounds(esp).getBottom(), new Dimension(20, 40), extendedData); - waitForComplete(); - } - - public void input(Widget widget, char... character) { - if(widget.isDisposed()) { - return; - } - - for(char c : character) { - Event e = createKeyEvent(widget, 0, c); - e.type = SWT.KeyDown; - widget.notifyListeners(SWT.KeyDown, e); - - e = createKeyEvent(widget, 0, c); - e.type = SWT.KeyUp; - widget.notifyListeners(SWT.KeyUp, e); - } - waitForComplete(); - - Event e = new Event(); - e.type = SWT.DefaultSelection; - widget.notifyListeners(SWT.DefaultSelection, e); - } - - private Event createKeyEvent(Widget widget, int keyCode, char character) { - Event event = new Event(); - event.time = (int)System.currentTimeMillis(); - event.widget = widget; - event.display = Display.getDefault(); - event.keyCode = keyCode; - event.character = character; - return event; - } - - private Text findEditor(Composite composite, WrappingLabel label) { - for(Control c : composite.getChildren()) { - if(c instanceof Text) { - if(label.getText().equals(((Text)c).getText())) { - return (Text)c; - } - } - } - return null; - } - - protected WrappingLabel performEditRequest(DurationConstraintLabelEditPart lp) { - WrappingLabel label = (WrappingLabel)lp.getFigure(); - Rectangle b = label.getBounds().getCopy(); - label.translateToAbsolute(b); - DirectEditRequest req = new DirectEditRequest(); - req.setLocation(b.getCenter()); - lp.performRequest(req); - return label; - } - - public void createNode(IElementType type, EditPart parentPart, Point location, Dimension size, Map<String, Object> extendedData) { - //CREATION - CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getRootEditPart().getDiagramPreferencesHint()); - requestcreation.setLocation(location); - requestcreation.setSize(size); - if(extendedData != null) { - requestcreation.getExtendedData().putAll(extendedData); - } - Command command = parentPart.getCommand(requestcreation); - assertNotNull(CREATION + COMMAND_NULL, command); - assertTrue(CREATION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE); - assertTrue(CREATION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true); - - getDiagramCommandStack().execute(command); - } - -} diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java index 9047b6bed50..ce98612832f 100644 --- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java +++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/canonical/TestSequenceDiagramInsideInteraction.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2012 CEA LIST. * - * + * * 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 @@ -66,11 +66,11 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh if (name.length() < ((ITextAwareEditPart) namedEditPart).getEditText().length()) { Assert.assertEquals(" the name must contain the name of the metaclass", name, ((ITextAwareEditPart) namedEditPart).getEditText().substring(0, name.length())); //$NON-NLS-1$ } else { - + if(createdEditPart instanceof InteractionUseEditPart){ //this is a particularity of interactionUse Assert.assertEquals(" the name must contain the name of the metaclass", "Ref", ((ITextAwareEditPart) namedEditPart).getEditText()); //$NON-NLS-1$ - + } else{ // not the same it sure but display the mistake is important @@ -110,7 +110,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh @Override protected boolean isSemanticTest() { - + return false; } @@ -142,11 +142,6 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh testToManageNode(UMLElementTypes.ConsiderIgnoreFragment_Shape, UMLPackage.eINSTANCE.getConsiderIgnoreFragment(),UMLElementTypes.Interaction_Shape, false); } - @Test - public void testToManageDurationObservation() { - - testToManageNode(UMLElementTypes.DurationObservation_Shape,UMLPackage.eINSTANCE.getDurationObservation(),UMLElementTypes.Interaction_Shape ,false); - } /** * Test to manage comment. */ @@ -159,7 +154,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh public void testToManageInteractionUse() { testToManageNode(UMLElementTypes.InteractionUse_Shape, UMLPackage.eINSTANCE.getInteractionUse(),UMLElementTypes.Interaction_Shape, false); } - + /** * @see org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractTestNode#testDrop(org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.EClass, int, int, int) * @@ -175,7 +170,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh // DROP assertEquals(DROP + INITIALIZATION_TEST, expectedGraphicalChildren, getRootView().getChildren().size()); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); - ArrayList<Element> list = new ArrayList<Element>(); + ArrayList<Element> list = new ArrayList<>(); for (Element element : getRootSemanticModel().getModel().getOwnedElements()) { if (element != null && element.eClass().equals(eClass)) { list.add(element); @@ -201,7 +196,7 @@ public class TestSequenceDiagramInsideInteraction extends AbstractTestSequenceCh super.testDrop(type, eClass, expectedGraphicalChildren, expectedSemanticChildren, addedGraphicalChildren); } } - + /** * @see org.eclipse.papyrus.uml.diagram.tests.canonical.AbstractTestNode#createViewRequestShapeContainer() * |