Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-04-17 14:38:36 +0000
committerCamille Letavernier2018-04-18 07:15:39 +0000
commit8271edac0da1d2256bbf2ceab3d73c47201d5b20 (patch)
treecaeaf7cd6183ee25e736f4387c077587eef94bc0
parentab582c171cc4874c47a5dd7d09c52d1a1cfa53e8 (diff)
downloadorg.eclipse.papyrus-8271edac0da1d2256bbf2ceab3d73c47201d5b20.tar.gz
org.eclipse.papyrus-8271edac0da1d2256bbf2ceab3d73c47201d5b20.tar.xz
org.eclipse.papyrus-8271edac0da1d2256bbf2ceab3d73c47201d5b20.zip
533700: [SequenceDiagram] Clean-up dead code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533700 Remove or truncate more unused OLD classes Change-Id: Ib3070d87ec1a36d53f810754bcfd6984d6136337 Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java194
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java642
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionInteractionCompartmentEditPart.java96
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionUseEditPart.java414
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java430
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateNameEditPart.java363
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java34
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OldCustomInteractionEditPart.java21
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java210
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGateGraphicalNodeEditPolicy.java244
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java68
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/GateLocator.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java141
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java52
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java40
18 files changed, 116 insertions, 2940 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java
deleted file mode 100644
index 8e2b0656fff..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomConsiderIgnoreFragmentEditPart.java
+++ /dev/null
@@ -1,194 +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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
-import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
-import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
-import org.eclipse.uml2.uml.InteractionOperatorKind;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Reception;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class CustomConsiderIgnoreFragmentEditPart extends OLDCustomCombinedFragmentEditPart {
-
- /**
- * Notfier for listen and unlistend model element.
- */
- private NotificationHelper notifier = null;
-
- /**
- * Constructor.
- *
- * @param view
- */
- public CustomConsiderIgnoreFragmentEditPart(View view) {
- super(view);
- }
-
- /**
- * Try to use the notifier from super class, if not exist, create new one.
- */
- protected NotificationHelper getNotifier() {
- if (notifier == null) {
- try {
- Field f = ConsiderIgnoreFragmentEditPart.class.getDeclaredField("notifier");
- f.setAccessible(true);
- notifier = (NotificationHelper) f.get(this);
- } catch (Exception e) {
- notifier = new NotificationHelper(new UIAdapterImpl() {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- handleNotificationEvent(msg);
- }
- });
- }
- }
- return notifier;
- }
-
- @Override
- protected NodeFigure createNodePlate() {
- String prefElementId = "ConsiderIgnoreFragment";
- IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
- String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH);
- String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT);
- DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
- return result;
- }
-
- /**
- * Handle for message
- */
- @Override
- protected void handleNotificationEvent(Notification notification) {
- final NotificationHelper notifier = getNotifier();
- Object feature = notification.getFeature();
- if (UMLPackage.eINSTANCE.getConsiderIgnoreFragment_Message().equals(feature)) {
- // Handle message creation
- Object newValue = notification.getNewValue();
- // TODO Filter NamedElements type for message on higher level
- if (newValue == null || newValue instanceof Operation || newValue instanceof Reception || newValue instanceof Signal) {
- updateHeaderLabel();
- notifier.unlistenObject((Notifier) notification.getOldValue());
- notifier.listenObject((Notifier) notification.getNewValue());
- } else {
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- considerIgnoreFragment.getMessages().remove(newValue);
- }
- } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature)) {
- // Handle message modification
- updateHeaderLabel();
- }
- super.handleNotificationEvent(notification);
- }
-
- /**
- * Update operator kind
- */
- @Override
- protected void updateHeaderLabel() {
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- StringBuilder operatorKind = new StringBuilder();
- operatorKind.append(considerIgnoreFragment.getInteractionOperator().getName());
- EList<NamedElement> messages = considerIgnoreFragment.getMessages();
- if (messages != null && messages.size() > 0) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < messages.size(); i++) {
- String name = UMLLabelInternationalization.getInstance().getLabel(messages.get(i));
- if (name != null) {
- sb.append(name).append(",");
- }
- }
- if (sb.length() > 0) {
- operatorKind.append(" {").append(sb.deleteCharAt(sb.length() - 1).toString()).append("}");
- }
- }
- getPrimaryShape().getNameLabel().setText(operatorKind.toString());
- }
-
- /**
- * Return true if the InteractionOperatorKind is allowed
- *
- * @param interactionOperatorLiteral
- * The InteractionOperator to test
- * @return true if allowed
- */
- @Override
- protected boolean isAllowedInteractionOperator(String interactionOperatorLiteral) {
- return InteractionOperatorKind.CONSIDER_LITERAL.getLiteral().equals(interactionOperatorLiteral) || InteractionOperatorKind.IGNORE_LITERAL.getLiteral().equals(interactionOperatorLiteral);
- }
-
- /**
- * Activate a listener for the interactionUse to Handle notification in the refered Interaction
- */
- @Override
- public void activate() {
- super.activate();
- final NotificationHelper notifier = getNotifier();
- ConsiderIgnoreFragment considerIgnoreFragment = (ConsiderIgnoreFragment) resolveSemanticElement();
- for (NamedElement message : considerIgnoreFragment.getMessages()) {
- notifier.listenObject(message);
- }
- }
-
- /**
- * Deactivate a listener for the interactionUse to Handle notification in the refered
- * Interaction
- */
- @Override
- public void deactivate() {
- super.deactivate();
- if (notifier != null) {
- notifier.unlistenAll();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeNotify() {
- if (notifier != null) {
- notifier.unlistenAll();
- }
- super.removeNotify();
- }
-
- @Override
- public String getTitlePreferenceKey() {
- return "ELEMENT_PapyrusUMLSequenceDiagram_ConsiderIgnoreFragment_CombinedFragmentCompartment.compartment_name.visibility";
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
index 0152fa89af0..8f30b2c37ee 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
@@ -16,109 +16,39 @@
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-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.common.util.EList;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
-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.DirectEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-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.ParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-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.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.ResizableShapeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.IPapyrusWrappingLabel;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.FigureUtils;
import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper.CombinedFragmentAnchor;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AbstractHeadImpactLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentHeadImpactLayoutEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGateCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGatesHolderGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.CombinedFragmentFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.TextCellEditorLocator;
import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.ElementIconUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping;
-import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater;
import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.InteractionOperatorKind;
-import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.UMLPackage;
@@ -126,8 +56,11 @@ import org.eclipse.uml2.uml.UMLPackage;
* Add implementing IPapyrusEditPart to displaying Stereotypes.
*
* @author Jin Liu (jin.liu@soyatec.com)
+ *
+ * XXX Check remaining usages
*/
-public class OLDCustomCombinedFragmentEditPart extends CombinedFragmentEditPart implements ITextAwareEditPart {
+@Deprecated
+public class OLDCustomCombinedFragmentEditPart {
/**
@@ -174,567 +107,10 @@ public class OLDCustomCombinedFragmentEditPart extends CombinedFragmentEditPart
*/
private static final String BLOCK_OPERAND_ADDITION_MSG = "It's impossible to add more than one operand on opt, loop, break, neg combined fragment"; //$NON-NLS-1$
- private DirectEditManager manager;
-
- private IParser parser;
-
- private IEclipsePreferences.IPreferenceChangeListener propertyListener;
-
- /**
- * Constructor.
- *
- * @param view
- */
- public OLDCustomCombinedFragmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CombinedFragmentDirectEditPolicy());
- // Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDGatesHolderGraphicalNodeEditPolicy());
- installEditPolicy("Gate Creation Edit Policy", new OLDGateCreationEditPolicy());
- // install a editpolicy to display stereotypes
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- // ignore impact layout when head changed.
- installEditPolicy(AbstractHeadImpactLayoutEditPolicy.HEAD_IMPACT_LAYOUT_POLICY, new CombinedFragmentHeadImpactLayoutEditPolicy());
- }
-
- /**
- * Generated not for handle operator kind
- *
- * @Override
- */
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new CombinedFragmentFigure() {
-
- @Override
- protected ConnectionAnchor createAnchor(PrecisionPoint p) {
- if (p == null) {
- // If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null
- // PrecisionPoint will passed in - this is handled here
- return createDefaultAnchor();
- }
- return new CombinedFragmentAnchor(this, p);
- }
- };
- updateHeaderLabel();
- return primaryShape;
- }
-
- /**
- * Create a BorderedNodeFigure for holding Gates.
- */
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return super.getContentPaneFor(editPart);
- }
-
- public InteractionInteractionCompartmentEditPart getParentInteractionCompartmentEditPart() {
- EditPart part = this;
- do {
- part = part.getParent();
- } while (part != null && !(part instanceof InteractionInteractionCompartmentEditPart));
- return (InteractionInteractionCompartmentEditPart) part;
- }
-
- /**
- * @Override
- */
- @Override
- protected void setLineWidth(int width) {
- if (primaryShape instanceof NodeFigure) {
- ((NodeFigure) primaryShape).setLineWidth(width);
- } else {
- super.setLineWidth(width);
- }
- }
-
- @Override
- protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
- IFigure pane = getPrimaryShape().getCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.remove(((CombinedFragmentCombinedFragmentCompartmentEditPart) childEditPart).getFigure());
- return true;
- } else if (childEditPart instanceof OLDGateEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((OLDGateEditPart) childEditPart).getFigure());
- return true;
- }
- return false;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart#addFixedChild(org.eclipse.gef.EditPart)
- *
- * @param childEditPart
- * @return
- */
- @Override
- protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof OLDGateEditPart) {
- getBorderedFigure().getBorderItemContainer().add(((OLDGateEditPart) childEditPart).getFigure(), new GateLocator((OLDGateEditPart) childEditPart, getFigure()));
- return true;
- }
- return super.addFixedChild(childEditPart);
- }
-
- public List<OLDCustomInteractionOperandEditPart> getOperandChildrenEditParts() {
- List<OLDCustomInteractionOperandEditPart> children = new LinkedList<>();
- IGraphicalEditPart compartment = getChildBySemanticHint(String.valueOf(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID));
- if (compartment instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
- for (Object ep : compartment.getChildren()) {
- if (ep instanceof OLDCustomInteractionOperandEditPart) {
- children.add((OLDCustomInteractionOperandEditPart) ep);
- }
- }
- }
- return children;
- }
-
- /**
- * Handle for interaction operator, operator kind and covered lifelines
- */
- @Override
- protected void handleNotificationEvent(Notification notification) {
- Object feature = notification.getFeature();
- if (UMLPackage.eINSTANCE.getCombinedFragment_InteractionOperator().equals(feature)) {
- CombinedFragment combinedFragment = (CombinedFragment) resolveSemanticElement();
- String newStringValue = notification.getNewStringValue();
- if (notification.getOldValue() instanceof InteractionOperatorKind && !isAllowedInteractionOperator(newStringValue)) {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, FORBIDEN_OPERATOR_MODIFICATION_MSG);
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), SetCommand.create(getEditingDomain(), combinedFragment, feature, notification.getOldValue()), true);
- return;
- }
- EList<InteractionOperand> operands = combinedFragment.getOperands();
- if (operands == null || operands.size() <= 1) {
- // If CombinedFragment have no operand, we can change the
- // OperatorKind
- updateHeaderLabel();
- } else {
- if (notification.getOldValue() instanceof InteractionOperatorKind) {
- InteractionOperatorKind newValue = (InteractionOperatorKind) notification.getNewValue();
- if (!InteractionOperatorKindCompatibleMapping.supportMultiOperand(newValue)) {
- MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, BLOCK_OPERATOR_MODIFICATION_MSG);
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), SetCommand.create(getEditingDomain(), combinedFragment, feature, notification.getOldValue()), true);
- } else {
- updateHeaderLabel();
- }
- }
- }
- /*
- * else if(notification.getOldValue() instanceof InteractionOperatorKind &&
- * !newStringValue.equals(getPrimaryShape().getHeaderLabel().getText())) {
- * MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, BLOCK_OPERATOR_MODIFICATION_MSG);
- * CommandHelper.executeCommandWithoutHistory(getEditingDomain(), SetCommand.create(getEditingDomain(), combinedFragment, feature,
- * notification.getOldValue()));
- * return;
- * }
- */
- // update guards on enclosed operands
- for (OLDCustomInteractionOperandEditPart ioep : getOperandChildrenEditParts()) {
- ioep.updateConstraintLabel();
- }
- } else if (UMLPackage.eINSTANCE.getCombinedFragment_Operand().equals(feature)) {
- // Case only call by the model explorer
- CombinedFragment combinedFragment = (CombinedFragment) resolveSemanticElement();
- InteractionOperatorKind interactionOperator = combinedFragment.getInteractionOperator();
- Object newValue = notification.getNewValue();
- if (interactionOperator != null && newValue != null) {
- if (InteractionOperatorKind.OPT_LITERAL.equals(interactionOperator) || InteractionOperatorKind.LOOP_LITERAL.equals(interactionOperator) || InteractionOperatorKind.BREAK_LITERAL.equals(interactionOperator)
- || InteractionOperatorKind.NEG_LITERAL.equals(interactionOperator)) {
- EList<InteractionOperand> operands = combinedFragment.getOperands();
- if (operands != null && operands.size() > 1) {
- // Case of there is already an operand on opt, loop, break and neg
- // CombinedFragment type
- MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, BLOCK_OPERAND_ADDITION_MSG);
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), combinedFragment, feature, newValue), true);
- return;
- }
- }
- }
- } else if (UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature)) {
- if (notification.getNotifier() instanceof CombinedFragment) {
- // Synchronize operands' covered lifelines with combined fragment's covered lifelines
- CombinedFragment combinedFragment = (CombinedFragment) notification.getNotifier();
- EList<Lifeline> combinedFragmentCoveredLifelines = combinedFragment.getCovereds();
- for (InteractionOperand operand : combinedFragment.getOperands()) {
- EList<Lifeline> operandCoveredLifelines = operand.getCovereds();
- if (!operandCoveredLifelines.equals(combinedFragmentCoveredLifelines)) {
- // Add new covered lifelines (not already covered)
- List<Lifeline> coveredLifelinesToAdd = new ArrayList<>(combinedFragmentCoveredLifelines);
- coveredLifelinesToAdd.removeAll(operandCoveredLifelines);
- if (!coveredLifelinesToAdd.isEmpty()) {
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), operand, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToAdd), true);
- }
- // Delete old covered lifelines (not covered anymore)
- List<Lifeline> coveredLifelinesToRemove = new ArrayList<>(operandCoveredLifelines);
- coveredLifelinesToRemove.removeAll(combinedFragmentCoveredLifelines);
- if (!coveredLifelinesToRemove.isEmpty()) {
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), operand, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToRemove), true);
- }
- }
- }
- }
- } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature)) {
- if (notification.getNotifier() instanceof CombinedFragment) {
- refreshLabel();
- }
- }
- if (notification.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.QUALIFIED_NAME.equals(((EAnnotation) notification.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(notification);
- // fixed bug (id=364711) when bounds changed update coveredBys with the figure's bounds.
- if (notification.getNotifier() instanceof Bounds) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater();
- updater.update(OLDCustomCombinedFragmentEditPart.this);
- }
- });
- }
- if ((getModel() != null) && (getModel() == notification.getNotifier())) {
- if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
- refreshLineWidth();
- }
- }
- if (resolveSemanticElement() != null) {
- refreshShadow();
- }
- if (ElementIconUtil.isIconNotification(notification)) {
- refreshLabelIcon();
- }
- }
-
- /**
- * Override to set the transparency to the correct figure
- */
- @Override
- protected void setTransparency(int transp) {
- getPrimaryShape().setTransparency(transp);
- }
-
- /**
- * Override to set the gradient data to the correct figure
- */
- @Override
- protected void setGradient(GradientData gradient) {
- IPapyrusNodeFigure fig = getPrimaryShape();
- FillStyle style = (FillStyle) getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE);
- if (gradient != null) {
- fig.setIsUsingGradient(true);
- ;
- fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle());
- } else {
- fig.setIsUsingGradient(false);
- }
- }
-
- @Override
- public boolean supportsGradient() {
- return true;
- }
-
- @Override
- protected void setBackgroundColor(Color c) {
- PapyrusNodeFigure fig = getPrimaryShape();
- fig.setBackgroundColor(c);
- fig.setIsUsingGradient(false);
- fig.setGradientData(-1, -1, 0);
- }
-
- /**
- * Update header label
- */
- protected void updateHeaderLabel() {
- Object element = resolveSemanticElement();
- if (element instanceof CombinedFragment) {
- CombinedFragment combinedFragment = (CombinedFragment) element;
- String operatorKind = combinedFragment.getInteractionOperator().getName();
- getPrimaryShape().getNameLabel().setText(operatorKind);
- }
- }
-
- /**
- * Return true if the InteractionOperatorKind is allowed
- *
- * @param interactionOperatorLiteral
- * The InteractionOperator to test
- * @return true if allowed
- */
- protected boolean isAllowedInteractionOperator(String interactionOperatorLiteral) {
- return !(InteractionOperatorKind.CONSIDER_LITERAL.getLiteral().equals(interactionOperatorLiteral) || InteractionOperatorKind.IGNORE_LITERAL.getLiteral().equals(interactionOperatorLiteral));
- }
-
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- if (this.propertyListener == null) {
- this.propertyListener = new IEclipsePreferences.IPreferenceChangeListener() {
-
- @Override
- public void preferenceChange(PreferenceChangeEvent event) {
- handlePreferenceChange(event);
- }
- };
- InstanceScope.INSTANCE.getNode("org.eclipse.papyrus.infra.gmfdiag.preferences").addPreferenceChangeListener(this.propertyListener);
- }
- }
-
- protected void handlePreferenceChange(PreferenceChangeEvent event) {
- if (getParent() == null) {
- return;
- }
- String key = event.getKey();
- if (key.equals(getTitlePreferenceKey())) {
- refreshLabel();
- }
- }
-
- public String getTitlePreferenceKey() {
- return "ELEMENT_PapyrusUMLSequenceDiagram_CombinedFragment_CombinedFragmentCompartment.compartment_name.visibility";
- }
-
- public WrappingLabel getTitleLabel() {
- return getPrimaryShape().getTitleLabel();
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshLabelMargin();
- refreshLabelIcon();
- }
-
- /**
- * Refresh margin of named element children labels
- * <ul>
- * <li>Get Css values</li>
- * <li>Get all the children figure</li>
- * <li>If the child is a label then apply the margin</li>
- * </ul>
- */
- public void refreshLabelMargin() {
- IFigure figure = null;
-
- int leftMargin = DEFAULT_MARGIN;
- int rightMargin = DEFAULT_MARGIN;
- int topMargin = DEFAULT_MARGIN;
- int bottomMargin = DEFAULT_MARGIN;
-
- Object model = this.getModel();
-
-
-
- if (model instanceof View) {
- leftMargin = NotationUtils.getIntValue((View) model, LEFT_MARGIN_PROPERTY, DEFAULT_MARGIN);
- rightMargin = NotationUtils.getIntValue((View) model, RIGHT_MARGIN_PROPERTY, DEFAULT_MARGIN);
- topMargin = NotationUtils.getIntValue((View) model, TOP_MARGIN_PROPERTY, DEFAULT_MARGIN);
- bottomMargin = NotationUtils.getIntValue((View) model, BOTTOM_MARGIN_PROPERTY, DEFAULT_MARGIN);
- }
-
-
- // Get all children figures of the Edit Part and set margin according to the retrieve values
- if (this instanceof IPapyrusEditPart) {
- figure = ((IPapyrusEditPart) this).getPrimaryShape();
- List<IPapyrusWrappingLabel> labelChildFigureList = FigureUtils.findChildFigureInstances(figure, IPapyrusWrappingLabel.class);
-
- for (IPapyrusWrappingLabel label : labelChildFigureList) {
- if (label != null) {
- label.setMarginLabel(leftMargin, topMargin, rightMargin, bottomMargin);
- }
- }
- }
-
- }
-
-
- protected void refreshLabelIcon() {
- Image image = ElementIconUtil.getLabelIcon(this);
- getPrimaryShape().getNameLabel().setIcon(image);
- }
-
- // update label visibility and text
- private void refreshLabel() {
- Object element = resolveSemanticElement();
- if (element instanceof CombinedFragment) {
- CombinedFragment combinedFragment = (CombinedFragment) element;
- String name = UMLLabelInternationalization.getInstance().getLabel(combinedFragment);
- int depth = AppearanceHelper.getQualifiedNameDepth(this.getNotationView());
- if (depth == 0) { // full qualified
- name = combinedFragment.getQualifiedName();
- }
- WrappingLabel label = getPrimaryShape().getTitleLabel();
- label.setText(name);
- ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.papyrus.infra.gmfdiag.preferences");
- String visible = store.getString(getTitlePreferenceKey());
- label.setVisible("true".equals(visible));
- }
- }
- protected DirectEditManager getManager() {
- if (manager == null) {
- WrappingLabel label = this.getPrimaryShape().getTitleLabel();
- manager = new TextDirectEditManager(this, TextCellEditorEx.class, new TextCellEditorLocator(label) {
-
- @Override
- public void relocate(CellEditor celleditor) {
- Text text = (Text) celleditor.getControl();
- Rectangle rect = getWrapLabel().getBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- Point right = rect.getRight();
- if (!text.getFont().isDisposed()) {
- if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
- } else {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if (rect.getRight().x > right.x) { // should not exceed right border
- rect.translate(right.x - rect.getRight().x, 0);
- }
- }
- if (!rect.equals(new Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- });
- }
- return manager;
- }
-
- @Override
- protected void performDirectEditRequest(Request request) {
- if (request instanceof DirectEditRequest) {
- WrappingLabel label = getPrimaryShape().getTitleLabel();
- Point location = ((DirectEditRequest) request).getLocation().getCopy();
- label.translateToRelative(location); // convert request location to relative
- if (label.containsPoint(location)) {
- getManager().show();
- }
- }
- }
-
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- @Override
- public IParser getParser() {
- if (parser == null) {
- parser = new CombinedFragmentTitleParser();
- }
- return parser;
- }
-
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
- }
-
- @Override
- public void setLabelText(String text) {
- WrappingLabel label = this.getPrimaryShape().getTitleLabel();
- label.setText(text);
- }
-
- @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();
- if (element != null && parser != null) {
- try {
- IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- }
- }
- }
- return null;
- }
- };
- }
-
- @Override
- public EditPolicy getPrimaryDragEditPolicy() {
- EditPolicy policy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- return policy != null ? policy : new ResizableShapeEditPolicyEx();
- }
-
- class CombinedFragmentDirectEditPolicy extends DirectEditPolicy {
-
- @Override
- protected Command getDirectEditCommand(DirectEditRequest edit) {
- String labelText = (String) edit.getCellEditor().getValue();
- // for CellEditor, null is always returned for invalid values
- if (labelText == null) {
- return null;
- }
- ITextAwareEditPart compartment = (ITextAwareEditPart) getHost();
- EObject model = (EObject) compartment.getModel();
- EObjectAdapter elementAdapter = null;
- if (model instanceof View) {
- View view = (View) model;
- elementAdapter = new EObjectAdapterEx(ViewUtil.resolveSemanticElement(view), view);
- } else {
- elementAdapter = new EObjectAdapterEx(model, null);
- }
- String prevText = compartment.getParser().getEditString(elementAdapter, compartment.getParserOptions().intValue());
- // check to make sure an edit has occurred before returning a command.
- if (!prevText.equals(labelText)) {
- ICommand iCommand = compartment.getParser().getParseCommand(elementAdapter, labelText, 0);
- return new ICommandProxy(iCommand);
- }
- return null;
- }
-
- @Override
- protected void showCurrentEditValue(DirectEditRequest request) {
- String value = (String) request.getCellEditor().getValue();
- WrappingLabel label = getPrimaryShape().getTitleLabel();
- label.setText(value);
- }
+ @Deprecated
+ private OLDCustomCombinedFragmentEditPart() {
+ // Deprecated
}
static class CombinedFragmentTitleParser extends MessageFormatParser implements ISemanticParser {
@@ -833,9 +209,9 @@ public class OLDCustomCombinedFragmentEditPart extends CombinedFragmentEditPart
* constructor
*
* @param element
- * element to be wrapped
+ * element to be wrapped
* @param view
- * view to be wrapped
+ * view to be wrapped
*/
public EObjectAdapterEx(EObject element, View view) {
super(element);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionInteractionCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionInteractionCompartmentEditPart.java
deleted file mode 100644
index e2fd5da0aa5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionInteractionCompartmentEditPart.java
+++ /dev/null
@@ -1,96 +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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDCombinedFragmentCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.util.HighlightUtil;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- * @since 3.0
- */
-public class OLDCustomInteractionInteractionCompartmentEditPart extends InteractionInteractionCompartmentEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- */
- public OLDCustomInteractionInteractionCompartmentEditPart(View view) {
- super(view);
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new OLDCombinedFragmentCreationEditPolicy());
- removeEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE);
- }
-
- /**
- * Generated not for send to back CombinedFragment and InteractionUse {@inheritDoc}
- */
- // TODO Use transparency instead of send to back method
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (childEditPart instanceof CombinedFragmentEditPart || childEditPart instanceof ConsiderIgnoreFragmentEditPart || childEditPart instanceof InteractionUseEditPart) {
- index = 0;
- }
- super.addChildVisual(childEditPart, index);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#
- * showTargetFeedback(org.eclipse.gef.Request)
- */
- @Override
- public void showTargetFeedback(Request request) {
- if (!isEditModeEnabled() || !isActive()) {
- return;
- }
- // Avoid default drop feedback by setting background, just highlight it
- // with bold border.
- EditPolicyIterator i = getEditPolicyIterator();
- while (i.hasNext()) {
- EditPolicy next = i.next();
- if (REQ_CREATE.equals(request.getType()) && next.getClass().getName().equals("org.eclipse.papyrus.infra.gmfdiag.dnd.policy.CustomizableDropEditPolicy")) {
- HighlightUtil.highlight(this);
- } else {
- next.showTargetFeedback(request);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#
- * eraseTargetFeedback(org.eclipse.gef.Request)
- */
- @Override
- public void eraseTargetFeedback(Request request) {
- super.eraseTargetFeedback(request);
- HighlightUtil.unhighlight(this);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java
index 70910b0df08..2381cc10cd0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java
@@ -42,7 +42,6 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.ReconnectRequest;
import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
@@ -110,6 +109,8 @@ import org.eclipse.uml2.uml.ValueSpecification;
/**
* @author Jin Liu (jin.liu@soyatec.com)
* @deprecated
+ *
+ * XXX Check remaining usages
*/
@Deprecated
public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditPart implements ITextAwareEditPart {
@@ -174,7 +175,7 @@ public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditP
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- //installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
+ // installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new GuardConditionDirectEditPolicy());
removeEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE);
// display stereotype
@@ -214,7 +215,7 @@ public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditP
* Get the initial position of the continuation
*
* @param borderItemEditPart
- * the borderItemEditPart
+ * the borderItemEditPart
* @return the initial position. ContinuationLocator.BOTTOM if none found
*/
private int getContinuationPosition(IBorderItemEditPart borderItemEditPart) {
@@ -751,13 +752,6 @@ public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditP
if (ignoreRequest(request)) {
return null;
}
- if (request instanceof ReconnectRequest) {
- if (REQ_RECONNECT_SOURCE.equals(request.getType()) && ((ReconnectRequest) request).getConnectionEditPart().getSource() instanceof OLDGateEditPart) {
- return getParent().getParent().getCommand(request);
- } else if (REQ_RECONNECT_TARGET.equals(request.getType()) && ((ReconnectRequest) request).getConnectionEditPart().getTarget() instanceof OLDGateEditPart) {
- return getParent().getParent().getCommand(request);
- }
- }
return super.getCommand(request);
}
@@ -834,7 +828,7 @@ public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditP
* Update the interaction constraint value
*
* @param interactionOperand
- * The UML Interaction Operand
+ * The UML Interaction Operand
*/
protected void updateConstraintLabel() {
// Show or Hide Guard: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402966
@@ -1055,9 +1049,9 @@ public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditP
* constructor
*
* @param element
- * element to be wrapped
+ * element to be wrapped
* @param view
- * view to be wrapped
+ * view to be wrapped
*/
public EObjectAdapterEx(EObject element, View view) {
super(element);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionUseEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionUseEditPart.java
deleted file mode 100644
index 6feb564acca..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionUseEditPart.java
+++ /dev/null
@@ -1,414 +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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-
-import java.lang.reflect.Field;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Shape;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-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.figures.BorderedNodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGateCreationEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGatesHolderGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.figures.InteractionUseRectangleFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionUseUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater;
-import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
-import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * Add implementing IPapyrusEditPart to displaying Stereotypes.
- *
- * @author Jin Liu (jin.liu@soyatec.com)
- */
-public class OLDCustomInteractionUseEditPart extends InteractionUseEditPart {
-
- /**
- * Notfier for listen and unlistend model element.
- */
- private NotificationHelper notifier = null;
-
- /**
- * Constructor.
- *
- * @param view
- */
- public OLDCustomInteractionUseEditPart(View view) {
- super(view);
- }
-
- /**
- * Try to use the notifier from super class, if not exist, create new one.
- */
- protected NotificationHelper getNotifier() {
- if (notifier == null) {
- try {
- Field f = InteractionUseEditPart.class.getDeclaredField("notifier");
- f.setAccessible(true);
- notifier = (NotificationHelper) f.get(this);
- } catch (Exception e) {
- notifier = new NotificationHelper(new UIAdapterImpl() {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- handleNotificationEvent(msg);
- }
- });
- }
- }
- return notifier;
- }
-
- @Override
- protected void setLineWidth(int width) {
- if (primaryShape instanceof Shape) {
- ((Shape) primaryShape).setLineWidth(width);
- }
- super.setLineWidth(width);
- }
-
- @Override
- protected IFigure createNodeShape() {
- primaryShape = new InteractionUseRectangleFigure();
- getPrimaryShape().setShadow(false);
- return primaryShape;
- }
-
- /**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- // installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new SequenceGraphicalNodeEditPolicy());
- // Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDGatesHolderGraphicalNodeEditPolicy());
- installEditPolicy("Gate Creation Edit Policy", new OLDGateCreationEditPolicy());
- // install a editpolicy to display stereotypes
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
- }
-
- /**
- * Create a BorderedNodeFigure for holding Gates.
- */
- @Override
- protected NodeFigure createNodeFigure() {
- return new BorderedNodeFigure(super.createNodeFigure());
- }
-
- @Override
- protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
- return getContentPane();
- }
-
- @Override
- protected boolean removeFixedChild(EditPart childEditPart) {
- return super.removeFixedChild(childEditPart);
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart#addFixedChild(org.eclipse.gef.EditPart)
- *
- * @param childEditPart
- * @return
- */
- @Override
- protected boolean addFixedChild(EditPart childEditPart) {
- return super.addFixedChild(childEditPart);
- }
-
- /**
- * Override to set the transparency to the correct figure
- */
- @Override
- protected void setTransparency(int transp) {
- getPrimaryShape().setTransparency(transp);
- }
-
- /**
- * sets the back ground color of this edit part
- *
- * @param color
- * the new value of the back ground color
- */
- @Override
- protected void setBackgroundColor(Color color) {
- getPrimaryShape().setBackgroundColor(color);
- getPrimaryShape().setIsUsingGradient(false);
- getPrimaryShape().setGradientData(-1, -1, 0);
- }
-
- /**
- * Override to set the gradient data to the correct figure
- */
- @Override
- protected void setGradient(GradientData gradient) {
- IPapyrusNodeFigure fig = getPrimaryShape();
- FillStyle style = (FillStyle) getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE);
- if (gradient != null) {
- fig.setIsUsingGradient(true);
- ;
- fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle());
- } else {
- fig.setIsUsingGradient(false);
- }
- }
-
- @Override
- public boolean supportsGradient() {
- return true;
- }
-
- /**
- * Handle for gates operator and covered lifelines
- */
- @Override
- protected void handleNotificationEvent(Notification notification) {
- final NotificationHelper notifier = getNotifier();
- Object feature = notification.getFeature();
- if (UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature)) {
- if (notification.getOldValue() instanceof Interaction) {
- notifier.unlistenAll();
- // notifier.unlistenObject((Interaction) notification.getOldValue());
- }
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), interactionUse.getActualGates()), true);
- if (notification.getNewValue() instanceof Interaction) {
- Interaction interaction = (Interaction) notification.getNewValue();
- notifier.listenObject(interaction);
- interactionUse.getActualGates();
- List<Gate> formalGates = interaction.getFormalGates();
- for (Gate formalGate : formalGates) {
- Gate newActualGate = (Gate) EcoreUtil.create(UMLPackage.Literals.GATE);
- newActualGate.setName(formalGate.getName());
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true);
- if (InternationalizationPreferencesUtils.getInternationalizationPreference(formalGate) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(formalGate)) {
- UMLLabelInternationalization.getInstance().setLabel(newActualGate, UMLLabelInternationalization.getInstance().getLabelWithoutUML(formalGate), null);
- }
- notifier.listenObject(formalGate);
- notifier.listenObject(newActualGate);
- }
- }
- } else if (UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature)) {
- activate();
- resizeInteractionFragmentFigure();
- } else if (UMLPackage.eINSTANCE.getInteraction_FormalGate().equals(feature)) {
- // Handle formal gate
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Object oldValue = notification.getOldValue();
- if (oldValue instanceof Gate) {
- notifier.unlistenObject((Gate) oldValue);
- List<Gate> actualGates = interactionUse.getActualGates();
- for (int i = actualGates.size() - 1; i >= 0; i--) {
- Gate element = actualGates.get(i);
- if (((Gate) oldValue).getName().equals(element.getName())) {
- notifier.unlistenObject(element);
- CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), interactionUse, UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), element), true);
- }
- }
- }
- Object newValue = notification.getNewValue();
- if (newValue instanceof Gate) {
- Gate actualGate = interactionUse.createActualGate(((Gate) newValue).getName());
- notifier.listenObject((Gate) newValue);
- notifier.listenObject(actualGate);
- }
- } else if (UMLPackage.eINSTANCE.getInteractionUse_ActualGate().equals(feature)) {
- if (notification.getEventType() == Notification.ADD) {
- // Block manual creation of actual gate
- // if(notification.getNewValue() instanceof Gate) {
- // Gate newActualGate = (Gate)notification.getNewValue();
- // if(!checkActualGateExistence(newActualGate)) {
- // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_CREATION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_CREATION_DLG_MSG);
- // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), newActualGate), true);
- // }
- // }
- } else if (notification.getEventType() == Notification.REMOVE) {
- // Block manual deletion of actual gate
- // if(notification.getOldValue() instanceof Gate) {
- // Gate oldActualGate = (Gate)notification.getOldValue();
- // //There are some issues in redo progress, check if there is other one with same time firstly.
- // InteractionUse interactionUse = (InteractionUse)notification.getNotifier();
- // Gate otherOne = interactionUse.getActualGate(oldActualGate.getName());
- // if(otherOne == null && checkActualGateExistence(oldActualGate)) {
- // MessageDialog.openError(Display.getCurrent().getActiveShell(), NO_ACTUAL_GATE_MANUAL_DELETION_DLG_TITLE, NO_ACTUAL_GATE_MANUAL_DELETION_DLG_MSG);
- // CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), resolveSemanticElement(), UMLPackage.eINSTANCE.getInteractionUse_ActualGate(), oldActualGate), true);
- // }
- // }
- }
- } else if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) && notification.getNotifier() instanceof Gate) {
- Gate gate = (Gate) notification.getNotifier();
- if (gate.eContainer() instanceof Interaction) {
- // Handle modification of formal gate's name
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- List<Gate> actualGates = interactionUse.getActualGates();
- String oldValue = notification.getOldStringValue();
- String newValue = notification.getNewStringValue();
- for (Gate actualGate : actualGates) {
- if (oldValue == null && actualGate.getName() == null || oldValue != null && oldValue.equals(actualGate.getName())) {
- notifier.unlistenObject(actualGate); // Delete listener on gate
- actualGate.setName(newValue);
- notifier.listenObject(actualGate); // Add listener on gate
- }
- }
- } else if (gate.eContainer() instanceof InteractionUse) {
- // Block modification of actual gate's name
- notifier.unlistenObject(gate); // Delete listener on gate
- gate.setName(notification.getOldStringValue());
- notifier.listenObject(gate); // Add listener on gate
- }
- }
- if ((getModel() != null) && (getModel() == notification.getNotifier())) {
- if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
- refreshLineWidth();
- }
- }
- if (notification.getNotifier() instanceof Bounds) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater();
- updater.update(OLDCustomInteractionUseEditPart.this);
- }
- });
- }
- refreshShadow();
- super.handleNotificationEvent(notification);
- }
-
- /**
- * Check if actual gate is attached to a formal gate
- *
- * @return true if there is a formal gate corresponding to the actual gate
- */
- private boolean checkActualGateExistence(Gate actualGate) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- // Find if the corresponding formal gate exists
- for (Gate formalGate : interaction.getFormalGates()) {
- if (formalGate.getName().equals(actualGate.getName())) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Activate a listener for the interactionUse to Handle notification in the refered Interaction
- */
- @Override
- public void activate() {
- super.activate();
- final NotificationHelper notifier = getNotifier();
- if (resolveSemanticElement() instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction != null) {
- // activate the listener on the referred interaction
- notifier.listenObject(interaction);
- for (Gate formalGate : interaction.getFormalGates()) {
- notifier.listenObject(formalGate);
- }
- }
- for (Gate actualGate : interactionUse.getActualGates()) {
- notifier.listenObject(actualGate);
- }
- }
- }
-
- /**
- * Deactivate a listener for the interactionUse to handle notification in the refered
- * Interaction
- */
- @Override
- public void deactivate() {
- super.deactivate();
- if (notifier != null) {
- notifier.unlistenAll();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void removeNotify() {
- if (notifier != null) {
- notifier.unlistenAll();
- }
- super.removeNotify();
- }
-
- @Override
- public void performRequest(Request request) {
- if (request.getType().equals(REQ_OPEN)) {
- InteractionUse interactionUse = (InteractionUse) resolveSemanticElement();
- Interaction interaction = interactionUse.getRefersTo();
- if (interaction == null) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "There is no referenced interaction!");
- return;
- }
- Diagram diagram = InteractionUseUtil.findDiagram(getNotationView(), interaction);
- if (diagram == null) {
- MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warning", "Cannot find diagram of the referenced interaction!");
- } else {
- InteractionUseUtil.openDiagram(diagram);
- }
- return;
- }
- super.performRequest(request);
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshTransparency();
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java
index 58158023209..1a5437171b0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java
@@ -13,442 +13,20 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-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.common.notify.Notifier;
-import org.eclipse.emf.ecore.EObject;
-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.ChangeBoundsRequest;
-import org.eclipse.gef.requests.CreateRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-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.figures.IBorderItemLocator;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
-import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
-import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper;
-import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator;
-import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGateGraphicalNodeEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.GateModelElementFactory;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* @author Jin Liu (jin.liu@soyatec.com)
*/
-public class OLDGateEditPart extends AbstractBorderEditPart implements IBorderItemEditPart {
+public class OLDGateEditPart {
public static final String GATE_TYPE = "Gate";
public static final Dimension DEFAULT_SIZE = new Dimension(16, 16);
- protected GateFigure primaryShape;
-
- private NotificationHelper notifier = new NotificationHelper(new UIAdapterImpl() {
-
- @Override
- protected void safeNotifyChanged(Notification msg) {
- handleNotificationEvent(msg);
- }
- });
-
- /**
- * Constructor.
- *
- * @param view
- */
- public OLDGateEditPart(View view) {
- super(view);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#activate()
- *
- */
- @Override
- public void activate() {
- super.activate();
- hookExternalGates();
- }
-
- /**
- * Hook external gates such as ActualGate of InteractionUse for a FormalGate of Interaction, outer gate of CombinedFragment for a inner gate of
- * CombinedFragment.
- */
- protected void hookExternalGates() {
- EObject resolveSemanticElement = resolveSemanticElement();
- if (!(resolveSemanticElement instanceof Gate)) {
- return;
- }
- Gate gate = (Gate) resolveSemanticElement;
- if (gate.eContainer() instanceof CombinedFragment) {
- if (!GateHelper.isInnerCFGate(gate)) {
- Message message = gate.getMessage();
- if (message != null) {
- notifier.listenObject(message);
- }
- } else {
- // For CombinedFragment
- Gate outerGate = GateHelper.getOuterCFGate(gate);
- if (outerGate != null) {
- notifier.listenObject(outerGate);
- Message message = outerGate.getMessage();
- if (message != null) {
- notifier.listenObject(message);
- }
- }
- }
- } else if (gate.eContainer() instanceof Interaction) {
- // For gate on interaction
- Gate actualGate = GateHelper.getActualGate(gate);
- if (actualGate != null) {
- notifier.listenObject(actualGate);
- Message message = actualGate.getMessage();
- if (message != null) {
- notifier.listenObject(message);
- }
- }
- }
- }
-
- @Override
- public void deactivate() {
- if (notifier != null) {
- notifier.unlistenAll();
- }
- super.deactivate();
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editparts.BorderUMLNodeEditPart#createDefaultEditPolicies()
- *
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDGateGraphicalNodeEditPolicy());
- }
-
- @Override
- public EditPolicy getPrimaryDragEditPolicy() {
- return new BorderItemSelectionEditPolicy() {
-
- @Override
- protected Command getMoveCommand(ChangeBoundsRequest request) {
- IBorderItemEditPart borderItemEP = (IBorderItemEditPart) getHost();
- IBorderItemLocator borderItemLocator = borderItemEP.getBorderItemLocator();
- if (borderItemLocator != null) {
- PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
- getHostFigure().translateToAbsolute(rect);
- rect.translate(request.getMoveDelta());
- rect.resize(request.getSizeDelta());
- getHostFigure().translateToRelative(rect);
- Rectangle realLocation = borderItemLocator.getValidLocation(rect.getCopy(), borderItemEP.getFigure());
- Point location = realLocation.getLocation();
- ICommand moveCommand = new SetLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location);
- return new ICommandProxy(moveCommand);
- }
- return null;
- }
- };
- }
-
- 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) {
- if (child instanceof OLDGateNameEditPart) {
- 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;
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editparts.BorderNodeEditPart#createMainFigure()
- *
- * @return
- */
- @Override
- protected NodeFigure createMainFigure() {
- return primaryShape = new GateFigure();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart#addChildVisual(org.eclipse.gef.EditPart, int)
- *
- * @param childEditPart
- * @param index
- */
- @Override
- protected void addChildVisual(EditPart childEditPart, int index) {
- if (childEditPart instanceof OLDGateNameEditPart) {
- // BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
- // locator.setBorderItemOffset(new Dimension(-20, 0));
- ExternalLabelPositionLocator locator = new ExternalLabelPositionLocator(getMainFigure());
- getContentPaneFor((OLDGateNameEditPart) childEditPart).add(((OLDGateNameEditPart) childEditPart).getFigure(), locator);
- return;
- }
- super.addChildVisual(childEditPart, index);
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editparts.BorderNodeEditPart#getPrimaryShape()
- *
- * @return
- */
- @Override
- public IPapyrusNodeFigure getPrimaryShape() {
- return primaryShape;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart#removeChildVisual(org.eclipse.gef.EditPart)
- *
- * @param child
- */
- @Override
- protected void removeChildVisual(EditPart child) {
- if (child instanceof OLDGateNameEditPart) {
- getContentPaneFor((OLDGateNameEditPart) child).remove(((OLDGateNameEditPart) child).getFigure());
- return;
- }
- super.removeChildVisual(child);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart#refreshBounds()
- *
- */
- @Override
- protected void refreshBounds() {
- if (getBorderItemLocator() != null) {
- int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Point loc = new Point(x, y);
- getBorderItemLocator().setConstraint(new Rectangle(loc, DEFAULT_SIZE));
- OLDGateNameEditPart labelEditPart = getLabelEditPart();
- if (labelEditPart != null) {
- labelEditPart.refreshBounds();
- }
- }
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart#handleNotificationEvent(org.eclipse.emf.common.notify.Notification)
- *
- * @param event
- */
- @Override
- protected void handleNotificationEvent(Notification event) {
- if (event.isTouch()) {
- return;
- }
- if (GateModelElementFactory.isShowNameChanged(event)) {
- // refresh name child.
- refreshChildren();
- return;
- }
- hookExternalGates();
- if (UMLPackage.eINSTANCE.getNamedElement_Name().equals(event.getFeature())) {
- // Update gate name when the name of message is changed.
- EObject element = resolveSemanticElement();
- if (element instanceof Gate && event.getNotifier() instanceof Message) {
- // Gate gate = (Gate)element;
- // String gateLabel = GateHelper.getGateLabel(gate);
- // if(gateLabel != null && !gateLabel.equals(gate.getName())) {
- // gate.setName(gateLabel);
- // Gate innerCFGate = GateHelper.getInnerCFGate(gate);
- // if(innerCFGate != null && !gateLabel.equals(innerCFGate.getName())) {
- // innerCFGate.setName(gateLabel);
- // }
- // }
- } else {
- refreshGateLabel();
- }
- } else if (UMLPackage.eINSTANCE.getMessageEnd_Message().equals(event.getFeature())) {
- notifier.unlistenObject((Notifier) event.getOldValue());
- notifier.listenObject((Notifier) event.getNewValue());
- refreshGateLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#getModelChildren()
- *
- * @return
- */
- @Override
- protected List getModelChildren() {
- if (GateModelElementFactory.isShowName(getPrimaryView())) {
- return super.getModelChildren();
- } else {
- // Hide name with property changes.
- List modelChildren = new ArrayList(super.getModelChildren());
- Iterator iterator = modelChildren.iterator();
- while (iterator.hasNext()) {
- View next = (View) iterator.next();
- if (OLDGateNameEditPart.GATE_NAME_TYPE.equals(next.getType())) {
- iterator.remove();
- break;
- }
- }
- return modelChildren;
- }
- }
-
- /**
- * Refresh the label of Gate.
- */
- protected void refreshGateLabel() {
- OLDGateNameEditPart labelEditPart = getLabelEditPart();
- if (labelEditPart != null) {
- labelEditPart.refreshLabel();
- }
- }
-
- /**
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#refreshSourceConnections()
- *
- */
- @Override
- protected void refreshSourceConnections() {
- super.refreshSourceConnections();
- OLDGateNameEditPart labelEditPart = getLabelEditPart();
- if (labelEditPart != null) {
- labelEditPart.refreshBounds();
- }
+ @Deprecated
+ private OLDGateEditPart() {
+ // Deprecated
}
- /**
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#refreshTargetConnections()
- *
- */
- @Override
- protected void refreshTargetConnections() {
- super.refreshTargetConnections();
- OLDGateNameEditPart labelEditPart = getLabelEditPart();
- if (labelEditPart != null) {
- labelEditPart.refreshBounds();
- }
- }
-
- /**
- * this method will return the primary child EditPart inside this edit part
- *
- * @return the primary child view inside this edit part
- */
- @Override
- public EditPart getPrimaryChildEditPart() {
- if (getChildren().size() > 0) {
- return (EditPart) getChildren().get(0);
- }
- return super.getPrimaryChildEditPart();
- }
-
- public OLDGateNameEditPart getLabelEditPart() {
- IGraphicalEditPart labelEditPart = getChildBySemanticHint(OLDGateNameEditPart.GATE_NAME_TYPE);
- if (labelEditPart instanceof OLDGateNameEditPart) {
- return (OLDGateNameEditPart) labelEditPart;
- }
- return null;
- }
-
- public class GateFigure extends RoundedCompartmentFigure {
-
- /**
- * Constructor.
- *
- */
- public GateFigure() {
- setBorder(new LineBorder(ColorConstants.black));
- setPreferredSize(DEFAULT_SIZE);
- }
-
- @Override
- protected ConnectionAnchor createDefaultAnchor() {
- return new SlidableAnchor(this) {
-
- @Override
- public Point getLocation(Point reference) {
- Point location = getLocation(new PrecisionPoint(getBox().getCenter()), reference);
- if (location == null) {
- location = getBox().getCenter();
- }
- return location;
- }
- };
- }
-
- @Override
- protected ConnectionAnchor createAnchor(PrecisionPoint p) {
- if (p == null) {
- return createDefaultAnchor();
- }
- return new SlidableAnchor(this, p) {
-
- @Override
- public Point getLocation(Point reference) {
- Rectangle box = getBox();
- Point location = getLocation(new PrecisionPoint(box.getCenter()), reference);
- if (location == null) {
- location = getBox().getCenter();
- }
- return location;
- }
- };
- }
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateNameEditPart.java
index e2916cc6396..bb9816a13b9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateNameEditPart.java
@@ -13,51 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
-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.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
-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.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-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.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
-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.locator.GateLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
-import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* 1. Refactoring with a BorderItemLabelEditPart.
@@ -65,324 +21,21 @@ import org.eclipse.uml2.uml.UMLPackage;
*
* @author Jin Liu (jin.liu@soyatec.com)
* @since 3.0
+ *
+ * @deprecated
*/
-public class OLDGateNameEditPart extends BorderItemLabelEditPart implements IPapyrusEditPart {
+@Deprecated
+public class OLDGateNameEditPart {
public static final String GATE_NAME_TYPE = "Gate_Name";
static {
- registerSnapBackPosition(GATE_NAME_TYPE, new Point(-32, 0));
- }
-
- /**
- * Constructor.
- *
- * @param view
- */
- public OLDGateNameEditPart(View view) {
- super(view);
- }
-
- @Override
- public int getDirectEditionType() {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ BorderItemLabelEditPart.registerSnapBackPosition(GATE_NAME_TYPE, new Point(-32, 0));
}
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- // Display stereotype on name figure.
- installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeLabelEditPolicy());
+ @Deprecated
+ private OLDGateNameEditPart() {
+ // Deprecated
}
- @Override
- public IFigure getPrimaryShape() {
- return getFigure();
- }
-
- @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;
- }
-
- @Override
- protected Point getLocation() {
- Point location = super.getLocation();
- if (location.x == 0 && location.y == 0) {
- Dimension size = getSize();
- EditPart parent = getParent();
- if (parent instanceof OLDGateEditPart) {
- OLDGateEditPart gateEditPart = ((OLDGateEditPart) parent);
- EObject elt = gateEditPart.resolveSemanticElement();
- Dimension preferredSize = getFigure().getPreferredSize(size.width, size.height);
- IBorderItemLocator locator = gateEditPart.getBorderItemLocator();
- if (locator instanceof GateLocator) {
- int alignment = ((GateLocator) locator).getAlignment(((GateLocator) locator).getConstraint());
- if (PositionConstants.LEFT == alignment) {
- if (gateEditPart.getTargetConnections().isEmpty()) {
- location.x = -preferredSize.width - 1;
- } else {
- location.x = OLDGateEditPart.DEFAULT_SIZE.width + 1;
- }
- if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) {
- location.y = OLDGateEditPart.DEFAULT_SIZE.height - 2;// move fown
- } else {
- location.y = -OLDGateEditPart.DEFAULT_SIZE.height + 2;// move up
- }
- } else if (PositionConstants.RIGHT == alignment) {
- if (gateEditPart.getSourceConnections().isEmpty()) {
- location.x = OLDGateEditPart.DEFAULT_SIZE.width + 1;
- } else {
- location.x = -preferredSize.width - 1;
- }
- if (elt instanceof Gate && GateHelper.isInnerCFGate((Gate) elt)) {
- location.y = OLDGateEditPart.DEFAULT_SIZE.height - 2;// move fown
- } else {
- location.y = -OLDGateEditPart.DEFAULT_SIZE.height + 2;// move up
- }
- } else if (PositionConstants.TOP == alignment) {
- location.y = -OLDGateEditPart.DEFAULT_SIZE.height - 1;
- } else if (PositionConstants.BOTTOM == alignment) {
- location.y = OLDGateEditPart.DEFAULT_SIZE.height + 1;
- }
- }
- }
- }
- return location;
- }
-
- @Override
- protected IParser createParser() {
- return new GateNameParser();
- }
-
- @Override
- protected IFigure createFigurePrim() {
- return new GateNameFigure();
- }
-
- public class GateNameParser extends MessageFormatParser implements ISemanticParser {
-
- /**
- * Constructor.
- *
- * @param features
- */
- public GateNameParser() {
- super(new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- /**
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
- *
- * @param adapter
- * @param flags
- * @return
- */
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- // Object element = adapter.getAdapter(EObject.class);
- // if(element instanceof Gate) {
- // Gate gate = (Gate)element;
- // if(gate.eContainer() instanceof CombinedFragment) {
- // Gate outerGate = GateHelper.getOuterCFGate(gate);
- // if(outerGate != null) {
- // gate = outerGate;
- // }
- // } else if(gate.eContainer() instanceof Interaction) {
- // Gate actualGate = GateHelper.getActualGate(gate);
- // if(actualGate != null) {
- // gate = actualGate;
- // }
- // }
- // String printString = getPrintString(gate);
- // if(printString != null) {
- // return printString;
- // }
- // }
- return super.getPrintString(adapter, flags);
- }
-
- /**
- * @param gate
- */
- protected String getPrintString(Gate gate) {
- Message message = gate.getMessage();
- if (message != null) {
- MessageDirection direction = null;
- EObject parent = gate.eContainer();
- if (parent instanceof CombinedFragment) {
- CombinedFragment cf = ((CombinedFragment) parent);
- if (gate == message.getSendEvent()) {
- MessageEnd receiveEvent = message.getReceiveEvent();
- Lifeline lifeline = getCoveredBy(receiveEvent);
- if (!cf.getCovereds().contains(lifeline)) {
- direction = MessageDirection.OUT;
- }
- } else {
- MessageEnd sendEvent = message.getSendEvent();
- Lifeline coveredBy = getCoveredBy(sendEvent);
- if (!cf.getCovereds().contains(coveredBy)) {
- direction = MessageDirection.IN;
- }
- }
- } else if (parent instanceof Interaction) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.IN;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.OUT;
- }
- }
- if (direction == null) {
- if (gate == message.getSendEvent()) {
- direction = MessageDirection.OUT;
- } else if (gate == message.getReceiveEvent()) {
- direction = MessageDirection.IN;
- }
- }
- if (direction != null) {
- StringBuffer buf = new StringBuffer();
- buf.append(direction.getName() + "_");
- buf.append(UMLLabelInternationalization.getInstance().getLabel(message));
- return new String(buf);
- }
- }
- return null;
- }
-
- private Lifeline getCoveredBy(MessageEnd messageEnd) {
- if (messageEnd == null) {
- return null;
- }
- if (messageEnd instanceof OccurrenceSpecification) {
- return ((OccurrenceSpecification) messageEnd).getCovered();
- }
- return null;
- }
-
- 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;
- }
-
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed(org.eclipse.emf.ecore.EObject)
- *
- * @param element
- * @return
- */
- @Override
- public List getSemanticElementsBeingParsed(EObject element) {
- if (element instanceof Gate) {
- return Collections.singletonList(element);
- }
- return Collections.emptyList();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected(org.eclipse.emf.ecore.EObject, java.lang.Object)
- *
- * @param listener
- * @param notification
- * @return
- */
- @Override
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
- }
-
- public class GateNameFigure extends WrappingLabel implements ILabelFigure, IPapyrusNodeUMLElementFigure {
-
- protected static final String LEFT_BRACE = "{";
-
- protected static final String RIGHT_BRACE = "}";
-
- private PapyrusWrappingLabel stereotypesLabel;
-
- private Label stereotypePropertiesLabel;
-
- /**
- * Constructor.
- *
- */
- public GateNameFigure() {
- setBorder(new MarginBorder(2));
- ToolbarLayout layout = new ToolbarLayout(false);
- layout.setStretchMinorAxis(true);
- setLayoutManager(layout);
- createContents();
- }
-
- protected void createContents() {
- setTextWrap(true);
- setAlignment(PositionConstants.CENTER);
- }
-
- @Override
- public void setStereotypeDisplay(String stereotypes, Image image) {
- if (stereotypes == null || stereotypes.trim().equals("")) {
- if (stereotypesLabel != null) {
- this.remove(stereotypesLabel);
- }
- stereotypesLabel = null;
- } else {
- if (stereotypesLabel == null) {
- stereotypesLabel = new PapyrusWrappingLabel(stereotypes, image);
- this.add(stereotypesLabel, 0);
- } else {
- stereotypesLabel.setText(stereotypes);
- stereotypesLabel.setIcon(image);
- }
- }
- }
-
-
- @Override
- public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- if (stereotypeProperties == null || stereotypeProperties.trim().equals("")) {
- if (stereotypePropertiesLabel != null) {
- this.remove(stereotypePropertiesLabel);
- }
- stereotypePropertiesLabel = null;
- } else {
- if (stereotypePropertiesLabel == null) {
- stereotypePropertiesLabel = new Label();
- int index = this.getChildren().indexOf(stereotypesLabel);
- this.add(stereotypePropertiesLabel, index + 1);
- }
- stereotypePropertiesLabel.setText(LEFT_BRACE + stereotypeProperties + RIGHT_BRACE);
- }
- }
-
-
- @Override
- public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
-
- }
-
-
- @Override
- public PapyrusWrappingLabel getStereotypesLabel() {
- return stereotypesLabel;
- }
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java
index c149e371db3..024667259e2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java
@@ -117,7 +117,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineMessageCreateHelper
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineModelChildrenHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineResizeHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.common.util.CacheAdapter;
@@ -277,7 +276,7 @@ public class OLDLifelineEditPart extends LifelineEditPart {
* Return the inner ConnectableElements of the lifeline
*
* @param lifeline
- * The lifeline
+ * The lifeline
* @return inner ConnectableElements
*/
// TODO Extract in a helper
@@ -381,7 +380,7 @@ public class OLDLifelineEditPart extends LifelineEditPart {
* Configure the lifeline
*
* @param inlineMode
- * True if the lifeline is in inline mode
+ * True if the lifeline is in inline mode
*/
private void configure(boolean inlineMode, boolean refresh) {
(getPrimaryShape().getFigureLifelineDotLineFigure()).configure(inlineMode, LifelineEditPartUtil.getInnerConnectableElementList(this).size());
@@ -1249,7 +1248,7 @@ public class OLDLifelineEditPart extends LifelineEditPart {
* for generated figure.
*
* @param nodeShape
- * instance of generated figure class
+ * instance of generated figure class
* @Override Execution specification handling
*/
@Override
@@ -1271,29 +1270,6 @@ public class OLDLifelineEditPart extends LifelineEditPart {
}
public int getAdjustedHeight() {
- if (false == getParent() instanceof OLDCustomInteractionInteractionCompartmentEditPart) {
- return -1;
- }
- OLDCustomInteractionInteractionCompartmentEditPart parentEP = (OLDCustomInteractionInteractionCompartmentEditPart) getParent();
- OldCustomInteractionEditPart grandParent = (OldCustomInteractionEditPart) parentEP.getParent();
- final Bounds bounds = (Bounds) ((Shape) getModel()).getLayoutConstraint();
- final Bounds boundsGrandParent = (Bounds) ((Shape) grandParent.getModel()).getLayoutConstraint();
- if (bounds != null && boundsGrandParent != null) {
- Rectangle grandParentRect = OperandBoundsComputeHelper.fillRectangle(boundsGrandParent);
- if (grandParentRect.height == -1) {
- grandParentRect = grandParent.getFigure().getBounds().getCopy();
- }
- Rectangle boundsRect = OperandBoundsComputeHelper.fillRectangle(bounds);
- if (boundsRect.height == -1) {
- boundsRect.height = this.getFigure().getBounds().height;
- }
- grandParent.getFigure().translateToRelative(boundsRect);
- // return boundsGrandParent.getHeight() - boundsRect.y - LifelineXYLayoutEditPolicy.LIFELINE_SOUTH_SPACING;
- int heightDiff = grandParent.getFigure().getBounds().height - parentEP.getFigure().getBounds().height;
- Dimension zoomedAddon = new Dimension(0, OLDLifelineXYLayoutEditPolicy.LIFELINE_SOUTH_SPACING);
- grandParent.getFigure().translateToRelative(zoomedAddon);
- return grandParentRect.height() - bounds.getY() - heightDiff - zoomedAddon.height;
- }
return -1;
}
@@ -1347,7 +1323,7 @@ public class OLDLifelineEditPart extends LifelineEditPart {
* set the bounds of the lifeline.
*
* @param rect
- * the rectangle corresponding to the bounds.
+ * the rectangle corresponding to the bounds.
*/
public void updateLifelineBounds(final Rectangle rect) {
final Bounds bounds = getBounds();
@@ -1449,7 +1425,7 @@ public class OLDLifelineEditPart extends LifelineEditPart {
* In case of a move, when the lifeline has not be resize, the width or height may be set to -1. Get the according figure bounds.
*
* @param rect
- * the rectangle to update
+ * the rectangle to update
*/
private void updateRectangleBounds(Rectangle rect) {
// When moving the lifeline
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OldCustomInteractionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OldCustomInteractionEditPart.java
index 83f59de9472..b62c8c55d30 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OldCustomInteractionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OldCustomInteractionEditPart.java
@@ -68,7 +68,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionGraphic
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionHeadImpactLayoutEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGateCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.figures.StereotypeInteractionFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.NotificationHelper;
@@ -81,7 +80,10 @@ import org.eclipse.uml2.uml.UMLPackage;
* Add implementing IPapyrusEditPart to displaying Stereotypes.
*
* @author Jin Liu (jin.liu@soyatec.com)
+ *
+ * XXX Check remaining usages
*/
+@Deprecated
public class OldCustomInteractionEditPart extends InteractionEditPart implements IPapyrusEditPart {
/**
@@ -541,13 +543,13 @@ public class OldCustomInteractionEditPart extends InteractionEditPart implements
* Create Anchor
*
* @param request
- * The request
+ * The request
* @param elementType
- * The element type of the message
+ * The element type of the message
* @param visualId
- * The visual ID of the message
+ * The visual ID of the message
* @param messageType
- * The type of the message
+ * The type of the message
* @return The connection anchor
*/
private ConnectionAnchor createAnchor(Request request, IElementType elementType, String visualId, Class<?> messageType) {
@@ -582,7 +584,7 @@ public class OldCustomInteractionEditPart extends InteractionEditPart implements
* Create Anchor
*
* @param location
- * The location
+ * The location
* @return The connection anchor
*/
private ConnectionAnchor createAnchor(Point location) {
@@ -600,9 +602,6 @@ public class OldCustomInteractionEditPart extends InteractionEditPart implements
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.remove(((InteractionInteractionCompartmentEditPart) childEditPart).getFigure());
return true;
- } else if (childEditPart instanceof OLDGateEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((OLDGateEditPart) childEditPart).getFigure());
- return true;
}
return false;
}
@@ -617,10 +616,6 @@ public class OldCustomInteractionEditPart extends InteractionEditPart implements
@Override
protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof OLDGateEditPart) {
- getBorderedFigure().getBorderItemContainer().add(((OLDGateEditPart) childEditPart).getFigure(), new GateLocator((OLDGateEditPart) childEditPart, getFigure()));
- return true;
- }
return super.addFixedChild(childEditPart);
}
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 e0ff8534717..0fe75d9244b 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
@@ -23,23 +23,18 @@ 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.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
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.commands.AddCommand;
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;
@@ -54,12 +49,10 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -106,8 +99,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageReplyEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageSyncEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.StateInvariantEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeConstraintEditPart;
@@ -115,7 +106,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.TimeObservationEditPa
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.CombinedFragmentMoveHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.CoordinateReferentialUtils;
import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceLinkMappingHelper;
@@ -211,110 +201,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
}
@Override
- public Command getCommand(Request request) {
- Command command = super.getCommand(request);
- if (false == request instanceof ChangeBoundsRequest) {
- return command;
- }
-
- boolean someCombinedFragment = false;
- boolean someNonCombinedFragment = false;
-
-
- List<?> editParts = ((ChangeBoundsRequest) request).getEditParts();
-
- if (editParts != null) {
- for (Object part : editParts) {
- someCombinedFragment |= (part instanceof OLDCustomCombinedFragmentEditPart);
- someNonCombinedFragment |= !(part instanceof OLDCustomCombinedFragmentEditPart);
- }
- }
-
- if (someCombinedFragment && someNonCombinedFragment) {
- // Can't Drop CombinedFragment and other nodes at the same time
- return UnexecutableCommand.INSTANCE;
- } else if (someNonCombinedFragment) {
- return command;
- } else {
- return getMoveCombinedFragmentCommand((ChangeBoundsRequest) request);
- }
- }
-
- /*
- * "In-place" drag-and-drop command for Combined Fragment
- */
- protected Command getMoveCombinedFragmentCommand(ChangeBoundsRequest request) {
- CompoundCommand cc = new CompoundCommand("move CombinedFragments to new parent"); //$NON-NLS-1$
-
- Rectangle rectangleDroppedCombined = CombinedFragmentMoveHelper.calcCombinedRect(request);
- GraphicalEditPart newParentEP = CombinedFragmentMoveHelper.findNewParentEP(request, getHost());
-
- List<?> editParts = request.getEditParts();
-
- // Move the request's CFs models and views
- if (editParts != null) {
- for (Object part : editParts) {
- OLDCustomCombinedFragmentEditPart combinedFragmentEP = (OLDCustomCombinedFragmentEditPart) part;
- CombinedFragment combinedFragment = (CombinedFragment) ViewUtil.resolveSemanticElement((View) ((IGraphicalEditPart) combinedFragmentEP).getModel());
-
- if (combinedFragmentEP.getParent() == newParentEP) {
- continue; // no change of the parent
- }
-
- View containerNewParent = (View) newParentEP.getModel();
- EObject contextNewParent = ViewUtil.resolveSemanticElement(containerNewParent);
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
-
- // Move semantic
- Command moveSemanticCmd = getHost().getCommand(new EditCommandRequestWrapper(
- new MoveRequest(editingDomain, contextNewParent, combinedFragment)));
- if (moveSemanticCmd == null) {
- return UnexecutableCommand.INSTANCE;
- }
- cc.add(moveSemanticCmd);
-
- // Move view
- View container = (View) newParentEP.getModel();
- View view = (View) combinedFragmentEP.getModel();
- cc.add(new ICommandProxy(new AddCommand(combinedFragmentEP.getEditingDomain(), new EObjectAdapter(container),
- new EObjectAdapter(view))));
- }
- }
-
- // Calc new parent rect
- Rectangle newParentOldRect = newParentEP.getFigure().getBounds().getCopy();
- newParentEP.getFigure().translateToAbsolute(newParentOldRect);
- Rectangle newParentNewRect = new Rectangle(newParentOldRect.getUnion(rectangleDroppedCombined));
-
- if (getHost().getParent() instanceof OLDCustomCombinedFragmentEditPart) {
- CombinedFragmentMoveHelper.adjustNewParentOperands(cc, newParentNewRect, newParentOldRect, getHost());
- }
- // TODO: resize parent's parent (and so on)
-
- // Move & resize parent CF
- Point newParentOffsetSW = new Point(newParentNewRect.x - newParentOldRect.x, newParentNewRect.y - newParentOldRect.y);
- if (newParentEP.getParent().getParent() != null) {
- final ChangeBoundsRequest moveParentRequest = new ChangeBoundsRequest();
- moveParentRequest.setType(REQ_MOVE);
- moveParentRequest.setMoveDelta(newParentOffsetSW);
- moveParentRequest.setEditParts(newParentEP.getParent().getParent());
- moveParentRequest.setSizeDelta(new Dimension(newParentNewRect.width - newParentOldRect.width,
- newParentNewRect.height - newParentOldRect.height));
- moveParentRequest.setResizeDirection(PositionConstants.SOUTH_WEST);
- cc.add(newParentEP.getParent().getParent().getCommand(moveParentRequest));
- }
-
- if (editParts != null) {
- for (Object part : request.getEditParts()) {
- OLDCustomCombinedFragmentEditPart combinedFragmentEP = (OLDCustomCombinedFragmentEditPart) part;
- CombinedFragmentMoveHelper.moveCombinedFragmentEP(cc, request, combinedFragmentEP, newParentEP, newParentOffsetSW);
- }
- }
-
- return cc;
- }
-
- @Override
protected IUndoableOperation getDropObjectCommand(DropObjectsRequest dropRequest, final EObject droppedObject) {
IUndoableOperation dropObjectCommand = super.getDropObjectCommand(dropRequest, droppedObject);
if (dropObjectCommand != null && dropObjectCommand.canExecute()) {
@@ -436,9 +322,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the drop command for the Element
*
* @param element
- * the Element
+ * the Element
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @return the drop command if the Element can be dropped
*/
private Command dropNodeElement(Element element, String nodeVISUALID, Point location) {
@@ -476,9 +362,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the drop command for the Element
*
* @param element
- * the Element
+ * the Element
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @return the drop command if the element can be dropped
*/
private Command dropCombinedFragment(CombinedFragment combinedFragment, String nodeVISUALID, Point location) {
@@ -618,11 +504,11 @@ 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
+ * the element being dropped from the model
* @param nodeVISUALID
- * node visual id or -1
+ * node visual id or -1
* @param linkVISUALID
- * link visual id or -1
+ * 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
*/
@@ -844,11 +730,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the command to drop an element between two events in order to create a message label
*
* @param droppedElement
- * the dropped element
+ * the dropped element
* @param event1
- * first event (of type MessageOccurrenceSpecification)
+ * first event (of type MessageOccurrenceSpecification)
* @param event2
- * second event (of type MessageOccurrenceSpecification)
+ * second event (of type MessageOccurrenceSpecification)
* @param element
* @return the command or false if the elements can not be dropped as message label
*/
@@ -895,9 +781,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Test whether visual ids are compatible with a duration constraint element
*
* @param nodeVISUALID
- * the detected node visual id
+ * the detected node visual id
* @param linkVISUALID
- * the detected link visual id
+ * the detected link visual id
* @return true if element may be a duration constraint
*/
private boolean isDurationConstraintHint(String nodeVISUALID, String linkVISUALID) {
@@ -912,11 +798,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* 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
+ * the duration observation or duration constraint to display as message label
* @param MessageSyncEditPart
- * the containing message edit part
+ * the containing message edit part
* @param nodeVISUALID
- * the label node visual id
+ * the label node visual id
* @return the command or UnexecutableCommand
*/
private Command dropNodeOnMessage(PackageableElement durationLabelElement, ConnectionNodeEditPart MessageSyncEditPart, String nodeVISUALID) {
@@ -929,9 +815,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Drop a time observation on a lifeline.
*
* @param observation
- * the time constraint
+ * the time constraint
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @param dropLocation
* @return the command if the lifeline is the correct one or UnexecutableCommand
*/
@@ -975,9 +861,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Drop an interval constraint (duration or time) on a lifeline.
*
* @param constraint
- * the interval constraint
+ * the interval constraint
* @param nodeVISUALID
- * the node visual id
+ * the node visual id
* @return the command if the lifeline is the correct one or UnexecutableCommand
*/
private Command dropIntervalConstraintInLifeline(IntervalConstraint constraint, String nodeVISUALID) {
@@ -1035,7 +921,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* 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
- * the node visual id
+ * the node visual id
* @return arbitrary default height for the node visual id (eventually -1)
*/
private int getDefaultDropHeight(String nodeVISUALID) {
@@ -1059,7 +945,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get lifelines element which contains these existingViews
*
* @param existingViews
- * the existing views.
+ * the existing views.
* @return the list of lifeline.
*/
private List<Lifeline> getLifelines(List<View> existingViews) {
@@ -1110,9 +996,9 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Drop a destructionEvent on a lifeline
*
* @param destructionOccurence
- * the destructionEvent to drop
+ * the destructionEvent to drop
* @param nodeVISUALID
- * the node visualID
+ * the node visualID
* @return the command to drop the destructionEvent on a lifeline if allowed.
*/
private Command dropDestructionOccurrence(DestructionOccurrenceSpecification destructionOccurence, String nodeVISUALID, Point location) {
@@ -1140,11 +1026,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the command to drop an execution specification node
*
* @param es
- * execution specification
+ * execution specification
* @param nodeVISUALID
- * the execution specification's visual id
+ * the execution specification's visual id
* @param location
- * the location of the drop request
+ * the location of the drop request
* @return the drop command
*/
private Command dropExecutionSpecification(ExecutionSpecification es, String nodeVISUALID, Point location) {
@@ -1193,11 +1079,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the command to drop a message link
*
* @param dropRequest
- * request to drop
+ * request to drop
* @param semanticLink
- * message link
+ * message link
* @param linkVISUALID
- * the message's visual id
+ * the message's visual id
* @return the drop command
*/
private Command dropMessage(DropObjectsRequest dropRequest, Element semanticLink, String linkVISUALID) {
@@ -1224,20 +1110,20 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* This implementation is very similar to {@link CommonDiagramDragDropEditPolicy#dropBinaryLink(CompositeCommand, Element, Element, int, Point, Element)}.
*
* @param dropRequest
- * the drop request
+ * the drop request
* @param cc
- * the composite command that will contain the set of command to create the binary
- * link
+ * the composite command that will contain the set of command to create the binary
+ * link
* @param source
- * the element source of the link
+ * the element source of the link
* @param target
- * the element target of the link
+ * the element target of the link
* @param linkVISUALID
- * the link VISUALID used to create the view
+ * the link VISUALID used to create the view
* @param location
- * the location the location where the view will be be created
+ * the location the location where the view will be be created
* @param semanticLink
- * the semantic link that will be attached to the view
+ * the semantic link that will be attached to the view
*
* @return the composite command
*/
@@ -1288,13 +1174,13 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the source and target recommended points for creating the link
*
* @param semanticLink
- * link to create
+ * link to create
* @param sourceEditPart
- * edit part source of the link
+ * edit part source of the link
* @param targetEditPart
- * edit part target of the link
+ * edit part target of the link
* @param dropLocation
- * default location if NOT found.
+ * default location if NOT found.
* @return a point array of size 2, with eventually null values (when no point constraint). Index 0 : source location, 1 : target location
*/
private Point[] getLinkSourceAndTargetLocations(Element semanticLink, GraphicalEditPart sourceEditPart, GraphicalEditPart targetEditPart, Point dropLocation) {
@@ -1342,10 +1228,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
possibleSourceLocations = SequenceUtil.findPossibleLocationsForEvent((LifelineEditPart) sourceEditPart, sourceEvent);
}
}
- // find possible source location on Gate
- else if (sourceEditPart instanceof OLDGateEditPart) {
- possibleSourceLocations = SequenceUtil.getAbsoluteBounds(sourceEditPart);
- }
// find location constraints for target
if (targetEvent != null && targetEditPart instanceof LifelineEditPart) {
sourceAndTarget[1] = SequenceUtil.findLocationOfEvent((LifelineEditPart) targetEditPart, targetEvent);
@@ -1353,10 +1235,6 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
possibleTargetLocations = SequenceUtil.findPossibleLocationsForEvent((LifelineEditPart) targetEditPart, targetEvent);
}
}
- // find possible target location on Gate
- else if (targetEditPart instanceof OLDGateEditPart) {
- possibleTargetLocations = SequenceUtil.getAbsoluteBounds(sourceEditPart);
- }
// deduce a possibility
if (sourceAndTarget[0] == null && possibleSourceLocations != null) {
// we must fix the source
@@ -1445,11 +1323,11 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo
* Get the command to drop a general ordering link
*
* @param dropRequest
- * request to drop
+ * request to drop
* @param semanticLink
- * general ordering link
+ * general ordering link
* @param linkVISUALID
- * the link's visual id
+ * the link's visual id
* @return the drop command
*/
private Command dropGeneralOrdering(DropObjectsRequest dropRequest, Element semanticLink, String linkVISUALID) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java
index 539b100e941..c805c4ad241 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java
@@ -13,11 +13,9 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.command.CompoundCommand;
@@ -27,15 +25,10 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
import org.eclipse.gmf.runtime.notation.Anchor;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.figures.StereotypeInteractionFigure;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
@@ -70,30 +63,9 @@ public class InteractionHeadImpactLayoutEditPolicy extends AbstractHeadImpactLay
@Override
protected void doImpactLayout(int resizeDelta) {
CompoundCommand commands = new CompoundCommand();
- // 1. move gate
- {
- List children = getHost().getChildren();
- List<OLDGateEditPart> gates = new ArrayList<>();
- for (Object object : children) {
- if (object instanceof OLDGateEditPart) {
- gates.add((OLDGateEditPart) object);
- }
- }
- if (!gates.isEmpty()) {
- Rectangle rect = getBoundsRect();
- for (OLDGateEditPart gateEditPart : gates) {
- Node view = (Node) gateEditPart.getNotationView();
- Location location = (Location) view.getLayoutConstraint();
- Point pt = new Point(location.getX(), location.getY());
- if (pt.x == rect.x - OLDGateEditPart.DEFAULT_SIZE.width / 2 || pt.x == rect.right() - OLDGateEditPart.DEFAULT_SIZE.width / 2) {
- commands.appendIfCanExecute(new GMFtoEMFCommandWrapper(new SetLocationCommand(getEditingDomain(), "Move gate", gateEditPart, pt.getTranslated(0, resizeDelta))));
- }
- }
- }
- }
// 2. move FoundMessage
{
- List sourceConnections = ((NodeEditPart) getHost()).getSourceConnections();
+ List<?> sourceConnections = ((NodeEditPart) getHost()).getSourceConnections();
for (Object object : sourceConnections) {
if (object instanceof MessageFoundEditPart) {
Edge edge = (Edge) ((MessageFoundEditPart) object).getNotationView();
@@ -111,7 +83,7 @@ public class InteractionHeadImpactLayoutEditPolicy extends AbstractHeadImpactLay
}
// 3. Move LostMessage
{
- List targetConnections = ((NodeEditPart) getHost()).getTargetConnections();
+ List<?> targetConnections = ((NodeEditPart) getHost()).getTargetConnections();
for (Object object : targetConnections) {
if (object instanceof MessageLostEditPart) {
AbstractMessageEditPart message = (AbstractMessageEditPart) object;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGateGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGateGraphicalNodeEditPolicy.java
deleted file mode 100644
index b88f973372d..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGateGraphicalNodeEditPolicy.java
+++ /dev/null
@@ -1,244 +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 v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Soyatec - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Connection;
-import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-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.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand;
-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.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
-import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.sequence.command.OLDCreateGateViewCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-
-/**
- * @author Jin Liu (jin.liu@soyatec.com)
- * @since 3.0
- */
-@SuppressWarnings("unchecked")
-public class OLDGateGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
- request.getExtendedData().put(SequenceRequestConstant.TARGET_MODEL_CONTAINER, getInteractionFragment(request.getLocation()));
- Command command = super.getConnectionCompleteCommand(request);
- if (request instanceof CreateConnectionViewAndElementRequest) {
- CreateConnectionViewAndElementRequest viewRequest = (CreateConnectionViewAndElementRequest) request;
- EditPart sourceEP = viewRequest.getSourceEditPart();
- EObject source = ViewUtil.resolveSemanticElement((View) sourceEP.getModel());
- /*
- * Create Graphical Gate if needed, See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389531
- */
- String semanticHint = viewRequest.getConnectionViewAndElementDescriptor().getSemanticHint();
- // Ignore CoRegion.
- if ((((IHintedType) (UMLElementTypes.Message_AsynchEdge)).getSemanticHint().equals(semanticHint) || ((IHintedType) (UMLElementTypes.Message_ReplyEdge)).getSemanticHint().equals(semanticHint))) {
- if (source instanceof CombinedFragment || source instanceof Interaction || source instanceof InteractionUse) {
- CompoundCommand cc = new CompoundCommand("Redirect to Gate");
- Point location = null;
- IGraphicalEditPart adapter = sourceEP.getAdapter(IGraphicalEditPart.class);
- if (adapter != null) {
- Point sourceLocation = request.getLocation();
- Object object = request.getExtendedData().get(SequenceRequestConstant.SOURCE_LOCATION_DATA);
- if (object instanceof Point) {
- sourceLocation = (Point) object;
- }
- location = GateHelper.computeGateLocation(sourceLocation, adapter.getFigure(), null);
- }
- ConnectionViewDescriptor edgeAdapter = viewRequest.getConnectionViewDescriptor();
- final IAdaptable elementAdapter = edgeAdapter.getElementAdapter();
- if (elementAdapter != null) {
- IAdaptable gateAdapter = new IAdaptable() {
-
- @Override
- public Object getAdapter(Class adapter) {
- if (Gate.class == adapter) {
- Message message = elementAdapter.getAdapter(Message.class);
- MessageEnd sendEvent = message.getSendEvent();
- if (sendEvent instanceof Gate) {
- return sendEvent;
- }
- }
- return null;
- }
- };
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- OLDCreateGateViewCommand createGateCommand = new OLDCreateGateViewCommand(editingDomain, sourceEP, location, gateAdapter);
- cc.add(new ICommandProxy(createGateCommand));
- SetConnectionEndsCommand resetSourceCommand = new SetConnectionEndsCommand(editingDomain, null);
- resetSourceCommand.setEdgeAdaptor(edgeAdapter);
- resetSourceCommand.setNewSourceAdaptor(createGateCommand.getResult());
- cc.add(new ICommandProxy(resetSourceCommand));
- if (cc.canExecute()) {
- command = command.chain(cc);
- }
- }
- }
- }
- }
- return command;
- }
-
- private Gate resolveSemanticElement() {
- return (Gate) ((OLDGateEditPart) getHost()).resolveSemanticElement();
- }
-
- /**
- * Fix bug to find a correct InteractionOperand when connecting on CombinedFragment.
- *
- * @param location
- * @return
- */
- private InteractionFragment getInteractionFragment(Point location) {
- Gate gate = resolveSemanticElement();
- if (gate != null) {
- InteractionFragment fragment = (InteractionFragment) gate.eContainer();
- if (fragment instanceof CombinedFragment) {
- fragment = SequenceUtil.findInteractionFragmentContainerAt(location, getHost());
- if (!(fragment instanceof InteractionOperand)) {
- Rectangle rect = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) getHost());
- fragment = SequenceUtil.findInteractionFragmentContainerAt(rect.getRight(), getHost());
- if (!(fragment instanceof InteractionOperand)) {
- fragment = SequenceUtil.findInteractionFragmentContainerAt(rect.getLeft(), getHost());
- }
- }
- }
- return fragment;
- }
- return null;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getConnectionAndRelationshipCompleteCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getConnectionAndRelationshipCompleteCommand(CreateConnectionViewAndElementRequest request) {
- request.getExtendedData().put(SequenceRequestConstant.TARGET_MODEL_CONTAINER, getInteractionFragment(request.getLocation()));
- return super.getConnectionAndRelationshipCompleteCommand(request);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
- if (request.getSourceEditPart() != null && request.getSourceEditPart() != getHost()) {
- return null;
- }
- request.getExtendedData().put(SequenceRequestConstant.SOURCE_MODEL_CONTAINER, getInteractionFragment(request.getLocation()));
- Rectangle rect = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) getHost());
- request.getExtendedData().put(SequenceRequestConstant.SOURCE_LOCATION_DATA, rect.getLocation());
- return super.getConnectionCreateCommand(request);
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getConnectionAndRelationshipCreateCommand(org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getConnectionAndRelationshipCreateCommand(CreateConnectionViewAndElementRequest request) {
- if (request.getSourceEditPart() != null && request.getSourceEditPart() != getHost()) {
- return null;
- }
- request.getExtendedData().put(SequenceRequestConstant.SOURCE_MODEL_CONTAINER, getInteractionFragment(request.getLocation()));
- Rectangle rect = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) getHost());
- request.getExtendedData().put(SequenceRequestConstant.SOURCE_LOCATION_DATA, rect.getLocation());
- return super.getConnectionAndRelationshipCreateCommand(request);
- }
-
- @Override
- protected Connection createDummyConnection(Request req) {
- PolylineConnection c = (PolylineConnection) super.createDummyConnection(req);
- c.setLineStyle(Graphics.LINE_DASHDOT);
- c.setForegroundColor(ColorConstants.black);
- return c;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getDummyConnectionRouter(org.eclipse.gef.requests.CreateConnectionRequest)
- *
- * @param arg0
- * @return
- */
- @Override
- protected ConnectionRouter getDummyConnectionRouter(CreateConnectionRequest arg0) {
- return LifelineChildGraphicalNodeEditPolicy.messageRouter;
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
- *
- * @param request
- * @return
- */
- @Override
- protected Command getReconnectTargetCommand(ReconnectRequest request) {
- ConnectionEditPart connectionEditPart = request.getConnectionEditPart();
- IGraphicalEditPart adapter = connectionEditPart.getAdapter(IGraphicalEditPart.class);
- if (adapter != null && adapter.resolveSemanticElement() instanceof Message) {
- Message oldMessage = (Message) adapter.resolveSemanticElement();
- Gate gate = resolveSemanticElement();
- if (gate == null || (gate.getMessage() != null && oldMessage != gate.getMessage())) {
- return UnexecutableCommand.INSTANCE;
- }
- }
- return super.getReconnectTargetCommand(request);
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java
index e6830af5eb3..abb270c44b6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java
@@ -21,12 +21,9 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;
@@ -38,7 +35,6 @@ import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.ReconnectRequest;
import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandUtilities;
@@ -50,22 +46,16 @@ import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.sequence.command.OLDCreateGateElementAndViewCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.command.ReconnectToGateCommand;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.locator.GateLocator;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
-import org.eclipse.uml2.uml.Message;
/**
* Graphical Presentation of Gate with In/Out
@@ -86,41 +76,10 @@ public class OLDGatesHolderGraphicalNodeEditPolicy extends OLDSequenceGraphicalN
*/
@Override
protected Command getReconnectSourceCommand(ReconnectRequest request) {
- ConnectionEditPart connection = request.getConnectionEditPart();
- EditPart source = connection.getSource();
- if (source instanceof OLDGateEditPart) {
- if (getHost() == source.getParent()) {
- return getMoveGateCommand((OLDGateEditPart) source, request);
- } else if (isReconnectMessage(request) && !isRedirectFailed(request)) {
- Point location = GateHelper.computeGateLocation(request.getLocation(), getHostFigure(), null);
- CompositeCommand result = new CompositeCommand("");
- OLDCreateGateElementAndViewCommand createGateCommand = new OLDCreateGateElementAndViewCommand(getEditingDomain(), getHost(), location);
- createGateCommand.setCreateInnerCFGate(getHost() instanceof CombinedFragmentEditPart);
- result.add(createGateCommand);
- ReconnectToGateCommand reconnectTargetCommand = new ReconnectToGateCommand(getEditingDomain(), getHost().getViewer(), createGateCommand.getResult(), request);
- result.add(reconnectTargetCommand);
- return new ICommandProxy(result);
- }
- }
return super.getReconnectSourceCommand(request);
}
/**
- * @param gateEditPart
- * @param request
- * @return
- */
- protected Command getMoveGateCommand(OLDGateEditPart gateEditPart, ReconnectRequest request) {
- Rectangle newBounds = new Rectangle(request.getLocation(), OLDGateEditPart.DEFAULT_SIZE);
- IFigure hostFigure = getHostFigure();
- hostFigure.translateToRelative(newBounds);
- GateLocator locator = new GateLocator(hostFigure);
- Rectangle validLocation = locator.getValidLocation(newBounds, gateEditPart.getFigure());
- ICommand command = new SetLocationCommand(getEditingDomain(), "Update Gate Location", new EObjectAdapter(gateEditPart.getNotationView()), validLocation.getLocation());
- return new ICommandProxy(command);
- }
-
- /**
* @see org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDSequenceGraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
*
* @param request
@@ -128,36 +87,9 @@ public class OLDGatesHolderGraphicalNodeEditPolicy extends OLDSequenceGraphicalN
*/
@Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
- ConnectionEditPart connection = request.getConnectionEditPart();
- EditPart target = connection.getTarget();
- if (target instanceof OLDGateEditPart) {
- if (getHost() == target.getParent()) {
- return getMoveGateCommand((OLDGateEditPart) target, request);
- } else if (isReconnectMessage(request) && !isRedirectFailed(request)) {
- Point location = GateHelper.computeGateLocation(request.getLocation(), getHostFigure(), null);
- CompositeCommand result = new CompositeCommand("");
- OLDCreateGateElementAndViewCommand createGateCommand = new OLDCreateGateElementAndViewCommand(getEditingDomain(), getHost(), location);
- createGateCommand.setCreateInnerCFGate(getHost() instanceof CombinedFragmentEditPart);
- result.add(createGateCommand);
- ReconnectToGateCommand reconnectTargetCommand = new ReconnectToGateCommand(getEditingDomain(), getHost().getViewer(), createGateCommand.getResult(), request);
- result.add(reconnectTargetCommand);
- return new ICommandProxy(result);
- }
- }
return super.getReconnectTargetCommand(request);
}
- private boolean isRedirectFailed(ReconnectRequest request) {
- Object data = request.getExtendedData().get(ReconnectToGateCommand.REDIRECT_GATE_FAILED);
- return data != null && "true".equalsIgnoreCase(data.toString());
- }
-
- private boolean isReconnectMessage(ReconnectRequest request) {
- ConnectionEditPart conn = request.getConnectionEditPart();
- IGraphicalEditPart adapter = conn.getAdapter(IGraphicalEditPart.class);
- return adapter != null && adapter.resolveSemanticElement() instanceof Message;
- }
-
/**
* @see org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy#getCommand(org.eclipse.gef.Request)
*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/GateLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/GateLocator.java
index 6106d21433f..bb4d881a5b1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/GateLocator.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/locator/GateLocator.java
@@ -18,20 +18,13 @@ import org.eclipse.draw2d.PositionConstants;
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.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
/**
* @author Jin Liu (jin.liu@soyatec.com)
*/
public class GateLocator extends AdvancedBorderItemLocator {
- private OLDGateEditPart gateEditPart;
-
private Integer alignment;
/**
@@ -43,11 +36,6 @@ public class GateLocator extends AdvancedBorderItemLocator {
super(parentFigure);
}
- public GateLocator(OLDGateEditPart gateEditPart, IFigure parentFigure) {
- super(parentFigure);
- this.gateEditPart = gateEditPart;
- }
-
/**
* @see org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle, org.eclipse.draw2d.IFigure)
*
@@ -139,24 +127,6 @@ public class GateLocator extends AdvancedBorderItemLocator {
}
/**
- * @see org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator#getParentBorder()
- *
- * @return
- */
- @Override
- protected Rectangle getParentBorder() {
- Rectangle parentBorder = super.getParentBorder();
- if (parentBorder.isEmpty() && gateEditPart != null) {
- // This can be only used when the diagram is opening.
- EditPart parent = gateEditPart.getParent();
- if (parent instanceof IGraphicalEditPart) {
- return SequenceUtil.getAbsoluteBounds((IGraphicalEditPart) parent);
- }
- }
- return parentBorder;
- }
-
- /**
* @see org.eclipse.papyrus.uml.diagram.common.locator.AdvancedBorderItemLocator#relocate(org.eclipse.draw2d.IFigure)
*
* @param borderItem
@@ -171,26 +141,11 @@ public class GateLocator extends AdvancedBorderItemLocator {
}
/**
- * @see org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator#getConstraint()
- *
- * @return
- */
- @Override
- public Rectangle getConstraint() {
- if (gateEditPart != null) {
- return getModelConstraint();
- }
- return super.getConstraint();
- }
-
- /**
* @return
*/
protected Rectangle getModelConstraint() {
- // Ensure the constraint is same as the model.
- int x = ((Integer) gateEditPart.getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
- int y = ((Integer) gateEditPart.getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
- Rectangle constraint = new Rectangle(x, y, OLDGateEditPart.DEFAULT_SIZE.width, OLDGateEditPart.DEFAULT_SIZE.height);
- return constraint;
+ // This is an old method that assumes the gateEditPart is non-null; but this edit part no longer exists
+ // That method shouldn't be called, but it is still referenced from getAlignment without any check
+ throw new IllegalStateException();
}
}
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 5b0fc80846b..1c3c9c7c5f4 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
@@ -30,8 +30,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomStateInvariantE
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeConstraintLabelEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeObservationLabelEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GeneralOrderingEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AppliedStereotypeCommentCreationEditPolicyEx;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
@@ -98,7 +96,7 @@ public class PostEditPolicyProvider implements IEditPolicyProvider {
// Replace AppliedStereotypeCommentCreationEditPolicy to a custom one.
if (editPart instanceof AbstractExecutionSpecificationEditPart || editPart instanceof CustomDestructionOccurrenceSpecificationEditPart || editPart instanceof CustomDurationConstraintEditPart || editPart instanceof CustomDurationConstraintEditPart
|| editPart instanceof CustomStateInvariantEditPart || editPart instanceof CustomTimeConstraintLabelEditPart || editPart instanceof CustomTimeObservationLabelEditPart || editPart instanceof AbstractMessageEditPart
- || editPart instanceof GeneralOrderingEditPart || editPart instanceof CustomContinuationEditPart || editPart instanceof OLDCustomInteractionOperandEditPart || editPart instanceof OLDGateEditPart) {
+ || 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/util/CombinedFragmentMoveHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
index 340ebff3603..6c4071d73b2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
@@ -14,30 +14,14 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.util;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionCompartmentXYLayoutEditPolicy;
public class CombinedFragmentMoveHelper {
@@ -60,8 +44,7 @@ public class CombinedFragmentMoveHelper {
if (!rectangleDroppedCombined.isEmpty()) {
rectangleDroppedCombined = new Rectangle(rectangleDropped.getUnion(rectangleDroppedCombined));
- }
- else {
+ } else {
rectangleDroppedCombined = rectangleDropped;
}
}
@@ -73,130 +56,12 @@ public class CombinedFragmentMoveHelper {
}
/**
- * Find the EP that we're dropping to
- *
- */
- public static GraphicalEditPart findNewParentEP(ChangeBoundsRequest request, EditPart hostEP) {
- GraphicalEditPart parentEP = (GraphicalEditPart) hostEP;
- if (hostEP.getParent() instanceof OLDCustomCombinedFragmentEditPart) {
- // Select which InteractionOperand we're dropping to
- OLDCustomCombinedFragmentEditPart hostCFEP = (OLDCustomCombinedFragmentEditPart) hostEP.getParent();
- List<OLDCustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
- if (!operands.isEmpty()) {
- Point location = request.getLocation();
- parentEP = operands.get(0);
- for (OLDCustomInteractionOperandEditPart operand : operands) {
- Rectangle bounds = operand.getFigure().getBounds().getCopy();
- operand.getFigure().translateToAbsolute(bounds);
- if (bounds.contains(location)) {
- parentEP = operand;
- }
- }
- }
- }
- return parentEP;
- }
-
- /**
- * Move new parent's operands
- *
- */
- public static void adjustNewParentOperands(CompoundCommand cc, Rectangle newParentNewRect, Rectangle newParentOldRect, EditPart hostEP) {
- Set<Object> alreadyMovedBlocks = new HashSet<>();
- OLDCustomCombinedFragmentEditPart hostCFEP = (OLDCustomCombinedFragmentEditPart) hostEP.getParent();
- List<OLDCustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
- int moveUpperYOffset = newParentNewRect.y - newParentOldRect.y;
- int moveLowerYOffset = newParentNewRect.height - newParentOldRect.height;
- for (OLDCustomInteractionOperandEditPart operand : operands) {
- Rectangle rectangleOperand = operand.getFigure().getBounds().getCopy();
- operand.getFigure().translateToAbsolute(rectangleOperand);
- Bounds operandBounds = OperandBoundsComputeHelper.getEditPartBounds(operand);
- Rectangle operandRect = OperandBoundsComputeHelper.fillRectangle(operandBounds);
- operandRect.width = newParentNewRect.width;
- int moveItemsOffset = moveUpperYOffset;
- Point offsetInnerCFs = new Point(newParentOldRect.x - newParentNewRect.x, 0);
- if (rectangleOperand.y == newParentOldRect.y) {
- operandRect.height += moveLowerYOffset;
- moveItemsOffset = 0;
- offsetInnerCFs.y = -moveUpperYOffset;
- }
- else if (rectangleOperand.y > newParentOldRect.y) {
- operandRect.y += moveLowerYOffset;
- moveItemsOffset = moveLowerYOffset + moveUpperYOffset;
- }
- ICommand resizeOperandCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(operand, operandRect);
- cc.add(new ICommandProxy(resizeOperandCommand));
- Command adjustInnerCFsCommand = getShiftEnclosedCFsCommand(operand, offsetInnerCFs);
- if (adjustInnerCFsCommand != null) {
- cc.add(adjustInnerCFsCommand);
- }
- Command shiftExecutions = OperandBoundsComputeHelper.getForcedShiftEnclosedFragmentsCommand(operand, moveItemsOffset, alreadyMovedBlocks);
- if (shiftExecutions != null) {
- cc.add(new ICommandProxy(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftExecutions))));
- }
- }
- }
-
- /**
* Shift inner CFs so that they don't change absolute coords
*
*/
+ @Deprecated
public static Command getShiftEnclosedCFsCommand(InteractionOperandEditPart editPart, Point offset) {
- if (editPart == null || offset.x == 0 && offset.y == 0) {
- return null;
- }
- CompoundCommand cc = new CompoundCommand("shift inner CFs"); //$NON-NLS-1$
- List<?> children = editPart.getChildren();
- for (int i = 0; i < children.size(); i++) {
- if (false == children.get(i) instanceof OLDCustomCombinedFragmentEditPart) {
- continue;
- }
- OLDCustomCombinedFragmentEditPart childCF = (OLDCustomCombinedFragmentEditPart) children.get(i);
-
- final ChangeBoundsRequest moveChildCFRequest = new ChangeBoundsRequest();
- moveChildCFRequest.setType(RequestConstants.REQ_MOVE);
- moveChildCFRequest.setMoveDelta(offset);
- moveChildCFRequest.setEditParts(childCF);
- moveChildCFRequest.setResizeDirection(PositionConstants.SOUTH_WEST);
- cc.add(childCF.getCommand(moveChildCFRequest));
-
- }
- if (cc.size() == 0) {
- return null;
- }
- return cc;
- }
-
- /**
- * Move CombinedFragment EP
- *
- */
- public static void moveCombinedFragmentEP(CompoundCommand cc, ChangeBoundsRequest request, OLDCustomCombinedFragmentEditPart combinedFragmentEP, GraphicalEditPart newParentEP, Point newParentOffsetSW) {
- // Calc CF moveDelta
- final ChangeBoundsRequest forceLocationRequest = new ChangeBoundsRequest();
- forceLocationRequest.setType(RequestConstants.REQ_MOVE_CHILDREN);
- Point moveDelta = request.getMoveDelta().getCopy();
-
- // CFs children moveDelta need special processing (no need to translate coords)
- Point childrenMoveDelta = moveDelta.getCopy();
- HashMap<String, Object> extData = new HashMap<>();
- forceLocationRequest.setExtendedData(extData);
- extData.put(InteractionCompartmentXYLayoutEditPolicy.CHILDREN_MOVEDELTA, childrenMoveDelta);
-
- // Translate moveDelta into new parents coords
- Rectangle oldParentBounds = ((GraphicalEditPart) combinedFragmentEP.getParent()).getFigure().getBounds().getCopy();
- ((GraphicalEditPart) combinedFragmentEP.getParent()).getFigure().translateToAbsolute(oldParentBounds);
- moveDelta.translate(oldParentBounds.x, oldParentBounds.y);
- Rectangle parentBounds = newParentEP.getFigure().getBounds().getCopy();
- newParentEP.getFigure().translateToAbsolute(parentBounds);
- moveDelta.translate(-parentBounds.x - newParentOffsetSW.x, -parentBounds.y - newParentOffsetSW.y);
- forceLocationRequest.setMoveDelta(moveDelta);
-
- Point moveLocation = request.getLocation();
- // newParentEP.getFigure().translateToRelative(moveLocation);
- forceLocationRequest.setLocation(moveLocation);
- forceLocationRequest.setEditParts(combinedFragmentEP);
- cc.add(combinedFragmentEP.getParentInteractionCompartmentEditPart().getCommand(forceLocationRequest));
+ return null;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
index 6da4a2ab97a..81e0d9b7e6e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineHeadUtil.java
@@ -52,7 +52,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPar
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineFigure;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.CombinedFragment;
@@ -79,11 +78,11 @@ public class LifelineHeadUtil {
continue;
}
LifelineFigure primaryShape = lifeline.getPrimaryShape();
-// RectangleFigure figure = primaryShape.getFigureLifelineNameContainerFigure();
-// Rectangle r = figure.getBounds().getCopy();
-// if (!r.isEmpty()) {
-// bottom = Math.max(bottom, r.bottom());
-// }
+ // RectangleFigure figure = primaryShape.getFigureLifelineNameContainerFigure();
+ // Rectangle r = figure.getBounds().getCopy();
+ // if (!r.isEmpty()) {
+ // bottom = Math.max(bottom, r.bottom());
+ // }
}
if (bottom != -1) {
RectangleFigure figure = new RectangleFigure();
@@ -201,13 +200,6 @@ public class LifelineHeadUtil {
if (movedEditParts.contains(object)) {
continue;
}
- if (object instanceof OLDGateEditPart) {
- OLDGateEditPart gate = (OLDGateEditPart) object;
- Command command = getVerticalMoveShapeCommand(gate, moveDelta, false);
- commands.appendIfCanExecute(command);
- movedEditParts.add(gate);
- fillMoveDownMessageEnds(commands, gate, moveDelta, movedEditParts);
- }
}
}
}
@@ -255,11 +247,7 @@ public class LifelineHeadUtil {
for (Object object : sourceConnections) {
ConnectionEditPart conn = (ConnectionEditPart) object;
EditPart target = conn.getTarget();
- if (target instanceof OLDGateEditPart) {
- Command command = getVerticalMoveShapeCommand((OLDGateEditPart) target, moveDelta, false);
- commands.appendIfCanExecute(command);
- movedEditParts.add(target);
- } else if (object instanceof MessageLostEditPart) {
+ if (object instanceof MessageLostEditPart) {
Command command = getMoveAnchorCommand(conn, moveDelta, false);
commands.appendIfCanExecute(command);
}
@@ -270,10 +258,6 @@ public class LifelineHeadUtil {
if (conn instanceof MessageFoundEditPart) {
Command command = getMoveAnchorCommand(conn, moveDelta, true);
commands.appendIfCanExecute(command);
- } else if (conn.getSource() instanceof OLDGateEditPart) {
- Command command = getVerticalMoveShapeCommand((OLDGateEditPart) conn.getSource(), moveDelta, false);
- commands.appendIfCanExecute(command);
- movedEditParts.add(conn.getSource());
}
}
}
@@ -338,18 +322,18 @@ public class LifelineHeadUtil {
}
toMovedLifelines.add(source);
}
-//
-// if (editPart instanceof CustomLifelineEditPart && ((CustomLifelineEditPart) editPart).isInlineMode()) {
-// List<?> children = ((CustomLifelineEditPart) editPart).getChildren();
-// for (Object object : children) {
-// if (object instanceof LifelineEditPart) {
-// collectLifelines(toMovedLifelines, (LifelineEditPart) object);
-// }
-// }
-// if (toMovedLifelines.isEmpty()) {
-// toMovedLifelines.add((LifelineEditPart) editPart);
-// }
-// }
+ //
+ // if (editPart instanceof CustomLifelineEditPart && ((CustomLifelineEditPart) editPart).isInlineMode()) {
+ // List<?> children = ((CustomLifelineEditPart) editPart).getChildren();
+ // for (Object object : children) {
+ // if (object instanceof LifelineEditPart) {
+ // collectLifelines(toMovedLifelines, (LifelineEditPart) object);
+ // }
+ // }
+ // if (toMovedLifelines.isEmpty()) {
+ // toMovedLifelines.add((LifelineEditPart) editPart);
+ // }
+ // }
}
private static Command getVerticalMoveShapeCommand(GraphicalEditPart shapeEditPart, int moveDelta, boolean increaseHeight) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
index c976fb6d7b2..5f259f93002 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
@@ -55,7 +55,6 @@ import org.eclipse.gmf.runtime.notation.Anchor;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Shape;
@@ -63,7 +62,6 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand;
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.AbstractMessageEditPart;
@@ -72,9 +70,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditP
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDLifelineXYLayoutEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -775,17 +770,6 @@ public class OperandBoundsComputeHelper {
}
// Recursively process children
CompoundCommand cc = new CompoundCommand("shift inner CFs' exec blocks"); //$NON-NLS-1$
- List<?> children = editPart.getChildren();
- for (int i = 0; i < children.size(); i++) {
- if (false == children.get(i) instanceof OLDCustomCombinedFragmentEditPart) {
- continue;
- }
- OLDCustomCombinedFragmentEditPart childCF = (OLDCustomCombinedFragmentEditPart) children.get(i);
- List<OLDCustomInteractionOperandEditPart> childOperands = childCF.getOperandChildrenEditParts();
- for (OLDCustomInteractionOperandEditPart childOperand : childOperands) {
- cc.add(getForcedShiftEnclosedFragmentsCommand(childOperand, movedY, alreadyMovedItems));
- }
- }
List<OperandBlock> operandBlocks = getOperandBlocks(editPart);
if (operandBlocks.isEmpty()) {
@@ -1057,7 +1041,7 @@ public class OperandBoundsComputeHelper {
* Check if it is a combined fragment.
*
* @param hint
- * the semantic hint
+ * the semantic hint
* @return
*/
public static boolean isDerivedCombinedFragment(String hint) {
@@ -1326,9 +1310,6 @@ public class OperandBoundsComputeHelper {
Point start = SequenceUtil.getAbsoluteEdgeExtremity(message, true);
Point end = SequenceUtil.getAbsoluteEdgeExtremity(message, false);
Rectangle bounds = new Rectangle(start, end);
- if (message.getSource() instanceof OLDGateEditPart || message.getTarget() instanceof OLDGateEditPart) {
- bounds.expand(0, Math.round((OLDGateEditPart.DEFAULT_SIZE.height - bounds.height) / 2.0));
- }
if (bounds.height < EXECUTION_VERTICAL_MARGIN) {
bounds.height = EXECUTION_VERTICAL_MARGIN;
}
@@ -1636,14 +1617,7 @@ public class OperandBoundsComputeHelper {
if (message != null) {
Edge edge = (Edge) message.getModel();
Connection msgFigure = message.getConnectionFigure();
- if (message.getSource() instanceof OLDGateEditPart) {
- OLDGateEditPart gate = (OLDGateEditPart) message.getSource();
- Location layout = (Location) ((Shape) gate.getNotationView()).getLayoutConstraint();
- Point location = new Point(layout.getX(), layout.getY());
- location.y += moveDelta;
- ICommand command = new SetLocationCommand(getEditingDomain(), "", gate, location);
- commands.add(new ICommandProxy(command));
- } else {
+ { // Source
ConnectionAnchor sourceAnchor = msgFigure.getSourceAnchor();
IdentityAnchor gmfSourceAnchor = (IdentityAnchor) edge.getSourceAnchor();
Rectangle figureBounds = sourceAnchor.getOwner().getBounds();
@@ -1651,14 +1625,8 @@ public class OperandBoundsComputeHelper {
commands.add(new ICommandProxy(getMoveAnchorCommand(moveDelta, figureBounds, gmfSourceAnchor)));
}
}
- if (message.getTarget() instanceof OLDGateEditPart) {
- OLDGateEditPart gate = (OLDGateEditPart) message.getTarget();
- Location layout = (Location) ((Shape) gate.getNotationView()).getLayoutConstraint();
- Point location = new Point(layout.getX(), layout.getY());
- location.y += moveDelta;
- ICommand command = new SetLocationCommand(getEditingDomain(), "", gate, location);
- commands.add(new ICommandProxy(command));
- } else {
+
+ { // Target
IdentityAnchor gmfTargetAnchor = (IdentityAnchor) edge.getTargetAnchor();
ConnectionAnchor targetAnchor = msgFigure.getTargetAnchor();
Rectangle figureBounds = targetAnchor.getOwner().getBounds();

Back to the top