Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AcceptEventActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallBeActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInOpaqueActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsReqCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommandCN.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityFinalNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityParameterNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityPartitionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddStructuralFeatureValueActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddVariableValueActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/BroadcastSignalActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CallOperationActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CentralBufferNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CommentCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConditionalNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPostcondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPrecondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintCreateCommandCN.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPostcondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPrecondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CreateObjectActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DataStoreNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DecisionNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DestroyObjectActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPostcondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPrecondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsInCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsOutCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionRegionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/FlowFinalNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ForkNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InitialNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsValueCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsInsertAtCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsValueCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInBroadcastSignalActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallBeActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInDestroyObjectActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInLoopNodeAsVariableCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInOpaqueActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadStructuralFeatureAsObjectCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsReqCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InterruptibleActivityRegionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPostcondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPrecondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/JoinNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/LoopNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/MergeNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OpaqueActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAcceptEventActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallBeActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallOpActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCreateObjectActionAsResultCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsBodyOutputVariableCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsLoopVariableCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsResultCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInOpaqueActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadStructuralFeatureAsResultCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadVariableActionAsResultCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInValSpecActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ParameterCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionOutputPinCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadStructuralFeatureActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadVariableActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendObjectActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendSignalActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SequenceNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ShapeNamedElementCreateCommand.java21
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StructuredActivityNodeCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPostcondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPrecondCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallBeActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInOpaqueActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsReqCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActAsTargetCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValueSpecificationActionCreateCommand.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java13
95 files changed, 2620 insertions, 855 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AcceptEventActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AcceptEventActionCreateCommand.java
index 63788f77715..dc452b749ce 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AcceptEventActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AcceptEventActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.AcceptEventAction;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class AcceptEventActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class AcceptEventActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public AcceptEventActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AcceptEventActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static AcceptEventActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AcceptEventActionCreateCommand(req, eObject);
+ public static AcceptEventActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AcceptEventActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AcceptEventActionCreateCommand(CreateElementRequest req) {
+ public AcceptEventActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class AcceptEventActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAcceptEventAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class AcceptEventActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
AcceptEventAction newElement = UMLFactory.eINSTANCE.createAcceptEventAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_AcceptEventAction_3063(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallBeActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallBeActCreateCommand.java
index ff64369aa0a..dceda611fd5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallBeActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallBeActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActionInputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInCallBeActCreateCommand(req, eObject);
+ public static ActionInputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInCallBeActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInCallBeActCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInCallBeActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActionInputPinInCallBeActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActionInputPinInCallBeActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActAsTargetCreateCommand.java
index d2a332bc970..75b02b5675d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInCallOpActAsTargetCreateCommand extends EditElementC
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInCallOpActAsTargetCreateCommand extends EditElementC
/**
* @generated
*/
- public ActionInputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInCallOpActAsTargetCreateCommand(req, eObject);
+ public static ActionInputPinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInCallOpActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ActionInputPinInCallOpActAsTargetCreateCommand extends EditElementC
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ActionInputPinInCallOpActAsTargetCreateCommand extends EditElementC
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- CallOperationAction owner = (CallOperationAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CallOperationAction qualifiedTarget = (CallOperationAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3026(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActCreateCommand.java
index 1ead694f330..e0fa9770cb9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInCallOpActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActionInputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInCallOpActCreateCommand(req, eObject);
+ public static ActionInputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInCallOpActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInCallOpActCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInCallOpActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActionInputPinInCallOpActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActionInputPinInCallOpActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3021(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInOpaqueActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInOpaqueActCreateCommand.java
index ff438910ea6..7be3a13d66e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInOpaqueActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInOpaqueActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActionInputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInOpaqueActCreateCommand(req, eObject);
+ public static ActionInputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInOpaqueActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInOpaqueActCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInOpaqueActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActionInputPinInOpaqueActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActionInputPinInOpaqueActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- OpaqueAction owner = (OpaqueAction)getElementToEdit();
- owner.getInputValues().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ OpaqueAction qualifiedTarget = (OpaqueAction)target;
+ qualifiedTarget.getInputValues().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3016(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsReqCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsReqCreateCommand.java
index e8254f5d11c..0e7aae7a49d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsReqCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsReqCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInSendObjActAsReqCreateCommand extends EditElementCom
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInSendObjActAsReqCreateCommand extends EditElementCom
/**
* @generated
*/
- public ActionInputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInSendObjActAsReqCreateCommand(req, eObject);
+ public static ActionInputPinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInSendObjActAsReqCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInSendObjActAsReqCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ActionInputPinInSendObjActAsReqCreateCommand extends EditElementCom
if(container.getRequest() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ActionInputPinInSendObjActAsReqCreateCommand extends EditElementCom
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setRequest(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setRequest(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3047(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsTargetCreateCommand.java
index bb04ca36ca3..3cea593cc76 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendObjActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInSendObjActAsTargetCreateCommand extends EditElement
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInSendObjActAsTargetCreateCommand extends EditElement
/**
* @generated
*/
- public ActionInputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInSendObjActAsTargetCreateCommand(req, eObject);
+ public static ActionInputPinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInSendObjActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ActionInputPinInSendObjActAsTargetCreateCommand extends EditElement
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ActionInputPinInSendObjActAsTargetCreateCommand extends EditElement
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3050(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActAsTargetCreateCommand.java
index a1bd991b101..a3aa1ff5650 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInSendSigActAsTargetCreateCommand extends EditElement
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInSendSigActAsTargetCreateCommand extends EditElement
/**
* @generated
*/
- public ActionInputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInSendSigActAsTargetCreateCommand(req, eObject);
+ public static ActionInputPinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInSendSigActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ActionInputPinInSendSigActAsTargetCreateCommand extends EditElement
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ActionInputPinInSendSigActAsTargetCreateCommand extends EditElement
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- SendSignalAction owner = (SendSignalAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendSignalAction qualifiedTarget = (SendSignalAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3061(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActCreateCommand.java
index 195c8c78e9e..2a23ece1f5e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionInputPinInSendSigActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ActionInputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActionInputPinInSendSigActCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActionInputPinInSendSigActCreateCommand extends EditElementCommand
/**
* @generated
*/
- public ActionInputPinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionInputPinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActionInputPinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionInputPinInSendSigActCreateCommand(req, eObject);
+ public static ActionInputPinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionInputPinInSendSigActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionInputPinInSendSigActCreateCommand(CreateElementRequest req) {
+ public ActionInputPinInSendSigActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActionInputPinInSendSigActCreateCommand extends EditElementCommand
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActionInputPinInSendSigActCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActionInputPin_3053(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommand.java
index f22a0dda4c1..4912e626886 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActivityCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActivityCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActivityCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActivityCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActivityCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActivityCreateCommand(req, eObject);
+ public static ActivityCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityCreateCommand(CreateElementRequest req) {
+ public ActivityCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActivityCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivity());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActivityCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Activity newElement = UMLFactory.eINSTANCE.createActivity();
- Package owner = (Package)getElementToEdit();
- owner.getPackagedElements().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Package qualifiedTarget = (Package)target;
+ qualifiedTarget.getPackagedElements().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Activity_2001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommandCN.java
index 79faebdba4f..ce5e980af71 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommandCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityCreateCommandCN.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.BehavioredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActivityCreateCommandCN extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActivityCreateCommandCN extends EditElementCommand {
/**
* @generated
*/
- public ActivityCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ActivityCreateCommandCN(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActivityCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ActivityCreateCommandCN(req, eObject);
+ public static ActivityCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityCreateCommandCN(CreateElementRequest req) {
+ public ActivityCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActivityCreateCommandCN extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivity());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActivityCreateCommandCN extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Activity newElement = UMLFactory.eINSTANCE.createActivity();
- BehavioredClassifier owner = (BehavioredClassifier)getElementToEdit();
- owner.getOwnedBehaviors().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ BehavioredClassifier qualifiedTarget = (BehavioredClassifier)target;
+ qualifiedTarget.getOwnedBehaviors().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Activity_3083(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityFinalNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityFinalNodeCreateCommand.java
index b22505dcbc1..9b940a7670d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityFinalNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityFinalNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ActivityFinalNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActivityFinalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActivityFinalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActivityFinalNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActivityFinalNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActivityFinalNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActivityFinalNodeCreateCommand(req, eObject);
+ public static ActivityFinalNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityFinalNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityFinalNodeCreateCommand(CreateElementRequest req) {
+ public ActivityFinalNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActivityFinalNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivityFinalNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActivityFinalNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActivityFinalNode newElement = UMLFactory.eINSTANCE.createActivityFinalNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActivityFinalNode_3005(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityParameterNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityParameterNodeCreateCommand.java
index 259b304d8ea..3bef7762b1d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityParameterNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityParameterNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ActivityParameterNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActivityParameterNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActivityParameterNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActivityParameterNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActivityParameterNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActivityParameterNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActivityParameterNodeCreateCommand(req, eObject);
+ public static ActivityParameterNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityParameterNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityParameterNodeCreateCommand(CreateElementRequest req) {
+ public ActivityParameterNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActivityParameterNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivityParameterNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActivityParameterNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActivityParameterNode newElement = UMLFactory.eINSTANCE.createActivityParameterNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActivityParameterNode_3059(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityPartitionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityPartitionCreateCommand.java
index c0590f87957..255994f7c10 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityPartitionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActivityPartitionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ActivityPartition;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ActivityPartitionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ActivityPartitionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ActivityPartitionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActivityPartitionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ActivityPartitionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActivityPartitionCreateCommand(req, eObject);
+ public static ActivityPartitionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityPartitionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityPartitionCreateCommand(CreateElementRequest req) {
+ public ActivityPartitionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ActivityPartitionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivityPartition());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ActivityPartitionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActivityPartition newElement = UMLFactory.eINSTANCE.createActivityPartition();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ActivityPartition_3067(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddStructuralFeatureValueActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddStructuralFeatureValueActionCreateCommand.java
index c3e271556e0..e86f0fd2580 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddStructuralFeatureValueActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddStructuralFeatureValueActionCreateCommand.java
@@ -11,11 +11,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,7 +30,7 @@ public class AddStructuralFeatureValueActionCreateCommand extends EditElementCom
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -35,24 +40,25 @@ public class AddStructuralFeatureValueActionCreateCommand extends EditElementCom
/**
* @generated
*/
- public AddStructuralFeatureValueActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AddStructuralFeatureValueActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static AddStructuralFeatureValueActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AddStructuralFeatureValueActionCreateCommand(req, eObject);
+ public static AddStructuralFeatureValueActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AddStructuralFeatureValueActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AddStructuralFeatureValueActionCreateCommand(CreateElementRequest req) {
+ public AddStructuralFeatureValueActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -75,7 +81,9 @@ public class AddStructuralFeatureValueActionCreateCommand extends EditElementCom
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction());
+ return data.isPermitted();
}
/**
@@ -83,8 +91,19 @@ public class AddStructuralFeatureValueActionCreateCommand extends EditElementCom
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
AddStructuralFeatureValueAction newElement = UMLFactory.eINSTANCE.createAddStructuralFeatureValueAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_AddStructuralFeatureValueAction_3091(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddVariableValueActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddVariableValueActionCreateCommand.java
index ec2de737e07..6e266e2913e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddVariableValueActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/AddVariableValueActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.AddVariableValueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class AddVariableValueActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class AddVariableValueActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public AddVariableValueActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AddVariableValueActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static AddVariableValueActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AddVariableValueActionCreateCommand(req, eObject);
+ public static AddVariableValueActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AddVariableValueActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AddVariableValueActionCreateCommand(CreateElementRequest req) {
+ public AddVariableValueActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class AddVariableValueActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAddVariableValueAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class AddVariableValueActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
AddVariableValueAction newElement = UMLFactory.eINSTANCE.createAddVariableValueAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_AddVariableValueAction_3099(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/BroadcastSignalActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/BroadcastSignalActionCreateCommand.java
index c3a6011a126..5e8da048e88 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/BroadcastSignalActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/BroadcastSignalActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.BroadcastSignalAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class BroadcastSignalActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class BroadcastSignalActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public BroadcastSignalActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public BroadcastSignalActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static BroadcastSignalActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new BroadcastSignalActionCreateCommand(req, eObject);
+ public static BroadcastSignalActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new BroadcastSignalActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public BroadcastSignalActionCreateCommand(CreateElementRequest req) {
+ public BroadcastSignalActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class BroadcastSignalActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBroadcastSignalAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class BroadcastSignalActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
BroadcastSignalAction newElement = UMLFactory.eINSTANCE.createBroadcastSignalAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_BroadcastSignalAction_3102(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CallOperationActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CallOperationActionCreateCommand.java
index 0ad92ab5d9e..6215dd3c5e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CallOperationActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CallOperationActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class CallOperationActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class CallOperationActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public CallOperationActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CallOperationActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static CallOperationActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CallOperationActionCreateCommand(req, eObject);
+ public static CallOperationActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CallOperationActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CallOperationActionCreateCommand(CreateElementRequest req) {
+ public CallOperationActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class CallOperationActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCallOperationAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class CallOperationActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CallOperationAction newElement = UMLFactory.eINSTANCE.createCallOperationAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CallOperationAction_3010(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CentralBufferNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CentralBufferNodeCreateCommand.java
index 739725a6ad1..f97a2e52944 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CentralBufferNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CentralBufferNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.CentralBufferNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class CentralBufferNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class CentralBufferNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public CentralBufferNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CentralBufferNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static CentralBufferNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CentralBufferNodeCreateCommand(req, eObject);
+ public static CentralBufferNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CentralBufferNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CentralBufferNodeCreateCommand(CreateElementRequest req) {
+ public CentralBufferNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class CentralBufferNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCentralBufferNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class CentralBufferNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CentralBufferNode newElement = UMLFactory.eINSTANCE.createCentralBufferNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CentralBufferNode_3104(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CommentCreateCommand.java
index 3435ae284f0..57f3863b0f5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CommentCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CommentCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class CommentCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class CommentCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public CommentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static CommentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommand(req, eObject);
+ public static CommentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommand(CreateElementRequest req) {
+ public CommentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class CommentCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class CommentCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Comment newElement = UMLFactory.eINSTANCE.createComment();
- Element owner = (Element)getElementToEdit();
- owner.getOwnedComments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Element qualifiedTarget = (Element)target;
+ qualifiedTarget.getOwnedComments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Comment_3080(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConditionalNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConditionalNodeCreateCommand.java
index 65ec9a06626..17a981d475c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConditionalNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConditionalNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ConditionalNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ConditionalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ConditionalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ConditionalNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConditionalNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConditionalNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConditionalNodeCreateCommand(req, eObject);
+ public static ConditionalNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConditionalNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConditionalNodeCreateCommand(CreateElementRequest req) {
+ public ConditionalNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ConditionalNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConditionalNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ConditionalNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ConditionalNode newElement = UMLFactory.eINSTANCE.createConditionalNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ConditionalNode_3069(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPostcondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPostcondCreateCommand.java
index 7bde58b96a5..f3ec62d8582 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPostcondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPostcondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ConstraintAsLocalPostcondCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ConstraintAsLocalPostcondCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintAsLocalPostcondCreateCommand(req, eObject);
+ public static ConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintAsLocalPostcondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintAsLocalPostcondCreateCommand(CreateElementRequest req) {
+ public ConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ConstraintAsLocalPostcondCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ConstraintAsLocalPostcondCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPostconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPostconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Constraint_3012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPrecondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPrecondCreateCommand.java
index cb1925d128d..34112d72e75 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPrecondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintAsLocalPrecondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ConstraintAsLocalPrecondCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ConstraintAsLocalPrecondCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintAsLocalPrecondCreateCommand(req, eObject);
+ public static ConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintAsLocalPrecondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintAsLocalPrecondCreateCommand(CreateElementRequest req) {
+ public ConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ConstraintAsLocalPrecondCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ConstraintAsLocalPrecondCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPreconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPreconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Constraint_3011(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintCreateCommandCN.java
index 8b1b059c263..51e08cc831c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintCreateCommandCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintCreateCommandCN.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ConstraintCreateCommandCN extends EditElementCommand {
/**
* @generated
*/
- public ConstraintCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommandCN(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommandCN(req, eObject);
+ public static ConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommandCN(CreateElementRequest req) {
+ public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ConstraintCreateCommandCN extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ConstraintCreateCommandCN extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- Namespace owner = (Namespace)getElementToEdit();
- owner.getOwnedRules().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Namespace qualifiedTarget = (Namespace)target;
+ qualifiedTarget.getOwnedRules().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Constraint_3112(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPostcondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPostcondCreateCommand.java
index fd3064c66e6..8c485abafcb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPostcondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPostcondCreateCommand.java
@@ -25,12 +25,17 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -40,7 +45,7 @@ public class ConstraintInActivityAsPostcondCreateCommand extends EditElementComm
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -50,24 +55,25 @@ public class ConstraintInActivityAsPostcondCreateCommand extends EditElementComm
/**
* @generated
*/
- public ConstraintInActivityAsPostcondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintInActivityAsPostcondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConstraintInActivityAsPostcondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintInActivityAsPostcondCreateCommand(req, eObject);
+ public static ConstraintInActivityAsPostcondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintInActivityAsPostcondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintInActivityAsPostcondCreateCommand(CreateElementRequest req) {
+ public ConstraintInActivityAsPostcondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +96,9 @@ public class ConstraintInActivityAsPostcondCreateCommand extends EditElementComm
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -98,8 +106,19 @@ public class ConstraintInActivityAsPostcondCreateCommand extends EditElementComm
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- Namespace owner = (Namespace)getElementToEdit();
- owner.getOwnedRules().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Namespace qualifiedTarget = (Namespace)target;
+ qualifiedTarget.getOwnedRules().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
Behavior childHolder = (Behavior)getElementToEdit();
childHolder.getPostconditions().add(newElement);
ElementInitializers.getInstance().init_Constraint_3003(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPrecondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPrecondCreateCommand.java
index 7be74dd391a..818d64cd7fc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPrecondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ConstraintInActivityAsPrecondCreateCommand.java
@@ -25,12 +25,17 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -40,7 +45,7 @@ public class ConstraintInActivityAsPrecondCreateCommand extends EditElementComma
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -50,24 +55,25 @@ public class ConstraintInActivityAsPrecondCreateCommand extends EditElementComma
/**
* @generated
*/
- public ConstraintInActivityAsPrecondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintInActivityAsPrecondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ConstraintInActivityAsPrecondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintInActivityAsPrecondCreateCommand(req, eObject);
+ public static ConstraintInActivityAsPrecondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintInActivityAsPrecondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintInActivityAsPrecondCreateCommand(CreateElementRequest req) {
+ public ConstraintInActivityAsPrecondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +96,9 @@ public class ConstraintInActivityAsPrecondCreateCommand extends EditElementComma
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -98,8 +106,19 @@ public class ConstraintInActivityAsPrecondCreateCommand extends EditElementComma
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- Namespace owner = (Namespace)getElementToEdit();
- owner.getOwnedRules().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Namespace qualifiedTarget = (Namespace)target;
+ qualifiedTarget.getOwnedRules().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
Behavior childHolder = (Behavior)getElementToEdit();
childHolder.getPreconditions().add(newElement);
ElementInitializers.getInstance().init_Constraint_3002(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CreateObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CreateObjectActionCreateCommand.java
index ba8c7796e18..7d11238d7bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CreateObjectActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/CreateObjectActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class CreateObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class CreateObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public CreateObjectActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CreateObjectActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static CreateObjectActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CreateObjectActionCreateCommand(req, eObject);
+ public static CreateObjectActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CreateObjectActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CreateObjectActionCreateCommand(CreateElementRequest req) {
+ public CreateObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class CreateObjectActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCreateObjectAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class CreateObjectActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CreateObjectAction newElement = UMLFactory.eINSTANCE.createCreateObjectAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CreateObjectAction_3086(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DataStoreNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DataStoreNodeCreateCommand.java
index 1a0fa4840ac..2fa16531d32 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DataStoreNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DataStoreNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.DataStoreNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class DataStoreNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class DataStoreNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public DataStoreNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataStoreNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static DataStoreNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataStoreNodeCreateCommand(req, eObject);
+ public static DataStoreNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataStoreNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataStoreNodeCreateCommand(CreateElementRequest req) {
+ public DataStoreNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class DataStoreNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataStoreNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class DataStoreNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataStoreNode newElement = UMLFactory.eINSTANCE.createDataStoreNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataStoreNode_3078(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DecisionNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DecisionNodeCreateCommand.java
index 5e3af3cfc13..c95dd062b1f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DecisionNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DecisionNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.DecisionNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class DecisionNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class DecisionNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public DecisionNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DecisionNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static DecisionNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DecisionNodeCreateCommand(req, eObject);
+ public static DecisionNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DecisionNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DecisionNodeCreateCommand(CreateElementRequest req) {
+ public DecisionNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class DecisionNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDecisionNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class DecisionNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DecisionNode newElement = UMLFactory.eINSTANCE.createDecisionNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DecisionNode_3038(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DestroyObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DestroyObjectActionCreateCommand.java
index 7ff0a959aa0..c888129e2f9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DestroyObjectActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DestroyObjectActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.DestroyObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class DestroyObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class DestroyObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public DestroyObjectActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DestroyObjectActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static DestroyObjectActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DestroyObjectActionCreateCommand(req, eObject);
+ public static DestroyObjectActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DestroyObjectActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DestroyObjectActionCreateCommand(CreateElementRequest req) {
+ public DestroyObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class DestroyObjectActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestroyObjectAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class DestroyObjectActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DestroyObjectAction newElement = UMLFactory.eINSTANCE.createDestroyObjectAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DestroyObjectAction_3095(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPostcondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPostcondCreateCommand.java
index 9bb29c0ffe2..e3350d39d09 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPostcondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPostcondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class DurationConstraintAsLocalPostcondCreateCommand extends EditElementC
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class DurationConstraintAsLocalPostcondCreateCommand extends EditElementC
/**
* @generated
*/
- public DurationConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static DurationConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintAsLocalPostcondCreateCommand(req, eObject);
+ public static DurationConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintAsLocalPostcondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintAsLocalPostcondCreateCommand(CreateElementRequest req) {
+ public DurationConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class DurationConstraintAsLocalPostcondCreateCommand extends EditElementC
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class DurationConstraintAsLocalPostcondCreateCommand extends EditElementC
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPostconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPostconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DurationConstraint_3035(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPrecondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPrecondCreateCommand.java
index 61eac6466d9..0001ce59d88 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPrecondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/DurationConstraintAsLocalPrecondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class DurationConstraintAsLocalPrecondCreateCommand extends EditElementCo
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class DurationConstraintAsLocalPrecondCreateCommand extends EditElementCo
/**
* @generated
*/
- public DurationConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static DurationConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintAsLocalPrecondCreateCommand(req, eObject);
+ public static DurationConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintAsLocalPrecondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintAsLocalPrecondCreateCommand(CreateElementRequest req) {
+ public DurationConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class DurationConstraintAsLocalPrecondCreateCommand extends EditElementCo
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class DurationConstraintAsLocalPrecondCreateCommand extends EditElementCo
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPreconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPreconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DurationConstraint_3034(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsInCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsInCreateCommand.java
index c812ce8681f..bdf30c0e2bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsInCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsInCreateCommand.java
@@ -25,12 +25,17 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ExpansionNode;
import org.eclipse.uml2.uml.ExpansionRegion;
import org.eclipse.uml2.uml.StructuredActivityNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -40,7 +45,7 @@ public class ExpansionNodeAsInCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -50,24 +55,25 @@ public class ExpansionNodeAsInCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ExpansionNodeAsInCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExpansionNodeAsInCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ExpansionNodeAsInCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExpansionNodeAsInCreateCommand(req, eObject);
+ public static ExpansionNodeAsInCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExpansionNodeAsInCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExpansionNodeAsInCreateCommand(CreateElementRequest req) {
+ public ExpansionNodeAsInCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +96,9 @@ public class ExpansionNodeAsInCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExpansionNode());
+ return data.isPermitted();
}
/**
@@ -98,8 +106,19 @@ public class ExpansionNodeAsInCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExpansionNode newElement = UMLFactory.eINSTANCE.createExpansionNode();
- StructuredActivityNode owner = (StructuredActivityNode)getElementToEdit();
- owner.getNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ StructuredActivityNode qualifiedTarget = (StructuredActivityNode)target;
+ qualifiedTarget.getNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ExpansionRegion childHolder = (ExpansionRegion)getElementToEdit();
childHolder.getInputElements().add(newElement);
ElementInitializers.getInstance().init_ExpansionNode_3074(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsOutCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsOutCreateCommand.java
index dce544c560d..0f15d7dcf11 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsOutCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionNodeAsOutCreateCommand.java
@@ -25,12 +25,17 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.ExpansionNode;
import org.eclipse.uml2.uml.ExpansionRegion;
import org.eclipse.uml2.uml.StructuredActivityNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -40,7 +45,7 @@ public class ExpansionNodeAsOutCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -50,24 +55,25 @@ public class ExpansionNodeAsOutCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ExpansionNodeAsOutCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExpansionNodeAsOutCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ExpansionNodeAsOutCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExpansionNodeAsOutCreateCommand(req, eObject);
+ public static ExpansionNodeAsOutCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExpansionNodeAsOutCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExpansionNodeAsOutCreateCommand(CreateElementRequest req) {
+ public ExpansionNodeAsOutCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +96,9 @@ public class ExpansionNodeAsOutCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExpansionNode());
+ return data.isPermitted();
}
/**
@@ -98,8 +106,19 @@ public class ExpansionNodeAsOutCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExpansionNode newElement = UMLFactory.eINSTANCE.createExpansionNode();
- StructuredActivityNode owner = (StructuredActivityNode)getElementToEdit();
- owner.getNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ StructuredActivityNode qualifiedTarget = (StructuredActivityNode)target;
+ qualifiedTarget.getNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ExpansionRegion childHolder = (ExpansionRegion)getElementToEdit();
childHolder.getOutputElements().add(newElement);
ElementInitializers.getInstance().init_ExpansionNode_3075(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionRegionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionRegionCreateCommand.java
index 0e1ba9d4e80..be0f68f26d9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionRegionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ExpansionRegionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ExpansionRegion;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ExpansionRegionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ExpansionRegionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ExpansionRegionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExpansionRegionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ExpansionRegionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExpansionRegionCreateCommand(req, eObject);
+ public static ExpansionRegionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExpansionRegionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExpansionRegionCreateCommand(CreateElementRequest req) {
+ public ExpansionRegionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ExpansionRegionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExpansionRegion());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ExpansionRegionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExpansionRegion newElement = UMLFactory.eINSTANCE.createExpansionRegion();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ExpansionRegion_3070(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/FlowFinalNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/FlowFinalNodeCreateCommand.java
index bd4c0b37d49..114ff379e3d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/FlowFinalNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/FlowFinalNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.FlowFinalNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class FlowFinalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class FlowFinalNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public FlowFinalNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public FlowFinalNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static FlowFinalNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new FlowFinalNodeCreateCommand(req, eObject);
+ public static FlowFinalNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FlowFinalNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public FlowFinalNodeCreateCommand(CreateElementRequest req) {
+ public FlowFinalNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class FlowFinalNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getFlowFinalNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class FlowFinalNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
FlowFinalNode newElement = UMLFactory.eINSTANCE.createFlowFinalNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_FlowFinalNode_3006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ForkNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ForkNodeCreateCommand.java
index efd08bce041..a89fc618d27 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ForkNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ForkNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ForkNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ForkNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ForkNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ForkNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ForkNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ForkNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ForkNodeCreateCommand(req, eObject);
+ public static ForkNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ForkNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ForkNodeCreateCommand(CreateElementRequest req) {
+ public ForkNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ForkNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getForkNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ForkNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ForkNode newElement = UMLFactory.eINSTANCE.createForkNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ForkNode_3040(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InitialNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InitialNodeCreateCommand.java
index 2e82781f271..c470e24b54e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InitialNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InitialNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.InitialNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InitialNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InitialNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InitialNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InitialNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InitialNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InitialNodeCreateCommand(req, eObject);
+ public static InitialNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InitialNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InitialNodeCreateCommand(CreateElementRequest req) {
+ public InitialNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InitialNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInitialNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InitialNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InitialNode newElement = UMLFactory.eINSTANCE.createInitialNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InitialNode_3004(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand.java
index c91e0f5de03..e2a04a5a692 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.StructuralFeatureAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand exte
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand exte
/**
* @generated
*/
- public InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(req, eObject);
+ public static InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(CreateElementRequest req) {
+ public InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand exte
if(container.getObject() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInAddStructuralFeatureValueActionAsObjectCreateCommand exte
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- StructuralFeatureAction owner = (StructuralFeatureAction)getElementToEdit();
- owner.setObject(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ StructuralFeatureAction qualifiedTarget = (StructuralFeatureAction)target;
+ qualifiedTarget.setObject(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3092(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsValueCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsValueCreateCommand.java
index 47b6808cadc..768c7741611 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsValueCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddStructuralFeatureValueActionAsValueCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.WriteStructuralFeatureAction;
/**
@@ -39,7 +44,7 @@ public class InputPinInAddStructuralFeatureValueActionAsValueCreateCommand exten
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInAddStructuralFeatureValueActionAsValueCreateCommand exten
/**
* @generated
*/
- public InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInAddStructuralFeatureValueActionAsValueCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(req, eObject);
+ public static InputPinInAddStructuralFeatureValueActionAsValueCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(CreateElementRequest req) {
+ public InputPinInAddStructuralFeatureValueActionAsValueCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInAddStructuralFeatureValueActionAsValueCreateCommand exten
if(container.getValue() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInAddStructuralFeatureValueActionAsValueCreateCommand exten
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- WriteStructuralFeatureAction owner = (WriteStructuralFeatureAction)getElementToEdit();
- owner.setValue(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ WriteStructuralFeatureAction qualifiedTarget = (WriteStructuralFeatureAction)target;
+ qualifiedTarget.setValue(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3093(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsInsertAtCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsInsertAtCreateCommand.java
index ccce43cf13f..32389719fc4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsInsertAtCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsInsertAtCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.AddVariableValueAction;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInAddVariableValueActionAsInsertAtCreateCommand extends Edi
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInAddVariableValueActionAsInsertAtCreateCommand extends Edi
/**
* @generated
*/
- public InputPinInAddVariableValueActionAsInsertAtCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInAddVariableValueActionAsInsertAtCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInAddVariableValueActionAsInsertAtCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInAddVariableValueActionAsInsertAtCreateCommand(req, eObject);
+ public static InputPinInAddVariableValueActionAsInsertAtCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInAddVariableValueActionAsInsertAtCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInAddVariableValueActionAsInsertAtCreateCommand(CreateElementRequest req) {
+ public InputPinInAddVariableValueActionAsInsertAtCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInAddVariableValueActionAsInsertAtCreateCommand extends Edi
if(container.getInsertAt() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInAddVariableValueActionAsInsertAtCreateCommand extends Edi
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- AddVariableValueAction owner = (AddVariableValueAction)getElementToEdit();
- owner.setInsertAt(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ AddVariableValueAction qualifiedTarget = (AddVariableValueAction)target;
+ qualifiedTarget.setInsertAt(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3100(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsValueCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsValueCreateCommand.java
index 6d7607a22bf..8f4e2dbbcf3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsValueCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInAddVariableValueActionAsValueCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.WriteVariableAction;
/**
@@ -39,7 +44,7 @@ public class InputPinInAddVariableValueActionAsValueCreateCommand extends EditEl
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInAddVariableValueActionAsValueCreateCommand extends EditEl
/**
* @generated
*/
- public InputPinInAddVariableValueActionAsValueCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInAddVariableValueActionAsValueCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInAddVariableValueActionAsValueCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInAddVariableValueActionAsValueCreateCommand(req, eObject);
+ public static InputPinInAddVariableValueActionAsValueCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInAddVariableValueActionAsValueCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInAddVariableValueActionAsValueCreateCommand(CreateElementRequest req) {
+ public InputPinInAddVariableValueActionAsValueCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInAddVariableValueActionAsValueCreateCommand extends EditEl
if(container.getValue() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInAddVariableValueActionAsValueCreateCommand extends EditEl
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- WriteVariableAction owner = (WriteVariableAction)getElementToEdit();
- owner.setValue(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ WriteVariableAction qualifiedTarget = (WriteVariableAction)target;
+ qualifiedTarget.setValue(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3101(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInBroadcastSignalActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInBroadcastSignalActionCreateCommand.java
index 04074d17294..eb9683836be 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInBroadcastSignalActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInBroadcastSignalActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInBroadcastSignalActionCreateCommand extends EditElementCom
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInBroadcastSignalActionCreateCommand extends EditElementCom
/**
* @generated
*/
- public InputPinInBroadcastSignalActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInBroadcastSignalActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInBroadcastSignalActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInBroadcastSignalActionCreateCommand(req, eObject);
+ public static InputPinInBroadcastSignalActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInBroadcastSignalActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInBroadcastSignalActionCreateCommand(CreateElementRequest req) {
+ public InputPinInBroadcastSignalActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInBroadcastSignalActionCreateCommand extends EditElementCom
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInBroadcastSignalActionCreateCommand extends EditElementCom
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3103(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallBeActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallBeActCreateCommand.java
index ccaf07e5ff8..b90d7aa5235 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallBeActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallBeActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInCallBeActCreateCommand(req, eObject);
+ public static InputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInCallBeActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInCallBeActCreateCommand(CreateElementRequest req) {
+ public InputPinInCallBeActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInCallBeActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInCallBeActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3019(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActAsTargetCreateCommand.java
index 24bfd0b65c9..eed260b1b22 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInCallOpActAsTargetCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInCallOpActAsTargetCreateCommand extends EditElementCommand
/**
* @generated
*/
- public InputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInCallOpActAsTargetCreateCommand(req, eObject);
+ public static InputPinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInCallOpActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req) {
+ public InputPinInCallOpActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInCallOpActAsTargetCreateCommand extends EditElementCommand
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInCallOpActAsTargetCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- CallOperationAction owner = (CallOperationAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CallOperationAction qualifiedTarget = (CallOperationAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3027(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActCreateCommand.java
index bf1adf9094e..54d8c830263 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInCallOpActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInCallOpActCreateCommand(req, eObject);
+ public static InputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInCallOpActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInCallOpActCreateCommand(CreateElementRequest req) {
+ public InputPinInCallOpActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInCallOpActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInCallOpActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3023(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInDestroyObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInDestroyObjectActionCreateCommand.java
index a813b2427b6..37ddda7d456 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInDestroyObjectActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInDestroyObjectActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.DestroyObjectAction;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInDestroyObjectActionCreateCommand extends EditElementComma
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInDestroyObjectActionCreateCommand extends EditElementComma
/**
* @generated
*/
- public InputPinInDestroyObjectActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInDestroyObjectActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInDestroyObjectActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInDestroyObjectActionCreateCommand(req, eObject);
+ public static InputPinInDestroyObjectActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInDestroyObjectActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInDestroyObjectActionCreateCommand(CreateElementRequest req) {
+ public InputPinInDestroyObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInDestroyObjectActionCreateCommand extends EditElementComma
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInDestroyObjectActionCreateCommand extends EditElementComma
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- DestroyObjectAction owner = (DestroyObjectAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ DestroyObjectAction qualifiedTarget = (DestroyObjectAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3096(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInLoopNodeAsVariableCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInLoopNodeAsVariableCreateCommand.java
index 66e21c87e34..f775f727d9f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInLoopNodeAsVariableCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInLoopNodeAsVariableCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.LoopNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInLoopNodeAsVariableCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInLoopNodeAsVariableCreateCommand extends EditElementComman
/**
* @generated
*/
- public InputPinInLoopNodeAsVariableCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInLoopNodeAsVariableCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInLoopNodeAsVariableCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInLoopNodeAsVariableCreateCommand(req, eObject);
+ public static InputPinInLoopNodeAsVariableCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInLoopNodeAsVariableCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInLoopNodeAsVariableCreateCommand(CreateElementRequest req) {
+ public InputPinInLoopNodeAsVariableCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInLoopNodeAsVariableCreateCommand extends EditElementComman
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInLoopNodeAsVariableCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- LoopNode owner = (LoopNode)getElementToEdit();
- owner.getLoopVariableInputs().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ LoopNode qualifiedTarget = (LoopNode)target;
+ qualifiedTarget.getLoopVariableInputs().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3105(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInOpaqueActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInOpaqueActCreateCommand.java
index 255f85ccda9..5749809093e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInOpaqueActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInOpaqueActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInOpaqueActCreateCommand(req, eObject);
+ public static InputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInOpaqueActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInOpaqueActCreateCommand(CreateElementRequest req) {
+ public InputPinInOpaqueActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInOpaqueActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInOpaqueActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- OpaqueAction owner = (OpaqueAction)getElementToEdit();
- owner.getInputValues().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ OpaqueAction qualifiedTarget = (OpaqueAction)target;
+ qualifiedTarget.getInputValues().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadStructuralFeatureAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadStructuralFeatureAsObjectCreateCommand.java
index e1f473bb5d1..93f430d383a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadStructuralFeatureAsObjectCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInReadStructuralFeatureAsObjectCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.StructuralFeatureAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInReadStructuralFeatureAsObjectCreateCommand extends EditEl
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInReadStructuralFeatureAsObjectCreateCommand extends EditEl
/**
* @generated
*/
- public InputPinInReadStructuralFeatureAsObjectCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInReadStructuralFeatureAsObjectCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInReadStructuralFeatureAsObjectCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInReadStructuralFeatureAsObjectCreateCommand(req, eObject);
+ public static InputPinInReadStructuralFeatureAsObjectCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInReadStructuralFeatureAsObjectCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInReadStructuralFeatureAsObjectCreateCommand(CreateElementRequest req) {
+ public InputPinInReadStructuralFeatureAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInReadStructuralFeatureAsObjectCreateCommand extends EditEl
if(container.getObject() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInReadStructuralFeatureAsObjectCreateCommand extends EditEl
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- StructuralFeatureAction owner = (StructuralFeatureAction)getElementToEdit();
- owner.setObject(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ StructuralFeatureAction qualifiedTarget = (StructuralFeatureAction)target;
+ qualifiedTarget.setObject(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3089(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsReqCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsReqCreateCommand.java
index 1c8ee1e77e9..ebed06aac6a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsReqCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsReqCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInSendObjActAsReqCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInSendObjActAsReqCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInSendObjActAsReqCreateCommand(req, eObject);
+ public static InputPinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInSendObjActAsReqCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInSendObjActAsReqCreateCommand(CreateElementRequest req) {
+ public InputPinInSendObjActAsReqCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInSendObjActAsReqCreateCommand extends EditElementCommand {
if(container.getRequest() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInSendObjActAsReqCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setRequest(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setRequest(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3048(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsTargetCreateCommand.java
index 3a162a66bfa..2ae59ebe396 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendObjActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInSendObjActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInSendObjActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- public InputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInSendObjActAsTargetCreateCommand(req, eObject);
+ public static InputPinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInSendObjActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req) {
+ public InputPinInSendObjActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInSendObjActAsTargetCreateCommand extends EditElementComman
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInSendObjActAsTargetCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3051(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActAsTargetCreateCommand.java
index 0031ba8978a..963e584f42b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActAsTargetCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInSendSigActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInSendSigActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- public InputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInSendSigActAsTargetCreateCommand(req, eObject);
+ public static InputPinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInSendSigActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req) {
+ public InputPinInSendSigActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class InputPinInSendSigActAsTargetCreateCommand extends EditElementComman
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class InputPinInSendSigActAsTargetCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- SendSignalAction owner = (SendSignalAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendSignalAction qualifiedTarget = (SendSignalAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3062(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActCreateCommand.java
index 93b4f7a36a8..447b92f7b64 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInSendSigActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InputPin;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class InputPinInSendSigActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class InputPinInSendSigActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public InputPinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InputPinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InputPinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InputPinInSendSigActCreateCommand(req, eObject);
+ public static InputPinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InputPinInSendSigActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InputPinInSendSigActCreateCommand(CreateElementRequest req) {
+ public InputPinInSendSigActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class InputPinInSendSigActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class InputPinInSendSigActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InputPin_3055(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InterruptibleActivityRegionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InterruptibleActivityRegionCreateCommand.java
index 62e253f5e94..09597b832db 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InterruptibleActivityRegionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InterruptibleActivityRegionCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.InterruptibleActivityRegion;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +43,7 @@ public class InterruptibleActivityRegionCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +53,25 @@ public class InterruptibleActivityRegionCreateCommand extends EditElementCommand
/**
* @generated
*/
- public InterruptibleActivityRegionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InterruptibleActivityRegionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static InterruptibleActivityRegionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InterruptibleActivityRegionCreateCommand(req, eObject);
+ public static InterruptibleActivityRegionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterruptibleActivityRegionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InterruptibleActivityRegionCreateCommand(CreateElementRequest req) {
+ public InterruptibleActivityRegionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +94,9 @@ public class InterruptibleActivityRegionCreateCommand extends EditElementCommand
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterruptibleActivityRegion());
+ return data.isPermitted();
}
/**
@@ -96,8 +104,19 @@ public class InterruptibleActivityRegionCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InterruptibleActivityRegion newElement = UMLFactory.eINSTANCE.createInterruptibleActivityRegion();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPostcondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPostcondCreateCommand.java
index 0d675310250..bbd651282f9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPostcondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPostcondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class IntervalConstraintAsLocalPostcondCreateCommand extends EditElementC
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class IntervalConstraintAsLocalPostcondCreateCommand extends EditElementC
/**
* @generated
*/
- public IntervalConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public IntervalConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static IntervalConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new IntervalConstraintAsLocalPostcondCreateCommand(req, eObject);
+ public static IntervalConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new IntervalConstraintAsLocalPostcondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public IntervalConstraintAsLocalPostcondCreateCommand(CreateElementRequest req) {
+ public IntervalConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class IntervalConstraintAsLocalPostcondCreateCommand extends EditElementC
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getIntervalConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class IntervalConstraintAsLocalPostcondCreateCommand extends EditElementC
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
IntervalConstraint newElement = UMLFactory.eINSTANCE.createIntervalConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPostconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPostconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_IntervalConstraint_3033(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPrecondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPrecondCreateCommand.java
index 9e2944218db..cd74edeff5c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPrecondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/IntervalConstraintAsLocalPrecondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class IntervalConstraintAsLocalPrecondCreateCommand extends EditElementCo
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class IntervalConstraintAsLocalPrecondCreateCommand extends EditElementCo
/**
* @generated
*/
- public IntervalConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public IntervalConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static IntervalConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new IntervalConstraintAsLocalPrecondCreateCommand(req, eObject);
+ public static IntervalConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new IntervalConstraintAsLocalPrecondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public IntervalConstraintAsLocalPrecondCreateCommand(CreateElementRequest req) {
+ public IntervalConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class IntervalConstraintAsLocalPrecondCreateCommand extends EditElementCo
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getIntervalConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class IntervalConstraintAsLocalPrecondCreateCommand extends EditElementCo
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
IntervalConstraint newElement = UMLFactory.eINSTANCE.createIntervalConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPreconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPreconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_IntervalConstraint_3032(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/JoinNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/JoinNodeCreateCommand.java
index ea200d7a41d..cd43b5d2911 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/JoinNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/JoinNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.JoinNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class JoinNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class JoinNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public JoinNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public JoinNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static JoinNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new JoinNodeCreateCommand(req, eObject);
+ public static JoinNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new JoinNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public JoinNodeCreateCommand(CreateElementRequest req) {
+ public JoinNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class JoinNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getJoinNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class JoinNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
JoinNode newElement = UMLFactory.eINSTANCE.createJoinNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_JoinNode_3041(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/LoopNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/LoopNodeCreateCommand.java
index 5ba4a4b306a..de97d28b9da 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/LoopNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/LoopNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.LoopNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class LoopNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class LoopNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public LoopNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LoopNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static LoopNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LoopNodeCreateCommand(req, eObject);
+ public static LoopNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LoopNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LoopNodeCreateCommand(CreateElementRequest req) {
+ public LoopNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class LoopNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLoopNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class LoopNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LoopNode newElement = UMLFactory.eINSTANCE.createLoopNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_LoopNode_3071(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/MergeNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/MergeNodeCreateCommand.java
index bc789c240a3..b20ea9bb123 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/MergeNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/MergeNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.MergeNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class MergeNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class MergeNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public MergeNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public MergeNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static MergeNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new MergeNodeCreateCommand(req, eObject);
+ public static MergeNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new MergeNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public MergeNodeCreateCommand(CreateElementRequest req) {
+ public MergeNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class MergeNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getMergeNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class MergeNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
MergeNode newElement = UMLFactory.eINSTANCE.createMergeNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_MergeNode_3039(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OpaqueActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OpaqueActionCreateCommand.java
index 39b2c4d63ab..14f3dc8ac28 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OpaqueActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OpaqueActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OpaqueActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OpaqueActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public OpaqueActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OpaqueActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OpaqueActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OpaqueActionCreateCommand(req, eObject);
+ public static OpaqueActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OpaqueActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OpaqueActionCreateCommand(CreateElementRequest req) {
+ public OpaqueActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OpaqueActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOpaqueAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OpaqueActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OpaqueAction newElement = UMLFactory.eINSTANCE.createOpaqueAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OpaqueAction_3007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAcceptEventActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAcceptEventActionCreateCommand.java
index 4297469cbae..52689618420 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAcceptEventActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAcceptEventActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.AcceptEventAction;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInAcceptEventActionCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInAcceptEventActionCreateCommand extends EditElementComman
/**
* @generated
*/
- public OutputPinInAcceptEventActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInAcceptEventActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInAcceptEventActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInAcceptEventActionCreateCommand(req, eObject);
+ public static OutputPinInAcceptEventActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInAcceptEventActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInAcceptEventActionCreateCommand(CreateElementRequest req) {
+ public OutputPinInAcceptEventActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInAcceptEventActionCreateCommand extends EditElementComman
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInAcceptEventActionCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- AcceptEventAction owner = (AcceptEventAction)getElementToEdit();
- owner.getResults().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ AcceptEventAction qualifiedTarget = (AcceptEventAction)target;
+ qualifiedTarget.getResults().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3064(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand.java
index bcaf10e0bbf..d8011a193c7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.WriteStructuralFeatureAction;
/**
@@ -39,7 +44,7 @@ public class OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand ext
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand ext
/**
* @generated
*/
- public OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(req, eObject);
+ public static OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(CreateElementRequest req) {
+ public OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand ext
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class OutputPinInAddStructuralFeatureValueActionAsResultCreateCommand ext
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- WriteStructuralFeatureAction owner = (WriteStructuralFeatureAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ WriteStructuralFeatureAction qualifiedTarget = (WriteStructuralFeatureAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3094(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallBeActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallBeActCreateCommand.java
index 36daa3de0a0..f665b5d6bbf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallBeActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallBeActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CallAction;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public OutputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInCallBeActCreateCommand(req, eObject);
+ public static OutputPinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInCallBeActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInCallBeActCreateCommand(CreateElementRequest req) {
+ public OutputPinInCallBeActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInCallBeActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInCallBeActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- CallAction owner = (CallAction)getElementToEdit();
- owner.getResults().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CallAction qualifiedTarget = (CallAction)target;
+ qualifiedTarget.getResults().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3020(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallOpActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallOpActCreateCommand.java
index 3c4b694c1d9..908bdc071c2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallOpActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCallOpActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CallAction;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public OutputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInCallOpActCreateCommand(req, eObject);
+ public static OutputPinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInCallOpActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInCallOpActCreateCommand(CreateElementRequest req) {
+ public OutputPinInCallOpActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInCallOpActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInCallOpActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- CallAction owner = (CallAction)getElementToEdit();
- owner.getResults().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CallAction qualifiedTarget = (CallAction)target;
+ qualifiedTarget.getResults().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3024(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCreateObjectActionAsResultCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCreateObjectActionAsResultCreateCommand.java
index be7b0121c1b..b85f48a96d2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCreateObjectActionAsResultCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInCreateObjectActionAsResultCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInCreateObjectActionAsResultCreateCommand extends EditElem
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInCreateObjectActionAsResultCreateCommand extends EditElem
/**
* @generated
*/
- public OutputPinInCreateObjectActionAsResultCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInCreateObjectActionAsResultCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInCreateObjectActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInCreateObjectActionAsResultCreateCommand(req, eObject);
+ public static OutputPinInCreateObjectActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInCreateObjectActionAsResultCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInCreateObjectActionAsResultCreateCommand(CreateElementRequest req) {
+ public OutputPinInCreateObjectActionAsResultCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class OutputPinInCreateObjectActionAsResultCreateCommand extends EditElem
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class OutputPinInCreateObjectActionAsResultCreateCommand extends EditElem
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- CreateObjectAction owner = (CreateObjectAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CreateObjectAction qualifiedTarget = (CreateObjectAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3087(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsBodyOutputVariableCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsBodyOutputVariableCreateCommand.java
index ec814e76657..0da0acf264b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsBodyOutputVariableCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsBodyOutputVariableCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.LoopNode;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInLoopNodeAsBodyOutputVariableCreateCommand extends EditEl
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInLoopNodeAsBodyOutputVariableCreateCommand extends EditEl
/**
* @generated
*/
- public OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInLoopNodeAsBodyOutputVariableCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(req, eObject);
+ public static OutputPinInLoopNodeAsBodyOutputVariableCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(CreateElementRequest req) {
+ public OutputPinInLoopNodeAsBodyOutputVariableCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInLoopNodeAsBodyOutputVariableCreateCommand extends EditEl
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInLoopNodeAsBodyOutputVariableCreateCommand extends EditEl
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- LoopNode owner = (LoopNode)getElementToEdit();
- owner.getBodyOutputs().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ LoopNode qualifiedTarget = (LoopNode)target;
+ qualifiedTarget.getBodyOutputs().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3109(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsLoopVariableCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsLoopVariableCreateCommand.java
index 4ec50a4892f..9b8a365e26d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsLoopVariableCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsLoopVariableCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.LoopNode;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInLoopNodeAsLoopVariableCreateCommand extends EditElementC
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInLoopNodeAsLoopVariableCreateCommand extends EditElementC
/**
* @generated
*/
- public OutputPinInLoopNodeAsLoopVariableCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInLoopNodeAsLoopVariableCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInLoopNodeAsLoopVariableCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInLoopNodeAsLoopVariableCreateCommand(req, eObject);
+ public static OutputPinInLoopNodeAsLoopVariableCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInLoopNodeAsLoopVariableCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInLoopNodeAsLoopVariableCreateCommand(CreateElementRequest req) {
+ public OutputPinInLoopNodeAsLoopVariableCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInLoopNodeAsLoopVariableCreateCommand extends EditElementC
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInLoopNodeAsLoopVariableCreateCommand extends EditElementC
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- LoopNode owner = (LoopNode)getElementToEdit();
- owner.getLoopVariables().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ LoopNode qualifiedTarget = (LoopNode)target;
+ qualifiedTarget.getLoopVariables().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3110(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsResultCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsResultCreateCommand.java
index cd1d7b416ef..8141781ae83 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsResultCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInLoopNodeAsResultCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.LoopNode;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInLoopNodeAsResultCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInLoopNodeAsResultCreateCommand extends EditElementCommand
/**
* @generated
*/
- public OutputPinInLoopNodeAsResultCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInLoopNodeAsResultCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInLoopNodeAsResultCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInLoopNodeAsResultCreateCommand(req, eObject);
+ public static OutputPinInLoopNodeAsResultCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInLoopNodeAsResultCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInLoopNodeAsResultCreateCommand(CreateElementRequest req) {
+ public OutputPinInLoopNodeAsResultCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInLoopNodeAsResultCreateCommand extends EditElementCommand
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInLoopNodeAsResultCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- LoopNode owner = (LoopNode)getElementToEdit();
- owner.getResults().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ LoopNode qualifiedTarget = (LoopNode)target;
+ qualifiedTarget.getResults().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3111(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInOpaqueActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInOpaqueActCreateCommand.java
index a1b8fd3546e..5b0587134fc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInOpaqueActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInOpaqueActCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public OutputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInOpaqueActCreateCommand(req, eObject);
+ public static OutputPinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInOpaqueActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInOpaqueActCreateCommand(CreateElementRequest req) {
+ public OutputPinInOpaqueActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class OutputPinInOpaqueActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class OutputPinInOpaqueActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- OpaqueAction owner = (OpaqueAction)getElementToEdit();
- owner.getOutputValues().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ OpaqueAction qualifiedTarget = (OpaqueAction)target;
+ qualifiedTarget.getOutputValues().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadStructuralFeatureAsResultCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadStructuralFeatureAsResultCreateCommand.java
index 8d73defd5db..42c451db7ed 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadStructuralFeatureAsResultCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadStructuralFeatureAsResultCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInReadStructuralFeatureAsResultCreateCommand extends EditE
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInReadStructuralFeatureAsResultCreateCommand extends EditE
/**
* @generated
*/
- public OutputPinInReadStructuralFeatureAsResultCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInReadStructuralFeatureAsResultCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInReadStructuralFeatureAsResultCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInReadStructuralFeatureAsResultCreateCommand(req, eObject);
+ public static OutputPinInReadStructuralFeatureAsResultCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInReadStructuralFeatureAsResultCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInReadStructuralFeatureAsResultCreateCommand(CreateElementRequest req) {
+ public OutputPinInReadStructuralFeatureAsResultCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class OutputPinInReadStructuralFeatureAsResultCreateCommand extends EditE
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class OutputPinInReadStructuralFeatureAsResultCreateCommand extends EditE
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- ReadStructuralFeatureAction owner = (ReadStructuralFeatureAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ ReadStructuralFeatureAction qualifiedTarget = (ReadStructuralFeatureAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3090(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadVariableActionAsResultCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadVariableActionAsResultCreateCommand.java
index 3c03559603f..39195a300f8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadVariableActionAsResultCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInReadVariableActionAsResultCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.ReadVariableAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class OutputPinInReadVariableActionAsResultCreateCommand extends EditElem
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInReadVariableActionAsResultCreateCommand extends EditElem
/**
* @generated
*/
- public OutputPinInReadVariableActionAsResultCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInReadVariableActionAsResultCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInReadVariableActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInReadVariableActionAsResultCreateCommand(req, eObject);
+ public static OutputPinInReadVariableActionAsResultCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInReadVariableActionAsResultCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInReadVariableActionAsResultCreateCommand(CreateElementRequest req) {
+ public OutputPinInReadVariableActionAsResultCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class OutputPinInReadVariableActionAsResultCreateCommand extends EditElem
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class OutputPinInReadVariableActionAsResultCreateCommand extends EditElem
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- ReadVariableAction owner = (ReadVariableAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ ReadVariableAction qualifiedTarget = (ReadVariableAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3098(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInValSpecActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInValSpecActCreateCommand.java
index 0eded1cae74..793f1cd29e9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInValSpecActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInValSpecActCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValueSpecificationAction;
/**
@@ -39,7 +44,7 @@ public class OutputPinInValSpecActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class OutputPinInValSpecActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public OutputPinInValSpecActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OutputPinInValSpecActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static OutputPinInValSpecActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OutputPinInValSpecActCreateCommand(req, eObject);
+ public static OutputPinInValSpecActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OutputPinInValSpecActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OutputPinInValSpecActCreateCommand(CreateElementRequest req) {
+ public OutputPinInValSpecActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class OutputPinInValSpecActCreateCommand extends EditElementCommand {
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class OutputPinInValSpecActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- ValueSpecificationAction owner = (ValueSpecificationAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ ValueSpecificationAction qualifiedTarget = (ValueSpecificationAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3077(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ParameterCreateCommand.java
index b1b6c7aa15a..484d745ea62 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ParameterCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ParameterCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Parameter;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ParameterCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ParameterCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ParameterCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ParameterCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ParameterCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ParameterCreateCommand(req, eObject);
+ public static ParameterCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ParameterCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ParameterCreateCommand(CreateElementRequest req) {
+ public ParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ParameterCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getParameter());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ParameterCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Parameter newElement = UMLFactory.eINSTANCE.createParameter();
- Behavior owner = (Behavior)getElementToEdit();
- owner.getOwnedParameters().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Behavior qualifiedTarget = (Behavior)target;
+ qualifiedTarget.getOwnedParameters().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Parameter_3001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionCreateCommand.java
index 19f7ff0e9a9..126c4e38279 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ReadSelfAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ReadSelfActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ReadSelfActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ReadSelfActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReadSelfActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ReadSelfActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReadSelfActionCreateCommand(req, eObject);
+ public static ReadSelfActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReadSelfActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReadSelfActionCreateCommand(CreateElementRequest req) {
+ public ReadSelfActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ReadSelfActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReadSelfAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ReadSelfActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ReadSelfAction newElement = UMLFactory.eINSTANCE.createReadSelfAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ReadSelfAction_3081(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionOutputPinCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionOutputPinCreateCommand.java
index 50979cda482..cffa4d35b2f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionOutputPinCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadSelfActionOutputPinCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OutputPin;
import org.eclipse.uml2.uml.ReadSelfAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ReadSelfActionOutputPinCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ReadSelfActionOutputPinCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ReadSelfActionOutputPinCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReadSelfActionOutputPinCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ReadSelfActionOutputPinCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReadSelfActionOutputPinCreateCommand(req, eObject);
+ public static ReadSelfActionOutputPinCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReadSelfActionOutputPinCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReadSelfActionOutputPinCreateCommand(CreateElementRequest req) {
+ public ReadSelfActionOutputPinCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ReadSelfActionOutputPinCreateCommand extends EditElementCommand {
if(container.getResult() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ReadSelfActionOutputPinCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin();
- ReadSelfAction owner = (ReadSelfAction)getElementToEdit();
- owner.setResult(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ ReadSelfAction qualifiedTarget = (ReadSelfAction)target;
+ qualifiedTarget.setResult(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OutputPin_3084(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadStructuralFeatureActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadStructuralFeatureActionCreateCommand.java
index b54218a10c4..74ee04263dd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadStructuralFeatureActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadStructuralFeatureActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ReadStructuralFeatureActionCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ReadStructuralFeatureActionCreateCommand extends EditElementCommand
/**
* @generated
*/
- public ReadStructuralFeatureActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReadStructuralFeatureActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ReadStructuralFeatureActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReadStructuralFeatureActionCreateCommand(req, eObject);
+ public static ReadStructuralFeatureActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReadStructuralFeatureActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReadStructuralFeatureActionCreateCommand(CreateElementRequest req) {
+ public ReadStructuralFeatureActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ReadStructuralFeatureActionCreateCommand extends EditElementCommand
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReadStructuralFeatureAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ReadStructuralFeatureActionCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ReadStructuralFeatureAction newElement = UMLFactory.eINSTANCE.createReadStructuralFeatureAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ReadStructuralFeatureAction_3088(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadVariableActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadVariableActionCreateCommand.java
index 68fa93af06b..2639fe45d95 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadVariableActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ReadVariableActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.ReadVariableAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class ReadVariableActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ReadVariableActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ReadVariableActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReadVariableActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ReadVariableActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReadVariableActionCreateCommand(req, eObject);
+ public static ReadVariableActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReadVariableActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReadVariableActionCreateCommand(CreateElementRequest req) {
+ public ReadVariableActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ReadVariableActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReadVariableAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ReadVariableActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ReadVariableAction newElement = UMLFactory.eINSTANCE.createReadVariableAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ReadVariableAction_3097(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendObjectActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendObjectActionCreateCommand.java
index d8ca5eb2439..88fe19a0056 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendObjectActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendObjectActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class SendObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class SendObjectActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public SendObjectActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SendObjectActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static SendObjectActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SendObjectActionCreateCommand(req, eObject);
+ public static SendObjectActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SendObjectActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SendObjectActionCreateCommand(CreateElementRequest req) {
+ public SendObjectActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class SendObjectActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSendObjectAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class SendObjectActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SendObjectAction newElement = UMLFactory.eINSTANCE.createSendObjectAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_SendObjectAction_3042(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendSignalActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendSignalActionCreateCommand.java
index 868fb239d47..7bb848d5379 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendSignalActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SendSignalActionCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class SendSignalActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class SendSignalActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public SendSignalActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SendSignalActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static SendSignalActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SendSignalActionCreateCommand(req, eObject);
+ public static SendSignalActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SendSignalActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SendSignalActionCreateCommand(CreateElementRequest req) {
+ public SendSignalActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class SendSignalActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSendSignalAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class SendSignalActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SendSignalAction newElement = UMLFactory.eINSTANCE.createSendSignalAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_SendSignalAction_3052(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SequenceNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SequenceNodeCreateCommand.java
index 3b199357ab6..e2e9ce61742 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SequenceNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/SequenceNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.SequenceNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class SequenceNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class SequenceNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public SequenceNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SequenceNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static SequenceNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SequenceNodeCreateCommand(req, eObject);
+ public static SequenceNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SequenceNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SequenceNodeCreateCommand(CreateElementRequest req) {
+ public SequenceNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class SequenceNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSequenceNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class SequenceNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SequenceNode newElement = UMLFactory.eINSTANCE.createSequenceNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_SequenceNode_3073(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ShapeNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ShapeNamedElementCreateCommand.java
index 4fc9ed1d7a1..b4ef5236729 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ShapeNamedElementCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ShapeNamedElementCreateCommand.java
@@ -25,8 +25,12 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class ShapeNamedElementCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class ShapeNamedElementCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ShapeNamedElementCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ShapeNamedElementCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ShapeNamedElementCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ShapeNamedElementCreateCommand(req, eObject);
+ public static ShapeNamedElementCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ShapeNamedElementCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ShapeNamedElementCreateCommand(CreateElementRequest req) {
+ public ShapeNamedElementCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class ShapeNamedElementCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNamedElement());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StructuredActivityNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StructuredActivityNodeCreateCommand.java
index 128a37286de..13d9fe65805 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StructuredActivityNodeCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StructuredActivityNodeCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.StructuredActivityNode;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class StructuredActivityNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class StructuredActivityNodeCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public StructuredActivityNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StructuredActivityNodeCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static StructuredActivityNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StructuredActivityNodeCreateCommand(req, eObject);
+ public static StructuredActivityNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StructuredActivityNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StructuredActivityNodeCreateCommand(CreateElementRequest req) {
+ public StructuredActivityNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class StructuredActivityNodeCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStructuredActivityNode());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class StructuredActivityNodeCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StructuredActivityNode newElement = UMLFactory.eINSTANCE.createStructuredActivityNode();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedGroups().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedGroups().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_StructuredActivityNode_3065(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPostcondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPostcondCreateCommand.java
index 368855db5ab..96070fb3e8d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPostcondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPostcondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class TimeConstraintAsLocalPostcondCreateCommand extends EditElementComma
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class TimeConstraintAsLocalPostcondCreateCommand extends EditElementComma
/**
* @generated
*/
- public TimeConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static TimeConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeConstraintAsLocalPostcondCreateCommand(req, eObject);
+ public static TimeConstraintAsLocalPostcondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintAsLocalPostcondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintAsLocalPostcondCreateCommand(CreateElementRequest req) {
+ public TimeConstraintAsLocalPostcondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class TimeConstraintAsLocalPostcondCreateCommand extends EditElementComma
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class TimeConstraintAsLocalPostcondCreateCommand extends EditElementComma
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPostconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPostconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_TimeConstraint_3037(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPrecondCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPrecondCreateCommand.java
index c968499f663..03bbc824cb8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPrecondCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/TimeConstraintAsLocalPrecondCreateCommand.java
@@ -25,11 +25,16 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +44,7 @@ public class TimeConstraintAsLocalPrecondCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class TimeConstraintAsLocalPrecondCreateCommand extends EditElementComman
/**
* @generated
*/
- public TimeConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static TimeConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeConstraintAsLocalPrecondCreateCommand(req, eObject);
+ public static TimeConstraintAsLocalPrecondCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintAsLocalPrecondCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintAsLocalPrecondCreateCommand(CreateElementRequest req) {
+ public TimeConstraintAsLocalPrecondCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class TimeConstraintAsLocalPrecondCreateCommand extends EditElementComman
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class TimeConstraintAsLocalPrecondCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- Action owner = (Action)getElementToEdit();
- owner.getLocalPreconditions().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Action qualifiedTarget = (Action)target;
+ qualifiedTarget.getLocalPreconditions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_TimeConstraint_3036(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallBeActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallBeActCreateCommand.java
index b6cab8f262f..47d55238ed7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallBeActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallBeActCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInCallBeActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValuePinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInCallBeActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInCallBeActCreateCommand(req, eObject);
+ public static ValuePinInCallBeActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInCallBeActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInCallBeActCreateCommand(CreateElementRequest req) {
+ public ValuePinInCallBeActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ValuePinInCallBeActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ValuePinInCallBeActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActAsTargetCreateCommand.java
index 36e1468d3bf..62f7143c4d5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActAsTargetCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInCallOpActAsTargetCreateCommand extends EditElementCommand
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInCallOpActAsTargetCreateCommand extends EditElementCommand
/**
* @generated
*/
- public ValuePinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInCallOpActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInCallOpActAsTargetCreateCommand(req, eObject);
+ public static ValuePinInCallOpActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInCallOpActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInCallOpActAsTargetCreateCommand(CreateElementRequest req) {
+ public ValuePinInCallOpActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ValuePinInCallOpActAsTargetCreateCommand extends EditElementCommand
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ValuePinInCallOpActAsTargetCreateCommand extends EditElementCommand
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- CallOperationAction owner = (CallOperationAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ CallOperationAction qualifiedTarget = (CallOperationAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3025(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActCreateCommand.java
index 12100e21239..fe50e074379 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInCallOpActCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInCallOpActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValuePinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInCallOpActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInCallOpActCreateCommand(req, eObject);
+ public static ValuePinInCallOpActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInCallOpActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInCallOpActCreateCommand(CreateElementRequest req) {
+ public ValuePinInCallOpActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ValuePinInCallOpActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ValuePinInCallOpActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3022(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInOpaqueActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInOpaqueActCreateCommand.java
index a043476a1c0..45875bb7f01 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInOpaqueActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInOpaqueActCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.OpaqueAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInOpaqueActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValuePinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInOpaqueActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInOpaqueActCreateCommand(req, eObject);
+ public static ValuePinInOpaqueActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInOpaqueActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInOpaqueActCreateCommand(CreateElementRequest req) {
+ public ValuePinInOpaqueActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ValuePinInOpaqueActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ValuePinInOpaqueActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- OpaqueAction owner = (OpaqueAction)getElementToEdit();
- owner.getInputValues().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ OpaqueAction qualifiedTarget = (OpaqueAction)target;
+ qualifiedTarget.getInputValues().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3015(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsReqCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsReqCreateCommand.java
index fe45c989d67..8fbdc90f523 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsReqCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsReqCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInSendObjActAsReqCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInSendObjActAsReqCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValuePinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInSendObjActAsReqCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInSendObjActAsReqCreateCommand(req, eObject);
+ public static ValuePinInSendObjActAsReqCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInSendObjActAsReqCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInSendObjActAsReqCreateCommand(CreateElementRequest req) {
+ public ValuePinInSendObjActAsReqCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ValuePinInSendObjActAsReqCreateCommand extends EditElementCommand {
if(container.getRequest() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ValuePinInSendObjActAsReqCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setRequest(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setRequest(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3046(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsTargetCreateCommand.java
index 2c2594332c3..bccb36b2fd3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendObjActAsTargetCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.SendObjectAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInSendObjActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInSendObjActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- public ValuePinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInSendObjActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInSendObjActAsTargetCreateCommand(req, eObject);
+ public static ValuePinInSendObjActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInSendObjActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInSendObjActAsTargetCreateCommand(CreateElementRequest req) {
+ public ValuePinInSendObjActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ValuePinInSendObjActAsTargetCreateCommand extends EditElementComman
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ValuePinInSendObjActAsTargetCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- SendObjectAction owner = (SendObjectAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendObjectAction qualifiedTarget = (SendObjectAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3049(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActAsTargetCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActAsTargetCreateCommand.java
index f2e6920eca6..d3ff3d6c148 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActAsTargetCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActAsTargetCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInSendSigActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInSendSigActAsTargetCreateCommand extends EditElementComman
/**
* @generated
*/
- public ValuePinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInSendSigActAsTargetCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInSendSigActAsTargetCreateCommand(req, eObject);
+ public static ValuePinInSendSigActAsTargetCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInSendSigActAsTargetCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInSendSigActAsTargetCreateCommand(CreateElementRequest req) {
+ public ValuePinInSendSigActAsTargetCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -93,7 +99,9 @@ public class ValuePinInSendSigActAsTargetCreateCommand extends EditElementComman
if(container.getTarget() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -101,8 +109,19 @@ public class ValuePinInSendSigActAsTargetCreateCommand extends EditElementComman
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- SendSignalAction owner = (SendSignalAction)getElementToEdit();
- owner.setTarget(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ SendSignalAction qualifiedTarget = (SendSignalAction)target;
+ qualifiedTarget.setTarget(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3060(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActCreateCommand.java
index 17ba5f1bd81..ffc59e1fae3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInSendSigActCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.InvocationAction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValuePin;
/**
@@ -39,7 +44,7 @@ public class ValuePinInSendSigActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValuePinInSendSigActCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValuePinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValuePinInSendSigActCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValuePinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValuePinInSendSigActCreateCommand(req, eObject);
+ public static ValuePinInSendSigActCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValuePinInSendSigActCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValuePinInSendSigActCreateCommand(CreateElementRequest req) {
+ public ValuePinInSendSigActCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ValuePinInSendSigActCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ValuePinInSendSigActCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
- InvocationAction owner = (InvocationAction)getElementToEdit();
- owner.getArguments().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ InvocationAction qualifiedTarget = (InvocationAction)target;
+ qualifiedTarget.getArguments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValuePin_3054(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValueSpecificationActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValueSpecificationActionCreateCommand.java
index c6232583ee4..4d1e5d662c3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValueSpecificationActionCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValueSpecificationActionCreateCommand.java
@@ -25,10 +25,15 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValueSpecificationAction;
/**
@@ -39,7 +44,7 @@ public class ValueSpecificationActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +54,25 @@ public class ValueSpecificationActionCreateCommand extends EditElementCommand {
/**
* @generated
*/
- public ValueSpecificationActionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ValueSpecificationActionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
super(req.getLabel(), null, req);
this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
- public static ValueSpecificationActionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ValueSpecificationActionCreateCommand(req, eObject);
+ public static ValueSpecificationActionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ValueSpecificationActionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ValueSpecificationActionCreateCommand(CreateElementRequest req) {
+ public ValueSpecificationActionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +95,9 @@ public class ValueSpecificationActionCreateCommand extends EditElementCommand {
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValueSpecificationAction());
+ return data.isPermitted();
}
/**
@@ -97,8 +105,19 @@ public class ValueSpecificationActionCreateCommand extends EditElementCommand {
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ValueSpecificationAction newElement = UMLFactory.eINSTANCE.createValueSpecificationAction();
- Activity owner = (Activity)getElementToEdit();
- owner.getOwnedNodes().add(newElement);
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
+ if(data.isPermitted()) {
+ if(data.isPathDefined()) {
+ if(!data.execute(target, newElement))
+ return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
+ } else {
+ Activity qualifiedTarget = (Activity)target;
+ qualifiedTarget.getOwnedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ValueSpecificationAction_3076(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java
index 2fc73a4569d..cd085427658 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java
@@ -96,18 +96,9 @@ public class UMLVisualIDRegistry {
public static String getType(int visualID) {
return Integer.toString(visualID);
}
-
- /**
- * @generated
- */
+
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return ActivityDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return ActivityDiagramEditPart.VISUAL_ID;
}
/**

Back to the top