Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatilov2015-11-11 21:35:22 +0000
committerGerrit Code Review @ Eclipse.org2015-11-26 09:57:10 +0000
commit77aafffb1f48e871432ef038a42e4fc73f14d8a0 (patch)
tree5b0fa0e8c3b8f634738286fd3057d0e1cfb476f6 /plugins/uml
parenta2d85bf08432e63c1ecfc8a1f784c58020a8fd41 (diff)
downloadorg.eclipse.papyrus-77aafffb1f48e871432ef038a42e4fc73f14d8a0.tar.gz
org.eclipse.papyrus-77aafffb1f48e871432ef038a42e4fc73f14d8a0.tar.xz
org.eclipse.papyrus-77aafffb1f48e871432ef038a42e4fc73f14d8a0.zip
Bug 481963 - [StateMachine diagram] Should be possible to drop hided
constraint from model explorer Change-Id: Iefc75448384843f58806ccd788d275bb891c4da0 Signed-off-by: ashatilov <shatilov@montages.com>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/ShowHideRelatedLinkEditPolicy.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java7
4 files changed, 78 insertions, 2 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java
index 9b433ee792c..7b2ec3241f9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateMachineDiagramDragDropEditPolicy.java
@@ -64,10 +64,12 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.GMFtoGEFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.adapter.SemanticAdapter;
import org.eclipse.papyrus.infra.gmfdiag.common.commands.CommonDeferredCreateConnectionViewCommand;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.strategy.paste.ShowConstraintContextLink;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CreateViewCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomCompositeStateSetBoundsCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomCompositeStateWithDefaultRegionCreateNodeCommand;
@@ -82,6 +84,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers.StateMachineL
import org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers.Zone;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.locators.CustomEntryExitPointPositionLocator;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConstraintEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.FinalStateEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PseudostateChoiceEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PseudostateDeepHistoryEditPart;
@@ -103,6 +106,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionEditPar
import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
import org.eclipse.uml2.uml.ConnectionPointReference;
+import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.FinalState;
import org.eclipse.uml2.uml.Pseudostate;
@@ -775,6 +779,7 @@ public class CustomStateMachineDiagramDragDropEditPolicy extends CommonDiagramDr
droppableElementsVisualId.add(PseudostateJunctionEditPart.VISUAL_ID);
// add final state
droppableElementsVisualId.add(FinalStateEditPart.VISUAL_ID);
+ droppableElementsVisualId.add(ConstraintEditPart.VISUAL_ID);
// droppableElementsVisualId.add(EntryStateBehaviorEditPart.VISUAL_ID);
return droppableElementsVisualId;
@@ -838,6 +843,8 @@ public class CustomStateMachineDiagramDragDropEditPolicy extends CommonDiagramDr
case PseudostateJoinEditPart.VISUAL_ID:
case PseudostateJunctionEditPart.VISUAL_ID:
return dropPseudostate(dropRequest, semanticElement, nodeVISUALID);
+ case ConstraintEditPart.VISUAL_ID:
+ return dropConstraint(dropRequest, (Constraint) semanticElement, nodeVISUALID);
default:
return super.getSpecificDropCommand(dropRequest, semanticElement, nodeVISUALID, linkVISUALID);
@@ -845,6 +852,27 @@ public class CustomStateMachineDiagramDragDropEditPolicy extends CommonDiagramDr
}
}
+ /**
+ * Returns the command to drop the Constraint + the link to attach it to its contrainted elements
+ *
+ * @param dropRequest
+ * the drop request
+ * @param constraint
+ * the dropped constraint
+ * @param nodeVISUALID
+ * the node visual id
+ *
+ * @return the command
+ */
+ protected Command dropConstraint(DropObjectsRequest dropRequest, Constraint constraint, int nodeVISUALID) {
+ ICommand dropConstraintCommand = getDefaultDropNodeCommand(nodeVISUALID, dropRequest.getLocation(), constraint, dropRequest);
+ if (constraint.getContext() != null) {
+ ShowConstraintContextLink showConstraintContextLink = new ShowConstraintContextLink(getEditingDomain(), (GraphicalEditPart) getHost(), constraint);
+ dropConstraintCommand = dropConstraintCommand.compose(showConstraintContextLink);
+ }
+ return GMFtoGEFCommandWrapper.wrap(dropConstraintCommand);
+ }
+
@Override
public IElementType getUMLElementType(int elementID) {
return UMLElementTypes.getElementType(elementID);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/ShowHideRelatedLinkEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/ShowHideRelatedLinkEditPolicy.java
new file mode 100644
index 00000000000..05e9793c56a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/ShowHideRelatedLinkEditPolicy.java
@@ -0,0 +1,41 @@
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.policies;
+
+import org.eclipse.gmf.tooling.runtime.structure.DiagramStructure;
+import org.eclipse.gmf.tooling.runtime.update.DiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractUMLShowHideRelatedLinkEditPolicy;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
+
+/**
+ * Show Hide link editpolicy for StateMachine Diagram
+ *
+ */
+public class ShowHideRelatedLinkEditPolicy extends AbstractUMLShowHideRelatedLinkEditPolicy {
+
+ /**
+ *
+ * Constructor.
+ */
+ public ShowHideRelatedLinkEditPolicy() {
+ super();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public DiagramUpdater getDiagramUpdater() {
+ return UMLDiagramUpdater.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IDiagramInformationProviderEditPolicy#getDiagramStructure()
+ *
+ * @return
+ */
+ public DiagramStructure getDiagramStructure() {
+ return UMLVisualIDRegistry.TYPED_INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
index 9dfe9976704..14522d0e3f7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.gmfgen
@@ -76,6 +76,10 @@
xsi:type="gmfgen:CustomBehaviour"
key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AbstractShowHideRelatedLinkEditPolicy.SHOW_HIDE_RELATED_LINK_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.ShowHideRelatedLinkEditPolicy"/>
<domainDiagramElement
href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package"/>
<childNodes
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
index d361468a1c1..8cf6f57e3a7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/parts/PackageEditPart.java
@@ -15,6 +15,7 @@ import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AbstractShowHideRelatedLinkEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
@@ -22,6 +23,7 @@ import org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.CustomPackag
import org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.CustomPackageXYLayoutEditPolicy;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.CustomStateMachineDiagramDragDropEditPolicy;
import org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.RemoveOrphanViewPolicy;
+import org.eclipse.papyrus.uml.diagram.statemachine.custom.policies.ShowHideRelatedLinkEditPolicy;
/**
* @generated
@@ -56,13 +58,14 @@ public class PackageEditPart extends PapyrusDiagramEditPart {
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
- //in Papyrus diagrams are not strongly synchronised
- //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.PackageCanonicalEditPolicy());
+ // in Papyrus diagrams are not strongly synchronised
+ // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.statemachine.edit.policies.PackageCanonicalEditPolicy());
installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CustomPackageCreationEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, new CustomPackageXYLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStateMachineDiagramDragDropEditPolicy());
+ installEditPolicy(AbstractShowHideRelatedLinkEditPolicy.SHOW_HIDE_RELATED_LINK_ROLE, new ShowHideRelatedLinkEditPolicy());
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
}
}

Back to the top