diff options
Diffstat (limited to 'plugins/uml')
958 files changed, 16003 insertions, 14635 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF index 8bd2f101951..b6855aeb0cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/META-INF/MANIFEST.MF @@ -83,13 +83,12 @@ Require-Bundle: org.eclipse.core.expressions, org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.emf.validation.ocl;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.activity.part.UMLDia
- gramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.activity;singleto
- n:=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.activity; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/ActivityDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/ActivityDiagramCreationCondition.java index 9ffc9dcf2a1..6f5b9e89a81 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/ActivityDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/ActivityDiagramCreationCondition.java @@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.activity; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Activity;
/**
* ActivityDiagramCreationCondition class allows to check if an Activity diagram can be added to the
@@ -25,9 +24,6 @@ public class ActivityDiagramCreationCondition extends PerspectiveContextDependen */
@Override
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof Activity;
- }
return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/CreateActivityDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/CreateActivityDiagramWithNavigationHandler.java deleted file mode 100644 index cc3427c43bb..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/CreateActivityDiagramWithNavigationHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateActivityDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateActivityDiagramWithNavigationHandler() {
- super(new CreateActivityDiagramCommand(), new ActivityDiagramCreationCondition());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/commands/CreateActionLocalConditionViewCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/commands/CreateActionLocalConditionViewCommand.java index 441a5628fbc..2667b9ce43a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/commands/CreateActionLocalConditionViewCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/commands/CreateActionLocalConditionViewCommand.java @@ -28,6 +28,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintAsLocalPostcondCreateCommand;
import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintAsLocalPrecondCreateCommand;
import org.eclipse.papyrus.uml.diagram.activity.edit.commands.DurationConstraintAsLocalPostcondCreateCommand;
@@ -80,7 +81,7 @@ public class CreateActionLocalConditionViewCommand extends Command { * the part of the action owning the condition
*/
public CreateActionLocalConditionViewCommand(IHintedType conditionType, ActivityActivityContentCompartmentEditPart graphicalParent, EObject containerAction, EditPart actionPart) {
- elementCreationCommand = getElementCreationCommand(containerAction, conditionType);
+ elementCreationCommand = getElementCreationCommand(containerAction, conditionType, graphicalParent);
compartment = graphicalParent;
linkedActionEditPart = actionPart;
type = conditionType;
@@ -96,31 +97,31 @@ public class CreateActionLocalConditionViewCommand extends Command { * (Constraint_3011) or postcondition (Constraint_3012)
* @return the command to create model element or null
*/
- private static ICommandProxy getElementCreationCommand(EObject containerAction, IHintedType conditionType) {
+ private static ICommandProxy getElementCreationCommand(EObject containerAction, IHintedType conditionType, EditPart part) {
CreateElementRequest createElementReq = new CreateElementRequest(containerAction, conditionType);
if(UMLElementTypes.Constraint_3011.equals(conditionType)) {
- ConstraintAsLocalPrecondCreateCommand cmd = new ConstraintAsLocalPrecondCreateCommand(createElementReq);
+ ConstraintAsLocalPrecondCreateCommand cmd = new ConstraintAsLocalPrecondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.Constraint_3012.equals(conditionType)) {
- ConstraintAsLocalPostcondCreateCommand cmd = new ConstraintAsLocalPostcondCreateCommand(createElementReq);
+ ConstraintAsLocalPostcondCreateCommand cmd = new ConstraintAsLocalPostcondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.IntervalConstraint_3032.equals(conditionType)) {
- IntervalConstraintAsLocalPrecondCreateCommand cmd = new IntervalConstraintAsLocalPrecondCreateCommand(createElementReq);
+ IntervalConstraintAsLocalPrecondCreateCommand cmd = new IntervalConstraintAsLocalPrecondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.IntervalConstraint_3033.equals(conditionType)) {
- IntervalConstraintAsLocalPostcondCreateCommand cmd = new IntervalConstraintAsLocalPostcondCreateCommand(createElementReq);
+ IntervalConstraintAsLocalPostcondCreateCommand cmd = new IntervalConstraintAsLocalPostcondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.DurationConstraint_3034.equals(conditionType)) {
- DurationConstraintAsLocalPrecondCreateCommand cmd = new DurationConstraintAsLocalPrecondCreateCommand(createElementReq);
+ DurationConstraintAsLocalPrecondCreateCommand cmd = new DurationConstraintAsLocalPrecondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.DurationConstraint_3035.equals(conditionType)) {
- DurationConstraintAsLocalPostcondCreateCommand cmd = new DurationConstraintAsLocalPostcondCreateCommand(createElementReq);
+ DurationConstraintAsLocalPostcondCreateCommand cmd = new DurationConstraintAsLocalPostcondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.TimeConstraint_3036.equals(conditionType)) {
- TimeConstraintAsLocalPrecondCreateCommand cmd = new TimeConstraintAsLocalPrecondCreateCommand(createElementReq);
+ TimeConstraintAsLocalPrecondCreateCommand cmd = new TimeConstraintAsLocalPrecondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else if(UMLElementTypes.TimeConstraint_3037.equals(conditionType)) {
- TimeConstraintAsLocalPostcondCreateCommand cmd = new TimeConstraintAsLocalPostcondCreateCommand(createElementReq);
+ TimeConstraintAsLocalPostcondCreateCommand cmd = new TimeConstraintAsLocalPostcondCreateCommand(createElementReq, DiagramUtils.getDiagramFrom(part));
return new ICommandProxy(cmd);
} else {
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml index 7444de0a987..8ba1506e449 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml @@ -45,64 +45,7 @@ </command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand">
- <activeWhen>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
- </with>
- </activeWhen>
- </handler>
- </extension>
-<extension
- point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand"
- icon="icons/obj16/Diagram_Activity.gif"
- label="Create a new Activity Diagram"
- style="push"
- tooltip="Create a new Activity Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command commandId="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand"
- icon="icons/obj16/Diagram_Activity.gif"
- label="Create a new Activity Diagram"
- style="push"
- tooltip="Create a new Activity Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand"
- icon="icons/obj16/Diagram_Activity.gif"
- label="Create a new Activity Diagram"
- style="push"
- tooltip="Create a new Activity Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
-</extension>
<extension
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;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF index ecc94ac9a49..f9731a7bb5a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF @@ -86,13 +86,12 @@ Require-Bundle: org.eclipse.core.expressions, org.apache.batik.svggen;bundle-version="[1.6.0,1.7.0)",
org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
org.w3c.dom.svg,
- org.apache.batik.css;bundle-version="[1.6.0,1.7.0)"
+ org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagra
- mEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.clazz;singleton:=
- true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.clazz; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/ClassDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/ClassDiagramCreationCondition.java index 5e2615fa05b..24c5fdf33a3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/ClassDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/ClassDiagramCreationCondition.java @@ -23,9 +23,6 @@ public class ClassDiagramCreationCondition extends PerspectiveContextDependence * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package;
- }
return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramCommand.java index 3f3c15c31c8..87fd9b973d5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramCommand.java @@ -26,7 +26,7 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart; * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> */ public class CreateClassDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - + @Override protected String getDefaultDiagramName() { return "ClassDiagram"; @@ -48,3 +48,4 @@ public class CreateClassDiagramCommand extends AbstractPapyrusGmfCreateDiagramCo return org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT; } } + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramWithNavigationHandler.java deleted file mode 100644 index 821ee063842..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/CreateClassDiagramWithNavigationHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateClassDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateClassDiagramWithNavigationHandler() {
- super(new CreateClassDiagramCommand(), new ClassDiagramCreationCondition());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationClassCreateCommand.java index 7f7698176f2..1e02641a34b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationClassCreateCommand.java @@ -20,7 +20,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationClassHelper;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AssociationClassLinkCreateCommand;
import org.eclipse.uml2.uml.AssociationClass;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Type;
@@ -28,32 +30,13 @@ import org.eclipse.uml2.uml.Type; /**
* custom class to create an association
*/
-public class CAssociationClassCreateCommand extends org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AssociationClassLinkCreateCommand {
+public class CAssociationClassCreateCommand extends AssociationClassLinkCreateCommand {
- // code copy from the super class!
- protected Package deduceContainer(EObject source, EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for(EObject element = source; element != null; element = element.eContainer()) {
- if(element instanceof Package) {
- return (Package)element;
- }
- }
- return null;
- }
-
- protected Package container;
-
- protected EObject source;
-
- protected EObject target;
-
- public CAssociationClassCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ private final Diagram diagram;
+
+ public CAssociationClassCreateCommand(CreateRelationshipRequest request, EObject source, EObject target, Diagram diagram) {
super(request, source, target);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
+ this.diagram = diagram;
}
/**
@@ -65,7 +48,7 @@ public class CAssociationClassCreateCommand extends org.eclipse.papyrus.uml.diag throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
if(source instanceof Type && target instanceof Type && container instanceof Package) {
- AssociationClass newElement = (AssociationClass)AssociationClassHelper.createAssociationClass(getEditingDomain(), (Type)source, (Type)target, (Package)container);
+ AssociationClass newElement = (AssociationClass)AssociationClassHelper.createAssociationClass(getEditingDomain(), (Type)source, (Type)target, (Package)container, diagram);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationCreateCommand.java index b58e2182ade..e2da95aeac8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CAssociationCreateCommand.java @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.ClazzDiagramAssociationHelper;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Package;
@@ -29,31 +30,12 @@ import org.eclipse.uml2.uml.Type; * custom class to create an association
*/
public class CAssociationCreateCommand extends org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AssociationCreateCommand {
-
- // code copy from the super class!
- protected Package deduceContainer(EObject source, EObject target) {
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for(EObject element = source; element != null; element = element.eContainer()) {
- if(element instanceof Package) {
- return (Package)element;
- }
- }
- return null;
- }
-
- protected Package container;
-
- protected EObject source;
-
- protected EObject target;
-
- public CAssociationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+
+ private final Diagram diagram;
+
+ public CAssociationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target, Diagram diagram) {
super(request, source, target);
- this.source = source;
- this.target = target;
- container = deduceContainer(source, target);
+ this.diagram = diagram;
}
/**
@@ -65,7 +47,7 @@ public class CAssociationCreateCommand extends org.eclipse.papyrus.uml.diagram.c throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
if(source instanceof Type && target instanceof Type && container instanceof Package) {
- Association newElement = (Association)ClazzDiagramAssociationHelper.createAssociation(getEditingDomain(), (Type)source, (Type)target, (Package)container);
+ Association newElement = (Association)ClazzDiagramAssociationHelper.createAssociation(getEditingDomain(), (Type)source, (Type)target, (Package)container, diagram);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CClassifierTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CClassifierTemplateParameterCreateCommand.java index b6dd4c1aa96..2e54924efa7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CClassifierTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CClassifierTemplateParameterCreateCommand.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.TemplateParameterConfigurationDialog;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassifierTemplateParameterCreateCommand;
import org.eclipse.swt.SWT;
@@ -28,8 +29,8 @@ import org.eclipse.uml2.uml.UMLPackage; public class CClassifierTemplateParameterCreateCommand extends ClassifierTemplateParameterCreateCommand {
- public CClassifierTemplateParameterCreateCommand(CreateElementRequest req) {
- super(req);
+ public CClassifierTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CConnectableElementTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CConnectableElementTemplateParameterCreateCommand.java index 3334140757f..604036c486c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CConnectableElementTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CConnectableElementTemplateParameterCreateCommand.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.TemplateParameterConfigurationDialog;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ConnectableElementTemplateParameterCreateCommand;
import org.eclipse.swt.SWT;
@@ -28,8 +29,8 @@ import org.eclipse.uml2.uml.UMLPackage; public class CConnectableElementTemplateParameterCreateCommand extends ConnectableElementTemplateParameterCreateCommand {
- public CConnectableElementTemplateParameterCreateCommand(CreateElementRequest req) {
- super(req);
+ public CConnectableElementTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
// TODO Auto-generated constructor stub
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/COperationTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/COperationTemplateParameterCreateCommand.java index c63641e8440..8b9e9eb5407 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/COperationTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/COperationTemplateParameterCreateCommand.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.TemplateParameterConfigurationDialog;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationTemplateParameterCreateCommand;
import org.eclipse.swt.SWT;
@@ -28,8 +29,8 @@ import org.eclipse.uml2.uml.UMLPackage; public class COperationTemplateParameterCreateCommand extends OperationTemplateParameterCreateCommand {
- public COperationTemplateParameterCreateCommand(CreateElementRequest req) {
- super(req);
+ public COperationTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
// TODO Auto-generated constructor stub
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CTemplateParameterCreateCommand.java index d2c6ab63291..b0f8b5fc9fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CTemplateParameterCreateCommand.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EClass;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.ui.TemplateParameterConfigurationDialog;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.TemplateParameterCreateCommand;
import org.eclipse.swt.SWT;
@@ -31,8 +32,8 @@ import org.eclipse.uml2.uml.UMLPackage; public class CTemplateParameterCreateCommand extends TemplateParameterCreateCommand {
- public CTemplateParameterCreateCommand(CreateElementRequest req) {
- super(req);
+ public CTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationClassSupplement.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationClassSupplement.java index 0f4ce11e9db..cf56476d6c4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationClassSupplement.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationClassSupplement.java @@ -23,6 +23,7 @@ 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.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -52,8 +53,8 @@ public class CreateAssociationClassSupplement extends SupplementCommand { * @param target
* the target of the association (Type)
*/
- public CreateAssociationClassSupplement(EObject container, EObject source, EObject target) {
- super(container, source, target);
+ public CreateAssociationClassSupplement(EObject container, EObject source, EObject target, Diagram diagram) {
+ super(container, source, target, diagram);
}
/**
@@ -82,7 +83,7 @@ public class CreateAssociationClassSupplement extends SupplementCommand { AssociationClass association = UMLFactory.eINSTANCE.createAssociationClass();
// create target property
CreateElementRequest request = new CreateElementRequest(domain, getSource(), UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
- EditElementCommand c = new PropertyForComponentCreateCommand(request);
+ EditElementCommand c = new PropertyForComponentCreateCommand(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -98,7 +99,7 @@ public class CreateAssociationClassSupplement extends SupplementCommand { targetProperty.setUpper(1);
// create source property
request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- c = new PropertyCommandForAssociation(request);
+ c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationSupplement.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationSupplement.java index eca03b905ba..426c57ec2fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationSupplement.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CreateAssociationSupplement.java @@ -22,6 +22,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; 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.papyrus.uml.diagram.clazz.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.common.commands.SupplementCommand;
@@ -49,8 +50,8 @@ public class CreateAssociationSupplement extends SupplementCommand { * @param target
* the target of the association (Type)
*/
- public CreateAssociationSupplement(EObject container, EObject source, EObject target) {
- super(container, source, target);
+ public CreateAssociationSupplement(EObject container, EObject source, EObject target, Diagram diagram) {
+ super(container, source, target, diagram);
}
/**
@@ -79,7 +80,7 @@ public class CreateAssociationSupplement extends SupplementCommand { Association association = UMLFactory.eINSTANCE.createAssociation();
// create target property
CreateElementRequest request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- EditElementCommand c = new PropertyCommandForAssociation(request);
+ EditElementCommand c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -95,7 +96,7 @@ public class CreateAssociationSupplement extends SupplementCommand { targetProperty.setUpper(1);
// create source property
request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- c = new PropertyCommandForAssociation(request);
+ c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CustomContextLinkCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CustomContextLinkCreateCommand.java index 0546ca454c4..874db1307ad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CustomContextLinkCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/CustomContextLinkCreateCommand.java @@ -80,7 +80,7 @@ public class CustomContextLinkCreateCommand extends ContextLinkCreateCommand { }
}
}
- if(resolveTargetNamespace() != null && (resolveTargetNamespace().getOwnedRules().contains(resolveTargetNamespace()))) {
+ if (getTarget() != null && (getTarget().getOwnedRules().contains(getTarget()))) {
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java index 28152ba4e4d..ed794578867 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/command/PropertyCommandForAssociation.java @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Association;
@@ -39,8 +40,8 @@ public class PropertyCommandForAssociation extends PropertyForComponentCreateCom * @param req
* the req to launch the command
*/
- public PropertyCommandForAssociation(CreateElementRequest req) {
- super(req);
+ public PropertyCommandForAssociation(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/AssociationClassHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/AssociationClassHelper.java index 35c2aed9e19..972ab9669b6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/AssociationClassHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/AssociationClassHelper.java @@ -45,6 +45,7 @@ import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.AssociationClassViewCreateCommand;
@@ -68,11 +69,11 @@ import org.eclipse.uml2.uml.UMLPackage; */
public class AssociationClassHelper extends ElementHelper {
- public static EObject createAssociationClass(TransactionalEditingDomain domain, Type source, Type target, Package container) {
+ public static EObject createAssociationClass(TransactionalEditingDomain domain, Type source, Type target, Package container, Diagram diagram) {
AssociationClass association = UMLFactory.eINSTANCE.createAssociationClass();
// create target property
CreateElementRequest request = new CreateElementRequest(domain, source, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getStructuredClassifier_OwnedAttribute());
- EditElementCommand c = new PropertyForComponentCreateCommand(request);
+ EditElementCommand c = new PropertyForComponentCreateCommand(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -88,7 +89,7 @@ public class AssociationClassHelper extends ElementHelper { targetProperty.setUpper(1);
// create source property
request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- c = new PropertyCommandForAssociation(request);
+ c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/ClazzDiagramAssociationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/ClazzDiagramAssociationHelper.java index 4ff07e65462..204b1612079 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/ClazzDiagramAssociationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/ClazzDiagramAssociationHelper.java @@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.PropertyCommandForAssociation;
import org.eclipse.papyrus.uml.diagram.clazz.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -38,13 +39,14 @@ import org.eclipse.uml2.uml.UMLPackage; */
public class ClazzDiagramAssociationHelper {
- public static EObject createAssociation(TransactionalEditingDomain domain, Type source, Type target, Package container) {
+ public static EObject createAssociation(TransactionalEditingDomain domain, Type source, Type target, Package container, Diagram diagram) {
Association association = UMLFactory.eINSTANCE.createAssociation();
String targetString = target.getName().substring(0, 1).toLowerCase() + target.getName().substring(1, target.getName().length());
String sourceString = source.getName().substring(0, 1).toLowerCase() + source.getName().substring(1, source.getName().length());
+
// create target property
CreateElementRequest request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- EditElementCommand c = new PropertyCommandForAssociation(request);
+ EditElementCommand c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -63,9 +65,10 @@ public class ClazzDiagramAssociationHelper { if(source instanceof StructuredClassifier) {
((StructuredClassifier)source).getOwnedAttributes().add(targetProperty);
}
+
// create source property
request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- c = new PropertyCommandForAssociation(request);
+ c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/MultiAssociationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/MultiAssociationHelper.java index 4d49fb55794..254391c88c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/MultiAssociationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/MultiAssociationHelper.java @@ -51,6 +51,7 @@ import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.AssociationDiamonViewCreateCommand;
@@ -350,7 +351,7 @@ public class MultiAssociationHelper extends org.eclipse.papyrus.uml.diagram.comm // 3.1 creation of the property
CreateElementRequest request = new CreateElementRequest(getEditingDomain(), association, UMLElementTypes.Property_3005, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
request.setParameter("type", newSemanticElement);
- EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request);
+ EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request, DiagramUtils.getDiagramFrom(sourceEditPart));
propertyCreateCommand.setReuseParentTransaction(true);
((CompoundCommand)command).add(new ICommandProxy(propertyCreateCommand));
// 3. Node creation at this position
@@ -424,7 +425,7 @@ public class MultiAssociationHelper extends org.eclipse.papyrus.uml.diagram.comm // 0. add semantic
CreateElementRequest request = new CreateElementRequest(getEditingDomain(), association, UMLElementTypes.Property_3005, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
request.setParameter("type", newSemanticElement);
- EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request);
+ EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request, DiagramUtils.getDiagramFrom(targetEditPart));
((CompoundCommand)command).add(new ICommandProxy(propertyCreateCommand));
//System.err.println("0. add semantic, can execute?" + command.canExecute());
// 1. add the branch graphically
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CRedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CRedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java index 920906e4899..01ca20f156e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CRedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CRedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java @@ -14,6 +14,7 @@ package org.eclipse.papyrus.uml.diagram.clazz.custom.policies.itemsemantic; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CClassifierTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CConnectableElementTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.COperationTemplateParameterCreateCommand;
@@ -35,16 +36,16 @@ public class CRedefinableTemplateSignatureTemplateParameterCompartmentItemSemant */
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.ClassifierTemplateParameter_3031 == req.getElementType()) {
- return getGEFWrapper(new CClassifierTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new CClassifierTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectableElementTemplateParameter_3034 == req.getElementType()) {
- return getGEFWrapper(new CConnectableElementTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new CConnectableElementTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OperationTemplateParameter_3035 == req.getElementType()) {
- return getGEFWrapper(new COperationTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new COperationTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateParameter_3016 == req.getElementType()) {
- return getGEFWrapper(new CTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new CTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java index 127f6d7def2..4171d07418d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java @@ -14,6 +14,7 @@ package org.eclipse.papyrus.uml.diagram.clazz.custom.policies.itemsemantic; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CClassifierTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.COperationTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CTemplateParameterCreateCommand;
@@ -34,13 +35,13 @@ public class CTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolic */
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.ClassifierTemplateParameter_3031 == req.getElementType()) {
- return getGEFWrapper(new CClassifierTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new CClassifierTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OperationTemplateParameter_3035 == req.getElementType()) {
- return getGEFWrapper(new COperationTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new COperationTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateParameter_3016 == req.getElementType()) {
- return getGEFWrapper(new CTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new CTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationBranchItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationBranchItemSemanticEditPolicy.java index dea4b21ae7d..3006ab93750 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationBranchItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationBranchItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -38,10 +39,10 @@ public class CustomAssociationBranchItemSemanticEditPolicy extends AssociationBr */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassItemSemanticEditPolicy.java index df323772e2e..00d6c98592c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -36,10 +37,10 @@ public class CustomAssociationClassItemSemanticEditPolicy extends org.eclipse.pa */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
@@ -65,10 +66,10 @@ public class CustomAssociationClassItemSemanticEditPolicy extends org.eclipse.pa */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassLinkItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassLinkItemSemanticEditPolicy.java index 3ec21e61f38..9db627adf61 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassLinkItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationClassLinkItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -37,10 +38,10 @@ public class CustomAssociationClassLinkItemSemanticEditPolicy extends Associatio */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
@@ -66,10 +67,10 @@ public class CustomAssociationClassLinkItemSemanticEditPolicy extends Associatio */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationItemSemanticEditPolicy.java index 2762f4e9e7d..56e770bc998 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationItemSemanticEditPolicy.java @@ -25,14 +25,17 @@ import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationClassLinkEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationEditPart;
import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyBranchEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.AssociationItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Property;
@@ -40,7 +43,7 @@ import org.eclipse.uml2.uml.Property; /**
* this a specialization to manage creation of association and associationClass
*/
-public class CustomAssociationItemSemanticEditPolicy extends org.eclipse.papyrus.uml.diagram.clazz.edit.policies.AssociationItemSemanticEditPolicy {
+public class CustomAssociationItemSemanticEditPolicy extends AssociationItemSemanticEditPolicy {
/**
*
@@ -48,10 +51,10 @@ public class CustomAssociationItemSemanticEditPolicy extends org.eclipse.papyrus */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
@@ -108,10 +111,10 @@ public class CustomAssociationItemSemanticEditPolicy extends org.eclipse.papyrus */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationNodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationNodeItemSemanticEditPolicy.java index cd041184325..ccac1a93086 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationNodeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomAssociationNodeItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -38,10 +39,10 @@ public class CustomAssociationNodeItemSemanticEditPolicy extends AssociationNode */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicy.java index 12ec9709f38..312a65a37c7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -57,10 +58,10 @@ public class CustomClassItemSemanticEditPolicy extends ClassItemSemanticEditPoli */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -91,10 +92,10 @@ public class CustomClassItemSemanticEditPolicy extends ClassItemSemanticEditPoli */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicyCN.java index c5464df2635..f64f1cdc631 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomClassItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -53,10 +54,10 @@ public class CustomClassItemSemanticEditPolicyCN extends ClassItemSemanticEditPo */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -89,10 +90,10 @@ public class CustomClassItemSemanticEditPolicyCN extends ClassItemSemanticEditPo */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicy.java index f2252fbf4cd..b0cf1985d8b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomComponentItemSemanticEditPolicy extends ComponentItemSemantic */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomComponentItemSemanticEditPolicy extends ComponentItemSemantic */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicyCN.java index bea723b9043..eb13c215542 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomComponentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomComponentItemSemanticEditPolicyCN extends ComponentItemSemant */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomComponentItemSemanticEditPolicyCN extends ComponentItemSemant */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicy.java index 8c2e22c4d69..11ad22349c6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomDataTypeItemSemanticEditPolicy extends DataTypeItemSemanticEd */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomDataTypeItemSemanticEditPolicy extends DataTypeItemSemanticEd */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicyCN.java index 02f255ad0cc..d6420f68110 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomDataTypeItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomDataTypeItemSemanticEditPolicyCN extends DataTypeItemSemantic */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomDataTypeItemSemanticEditPolicyCN extends DataTypeItemSemantic */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicy.java index 4a0d116f724..dc66c947a3d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomEnumerationItemSemanticEditPolicy extends EnumerationItemSema */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomEnumerationItemSemanticEditPolicy extends EnumerationItemSema */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicyCN.java index 8b8fcb8aaca..c128be14cbc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomEnumerationItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomEnumerationItemSemanticEditPolicyCN extends EnumerationItemSe */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomEnumerationItemSemanticEditPolicyCN extends EnumerationItemSe */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInformationItemItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInformationItemItemSemanticEditPolicy.java index 9da9cf648c1..7bf374e7eaf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInformationItemItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInformationItemItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -38,10 +39,10 @@ public class CustomInformationItemItemSemanticEditPolicy extends InformationItem */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicy.java index 29e45b968c1..2cf72581eab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomInterfaceItemSemanticEditPolicy extends InterfaceItemSemantic */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomInterfaceItemSemanticEditPolicy extends InterfaceItemSemantic */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicyCN.java index a2fcdc95398..7b36f7c7a2b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomInterfaceItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomInterfaceItemSemanticEditPolicyCN extends InterfaceItemSemant */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomInterfaceItemSemanticEditPolicyCN extends InterfaceItemSemant */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicy.java index 680883136b0..8f899417030 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomPrimitiveTypeItemSemanticEditPolicy extends PrimitiveTypeItem */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomPrimitiveTypeItemSemanticEditPolicy extends PrimitiveTypeItem */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicyCN.java index 133e8a50a8b..9091a6bac87 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomPrimitiveTypeItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
@@ -41,10 +42,10 @@ public class CustomPrimitiveTypeItemSemanticEditPolicyCN extends PrimitiveTypeIt */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -74,10 +75,10 @@ public class CustomPrimitiveTypeItemSemanticEditPolicyCN extends PrimitiveTypeIt */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_4017 == req.getElementType()) {
- return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new CAssociationClassCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicy.java index 9a4b862eb6c..ab878b614d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CTemplateBindingCreateCommand;
@@ -40,7 +41,7 @@ public class CustomSignalItemSemanticEditPolicy extends SignalItemSemanticEditPo */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -70,7 +71,7 @@ public class CustomSignalItemSemanticEditPolicy extends SignalItemSemanticEditPo */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicyCN.java index 28073ee8d28..2050cee7f22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/itemsemantic/CustomSignalItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.BranchDependenctReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationReorientCommand;
import org.eclipse.papyrus.uml.diagram.clazz.custom.command.CTemplateBindingCreateCommand;
@@ -40,7 +41,7 @@ public class CustomSignalItemSemanticEditPolicyCN extends SignalItemSemanticEdit */
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateBinding_4015 == req.getElementType()) {
return getGEFWrapper(new CTemplateBindingCreateCommand(req, req.getSource(), req.getTarget()));
@@ -70,7 +71,7 @@ public class CustomSignalItemSemanticEditPolicyCN extends SignalItemSemanticEdit */
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Association_4001 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.clazz.custom.command.CAssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
//forbid creation of association branch from it.
if(UMLElementTypes.Association_4019 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml index b4af1a27da0..9c22ac68858 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml @@ -1432,62 +1432,7 @@ </command> </extension> -<extension point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramWithNavigationHandler" - commandId="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand"> - <activeWhen> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/> - </with> - </activeWhen> - </handler> -</extension> - -<extension point="org.eclipse.ui.menus"> - - <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu"> - <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" - label="Diagrams"> - <command commandId="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand" - icon="icons/obj16/Diagram_Class.gif" - label="Create a new Class Diagram" - style="push" - tooltip="Create a new Class Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menu> - </menuContribution> - - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> - <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar"> - <command commandId="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand" - icon="icons/obj16/Diagram_Class.gif" - label="Create a new Class Diagram" - style="push" - tooltip="Create a new Class Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </toolbar> - </menuContribution> - - <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram"> - <command commandId="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand" - icon="icons/obj16/Diagram_Class.gif" - label="Create a new Class Diagram" - style="push" - tooltip="Create a new Class Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menuContribution> -</extension> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationClassCreateCommand.java index 4bd8b570edc..fa27a1de6c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.AssociationClass;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class AssociationClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class AssociationClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public AssociationClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AssociationClassCreateCommand(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 AssociationClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AssociationClassCreateCommand(req, eObject);
+ public static AssociationClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AssociationClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AssociationClassCreateCommand(CreateElementRequest req) {
+ public AssociationClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class AssociationClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAssociationClass());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class AssociationClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
AssociationClass newElement = UMLFactory.eINSTANCE.createAssociationClass();
- 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_AssociationClass_2013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationNodeCreateCommand.java index f451b5f12bf..575260fd933 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/AssociationNodeCreateCommand.java @@ -23,10 +23,14 @@ 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.Association;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class AssociationNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class AssociationNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public AssociationNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AssociationNodeCreateCommand(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 AssociationNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AssociationNodeCreateCommand(req, eObject);
+ public static AssociationNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AssociationNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AssociationNodeCreateCommand(CreateElementRequest req) {
+ public AssociationNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class AssociationNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAssociation());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class AssociationNodeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Association newElement = UMLFactory.eINSTANCE.createAssociation();
- 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");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommand.java index 0d7918a67eb..6115df7cf86 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ClassCreateCommand(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 ClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ClassCreateCommand(req, eObject);
+ public static ClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassCreateCommand(CreateElementRequest req) {
+ public ClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +94,9 @@ public class ClassCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -98,8 +105,19 @@ public class ClassCreateCommand extends EditElementCommand { @Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- 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_Class_2008(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommandCN.java index a60ac83efa1..ab4348a84f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ClassCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ClassCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ClassCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ClassCreateCommandCN(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 ClassCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ClassCreateCommandCN(req, eObject);
+ public static ClassCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassCreateCommandCN(CreateElementRequest req) {
+ public ClassCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ClassCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ClassCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- 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_Class_3010(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassifierTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassifierTemplateParameterCreateCommand.java index 17ba46ea45d..63b7feb1c59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassifierTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ClassifierTemplateParameterCreateCommand.java @@ -23,10 +23,14 @@ 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.ClassifierTemplateParameter;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class ClassifierTemplateParameterCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class ClassifierTemplateParameterCreateCommand extends EditElementCommand /**
* @generated
*/
- public ClassifierTemplateParameterCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ClassifierTemplateParameterCreateCommand(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 ClassifierTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ClassifierTemplateParameterCreateCommand(req, eObject);
+ public static ClassifierTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassifierTemplateParameterCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassifierTemplateParameterCreateCommand(CreateElementRequest req) {
+ public ClassifierTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class ClassifierTemplateParameterCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClassifierTemplateParameter());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class ClassifierTemplateParameterCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ClassifierTemplateParameter newElement = UMLFactory.eINSTANCE.createClassifierTemplateParameter();
- TemplateSignature owner = (TemplateSignature)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 {
+ TemplateSignature qualifiedTarget = (TemplateSignature)target;
+ qualifiedTarget.getOwnedParameters().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
TemplateSignature childHolder = (TemplateSignature)getElementToEdit();
childHolder.getParameters().add(newElement);
doConfigure(newElement, monitor, info);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommand.java index 3581b940740..355c692104b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,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;
}
/**
@@ -87,7 +92,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();
}
/**
@@ -95,8 +102,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_2012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommandCN.java index 7cf95027d11..7874e985aa9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/CommentCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class CommentCreateCommandCN 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();
}
/**
@@ -95,8 +102,19 @@ public class CommentCreateCommandCN 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_3028(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommand.java index f76b1895903..532775c3f88 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ComponentCreateCommand(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 ComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ComponentCreateCommand(req, eObject);
+ public static ComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCreateCommand(CreateElementRequest req) {
+ public ComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_2002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommandCN.java index 5e342190373..9ff92878230 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ComponentCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ComponentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ComponentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ComponentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ComponentCreateCommandCN(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 ComponentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ComponentCreateCommandCN(req, eObject);
+ public static ComponentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCreateCommandCN(CreateElementRequest req) {
+ public ComponentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ComponentCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ComponentCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_3021(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConnectableElementTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConnectableElementTemplateParameterCreateCommand.java index d9d8d4b8a73..f1e500a8cdb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConnectableElementTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConnectableElementTemplateParameterCreateCommand.java @@ -23,10 +23,14 @@ 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.ConnectableElementTemplateParameter;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class ConnectableElementTemplateParameterCreateCommand extends EditElemen /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class ConnectableElementTemplateParameterCreateCommand extends EditElemen /**
* @generated
*/
- public ConnectableElementTemplateParameterCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConnectableElementTemplateParameterCreateCommand(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 ConnectableElementTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConnectableElementTemplateParameterCreateCommand(req, eObject);
+ public static ConnectableElementTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConnectableElementTemplateParameterCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConnectableElementTemplateParameterCreateCommand(CreateElementRequest req) {
+ public ConnectableElementTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class ConnectableElementTemplateParameterCreateCommand extends EditElemen * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConnectableElementTemplateParameter());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class ConnectableElementTemplateParameterCreateCommand extends EditElemen */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ConnectableElementTemplateParameter newElement = UMLFactory.eINSTANCE.createConnectableElementTemplateParameter();
- TemplateSignature owner = (TemplateSignature)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 {
+ TemplateSignature qualifiedTarget = (TemplateSignature)target;
+ qualifiedTarget.getOwnedParameters().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
TemplateSignature childHolder = (TemplateSignature)getElementToEdit();
childHolder.getParameters().add(newElement);
doConfigure(newElement, monitor, info);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommand.java index f2cbcc1abbb..6ba672ea76d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ConstraintCreateCommand 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();
}
/**
@@ -95,8 +102,19 @@ public class ConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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_Constraint_2011(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommandCN.java index cc8bc42caa4..b87b333325d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ConstraintCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,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;
}
/**
@@ -87,7 +92,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();
}
/**
@@ -95,8 +102,19 @@ public class ConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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_Constraint_3029(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ContextLinkCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ContextLinkCreateCommand.java index 0b1df614131..e50bb3b50e0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ContextLinkCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ContextLinkCreateCommand.java @@ -64,7 +64,7 @@ public class ContextLinkCreateCommand extends EditElementCommand { return true; // link creation is in progress; source is not defined yet
}
// target may be null here but it's possible to check constraint
- return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateConstraintContext_8500(getSource(), resolveTargetNamespace());
+ return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateConstraintContext_8500(getSource(), getTarget());
}
/**
@@ -74,8 +74,8 @@ public class ContextLinkCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
- if(getSource() != null && resolveTargetNamespace() != null) {
- getSource().setContext(resolveTargetNamespace());
+ if(getSource() != null && getTarget() != null) {
+ getSource().setContext(getTarget());
}
return CommandResult.newOKCommandResult();
}
@@ -97,7 +97,7 @@ public class ContextLinkCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected Namespace resolveTargetNamespace() {
+ protected Namespace getTarget() {
return (Namespace)target;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommand.java index 55f170b5fa8..c2827a7ba67 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommand(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 DataTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommand(req, eObject);
+ public static DataTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req) {
+ public DataTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class DataTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class DataTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- 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_DataType_2010(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommandCN.java index e6e2d063c4b..e8e37857a68 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DataTypeCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommandCN(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 DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommandCN(req, eObject);
+ public static DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req) {
+ public DataTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class DataTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class DataTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- 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_DataType_3027(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DefaultNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DefaultNamedElementCreateCommand.java index f374a134c86..32524caf37d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DefaultNamedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DefaultNamedElementCreateCommand.java @@ -23,8 +23,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
@@ -34,7 +38,7 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DefaultNamedElementCreateCommand(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 DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DefaultNamedElementCreateCommand(req, eObject);
+ public static DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DefaultNamedElementCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req) {
+ public DefaultNamedElementCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -84,7 +89,9 @@ public class DefaultNamedElementCreateCommand 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.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DependencyNodeCreateCommand.java index 09de634724b..f46d7e4e4f1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DependencyNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DependencyNodeCreateCommand.java @@ -23,10 +23,14 @@ 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.Dependency;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DependencyNodeCreateCommand(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 DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DependencyNodeCreateCommand(req, eObject);
+ public static DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DependencyNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req) {
+ public DependencyNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class DependencyNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class DependencyNodeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
- 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");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DurationObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DurationObservationCreateCommand.java index 8695585f551..6a9fbc5ca99 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DurationObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/DurationObservationCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationObservationCreateCommand(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 DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationObservationCreateCommand(req, eObject);
+ public static DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req) {
+ public DurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class DurationObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class DurationObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
- 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_DurationObservation_2095(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommand.java index 9d34cde2b3d..9ea74d20f9b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommand(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 EnumerationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommand(req, eObject);
+ public static EnumerationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req) {
+ public EnumerationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class EnumerationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class EnumerationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- 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_Enumeration_2006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommandCN.java index d07ff1aff01..e591d1b290c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommandCN(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 EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommandCN(req, eObject);
+ public static EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req) {
+ public EnumerationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class EnumerationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class EnumerationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- 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_Enumeration_3025(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java index 8e51364a67d..17e511ab750 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/EnumerationLiteralCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EnumerationLiteralCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EnumerationLiteralCreateCommand(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 EnumerationLiteralCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EnumerationLiteralCreateCommand(req, eObject);
+ public static EnumerationLiteralCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationLiteralCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationLiteralCreateCommand(CreateElementRequest req) {
+ public EnumerationLiteralCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumerationLiteral());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
EnumerationLiteral newElement = UMLFactory.eINSTANCE.createEnumerationLiteral();
- Enumeration owner = (Enumeration)getElementToEdit();
- owner.getOwnedLiterals().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 {
+ Enumeration qualifiedTarget = (Enumeration)target;
+ qualifiedTarget.getOwnedLiterals().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_EnumerationLiteral_3017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommand.java index c318d894431..e4033a65a5a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommand.java @@ -24,11 +24,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.InformationItem;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InformationItemCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InformationItemCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InformationItemCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InformationItemCreateCommand(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 InformationItemCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InformationItemCreateCommand(req, eObject);
+ public static InformationItemCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InformationItemCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InformationItemCreateCommand(CreateElementRequest req) {
+ public InformationItemCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InformationItemCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInformationItem());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InformationItemCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InformationItem newElement = UMLFactory.eINSTANCE.createInformationItem();
- 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_InformationItem_2099(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommandCN.java index 5453abbd3e2..2067544d83c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InformationItemCreateCommandCN.java @@ -24,11 +24,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.InformationItem;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InformationItemCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InformationItemCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InformationItemCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InformationItemCreateCommandCN(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 InformationItemCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InformationItemCreateCommandCN(req, eObject);
+ public static InformationItemCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InformationItemCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InformationItemCreateCommandCN(CreateElementRequest req) {
+ public InformationItemCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InformationItemCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInformationItem());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InformationItemCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InformationItem newElement = UMLFactory.eINSTANCE.createInformationItem();
- 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_InformationItem_3040(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java index 4e5da74c62f..554d16664ff 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InstanceSpecificationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InstanceSpecificationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InstanceSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InstanceSpecificationCreateCommand(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 InstanceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InstanceSpecificationCreateCommand(req, eObject);
+ public static InstanceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InstanceSpecificationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InstanceSpecificationCreateCommand(CreateElementRequest req) {
+ public InstanceSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InstanceSpecificationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInstanceSpecification());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class InstanceSpecificationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InstanceSpecification newElement = UMLFactory.eINSTANCE.createInstanceSpecification();
- 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_InstanceSpecification_2001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommandCN.java index 5bbed61c016..4348bb9c886 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InstanceSpecificationCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InstanceSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InstanceSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InstanceSpecificationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InstanceSpecificationCreateCommandCN(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 InstanceSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InstanceSpecificationCreateCommandCN(req, eObject);
+ public static InstanceSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InstanceSpecificationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InstanceSpecificationCreateCommandCN(CreateElementRequest req) {
+ public InstanceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InstanceSpecificationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInstanceSpecification());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class InstanceSpecificationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InstanceSpecification newElement = UMLFactory.eINSTANCE.createInstanceSpecification();
- 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_InstanceSpecification_3020(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommand.java index 06b1c40dc05..ad3f5a8af64 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommand(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 InterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommand(req, eObject);
+ public static InterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req) {
+ public InterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class InterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_2004(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommandCN.java index 2ea35d9bb7b..d875e29ebf6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/InterfaceCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InterfaceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InterfaceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommandCN(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 InterfaceCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommandCN(req, eObject);
+ public static InterfaceCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommandCN(CreateElementRequest req) {
+ public InterfaceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InterfaceCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class InterfaceCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_3023(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandCN.java index e19bc368683..a030f078497 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandCN(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 ModelCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandCN(req, eObject);
+ public static ModelCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req) {
+ public ModelCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ModelCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ModelCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_3024(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandTN.java index 4af65fe353a..b0ff286e54d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ModelCreateCommandTN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandTN(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 ModelCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandTN(req, eObject);
+ public static ModelCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandTN(CreateElementRequest req) {
+ public ModelCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ModelCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ModelCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_2005(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForClassCreateCommand.java index 66702b02b31..063eca2d454 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForClassCreateCommand.java @@ -23,10 +23,14 @@ 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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class NestedClassForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class NestedClassForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedClassForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedClassForClassCreateCommand(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 NestedClassForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedClassForClassCreateCommand(req, eObject);
+ public static NestedClassForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedClassForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedClassForClassCreateCommand(CreateElementRequest req) {
+ public NestedClassForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class NestedClassForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class NestedClassForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Class_3014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForComponentCreateCommand.java index 2960f50eb37..1452be479db 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForComponentCreateCommand.java @@ -23,10 +23,14 @@ 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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class NestedClassForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class NestedClassForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedClassForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedClassForComponentCreateCommand(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 NestedClassForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedClassForComponentCreateCommand(req, eObject);
+ public static NestedClassForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedClassForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedClassForComponentCreateCommand(CreateElementRequest req) {
+ public NestedClassForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class NestedClassForComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class NestedClassForComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Class_3004(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForInterfaceCreateCommand.java index e5fe1bf2560..974f933ba07 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedClassForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedClassForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedClassForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedClassForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedClassForInterfaceCreateCommand(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 NestedClassForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedClassForInterfaceCreateCommand(req, eObject);
+ public static NestedClassForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedClassForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedClassForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedClassForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedClassForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedClassForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Class_3008(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForClassCreateCommand.java index 92da46c021c..b87274b3f22 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedDataTypeForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedDataTypeForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedDataTypeForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedDataTypeForClassCreateCommand(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 NestedDataTypeForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedDataTypeForClassCreateCommand(req, eObject);
+ public static NestedDataTypeForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedDataTypeForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedDataTypeForClassCreateCommand(CreateElementRequest req) {
+ public NestedDataTypeForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedDataTypeForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedDataTypeForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataType_3044(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForComponentCreateCommand.java index b0956866774..4c97e4045fb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedDataTypeForComponentCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedDataTypeForComponentCreateCommand extends EditElementCommand /**
* @generated
*/
- public NestedDataTypeForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedDataTypeForComponentCreateCommand(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 NestedDataTypeForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedDataTypeForComponentCreateCommand(req, eObject);
+ public static NestedDataTypeForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedDataTypeForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedDataTypeForComponentCreateCommand(CreateElementRequest req) {
+ public NestedDataTypeForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedDataTypeForComponentCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedDataTypeForComponentCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataType_3045(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForInterfaceCreateCommand.java index 73d631eb9f3..1e6710dc18b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedDataTypeForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedDataTypeForInterfaceCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedDataTypeForInterfaceCreateCommand extends EditElementCommand /**
* @generated
*/
- public NestedDataTypeForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedDataTypeForInterfaceCreateCommand(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 NestedDataTypeForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedDataTypeForInterfaceCreateCommand(req, eObject);
+ public static NestedDataTypeForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedDataTypeForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedDataTypeForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedDataTypeForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedDataTypeForInterfaceCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedDataTypeForInterfaceCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataType_3043(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForClassCreateCommand.java index ba6430c9020..65169b46a07 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedEnumerationForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedEnumerationForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedEnumerationForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedEnumerationForClassCreateCommand(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 NestedEnumerationForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedEnumerationForClassCreateCommand(req, eObject);
+ public static NestedEnumerationForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedEnumerationForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedEnumerationForClassCreateCommand(CreateElementRequest req) {
+ public NestedEnumerationForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedEnumerationForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedEnumerationForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Enumeration_3052(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForComponentCreateCommand.java index 81f76a19bc4..35ce57c1c75 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedEnumerationForComponentCreateCommand extends EditElementComma /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedEnumerationForComponentCreateCommand extends EditElementComma /**
* @generated
*/
- public NestedEnumerationForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedEnumerationForComponentCreateCommand(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 NestedEnumerationForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedEnumerationForComponentCreateCommand(req, eObject);
+ public static NestedEnumerationForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedEnumerationForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedEnumerationForComponentCreateCommand(CreateElementRequest req) {
+ public NestedEnumerationForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedEnumerationForComponentCreateCommand extends EditElementComma * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedEnumerationForComponentCreateCommand extends EditElementComma */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Enumeration_3053(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForInterfaceCreateCommand.java index 6753552c9fc..9724fde32c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedEnumerationForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedEnumerationForInterfaceCreateCommand extends EditElementComma /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedEnumerationForInterfaceCreateCommand extends EditElementComma /**
* @generated
*/
- public NestedEnumerationForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedEnumerationForInterfaceCreateCommand(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 NestedEnumerationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedEnumerationForInterfaceCreateCommand(req, eObject);
+ public static NestedEnumerationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedEnumerationForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedEnumerationForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedEnumerationForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedEnumerationForInterfaceCreateCommand extends EditElementComma * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedEnumerationForInterfaceCreateCommand extends EditElementComma */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Enumeration_3054(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForClassCreateCommand.java index 995fd9078ae..02085840031 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForClassCreateCommand.java @@ -24,11 +24,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class NestedInterfaceForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class NestedInterfaceForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedInterfaceForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedInterfaceForClassCreateCommand(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 NestedInterfaceForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedInterfaceForClassCreateCommand(req, eObject);
+ public static NestedInterfaceForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedInterfaceForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedInterfaceForClassCreateCommand(CreateElementRequest req) {
+ public NestedInterfaceForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class NestedInterfaceForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class NestedInterfaceForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interface_3036(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForComponentCreateCommand.java index 5f7dcc6719c..389713a03ae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForComponentCreateCommand.java @@ -24,11 +24,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class NestedInterfaceForComponentCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class NestedInterfaceForComponentCreateCommand extends EditElementCommand /**
* @generated
*/
- public NestedInterfaceForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedInterfaceForComponentCreateCommand(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 NestedInterfaceForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedInterfaceForComponentCreateCommand(req, eObject);
+ public static NestedInterfaceForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedInterfaceForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedInterfaceForComponentCreateCommand(CreateElementRequest req) {
+ public NestedInterfaceForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class NestedInterfaceForComponentCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class NestedInterfaceForComponentCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interface_3037(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForInterfaceCreateCommand.java index 43716adac36..3dd63c29f90 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedInterfaceForInterfaceCreateCommand.java @@ -24,10 +24,14 @@ 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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedInterfaceForInterfaceCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedInterfaceForInterfaceCreateCommand extends EditElementCommand /**
* @generated
*/
- public NestedInterfaceForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedInterfaceForInterfaceCreateCommand(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 NestedInterfaceForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedInterfaceForInterfaceCreateCommand(req, eObject);
+ public static NestedInterfaceForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedInterfaceForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedInterfaceForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedInterfaceForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedInterfaceForInterfaceCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedInterfaceForInterfaceCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interface_3038(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForClassCreateCommand.java index 1c4f3114067..b14d00edefb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedPrimitiveTypeForClassCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedPrimitiveTypeForClassCreateCommand extends EditElementCommand /**
* @generated
*/
- public NestedPrimitiveTypeForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedPrimitiveTypeForClassCreateCommand(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 NestedPrimitiveTypeForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedPrimitiveTypeForClassCreateCommand(req, eObject);
+ public static NestedPrimitiveTypeForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedPrimitiveTypeForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedPrimitiveTypeForClassCreateCommand(CreateElementRequest req) {
+ public NestedPrimitiveTypeForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedPrimitiveTypeForClassCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedPrimitiveTypeForClassCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_PrimitiveType_3047(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForComponentCreateCommand.java index 71b7b616189..329687ccca3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedPrimitiveTypeForComponentCreateCommand extends EditElementCom /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedPrimitiveTypeForComponentCreateCommand extends EditElementCom /**
* @generated
*/
- public NestedPrimitiveTypeForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedPrimitiveTypeForComponentCreateCommand(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 NestedPrimitiveTypeForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedPrimitiveTypeForComponentCreateCommand(req, eObject);
+ public static NestedPrimitiveTypeForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedPrimitiveTypeForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedPrimitiveTypeForComponentCreateCommand(CreateElementRequest req) {
+ public NestedPrimitiveTypeForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedPrimitiveTypeForComponentCreateCommand extends EditElementCom * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedPrimitiveTypeForComponentCreateCommand extends EditElementCom */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_PrimitiveType_3046(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForInterfaceCreateCommand.java index d34823e9835..626dc81a467 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedPrimitiveTypeForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedPrimitiveTypeForInterfaceCreateCommand extends EditElementCom /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedPrimitiveTypeForInterfaceCreateCommand extends EditElementCom /**
* @generated
*/
- public NestedPrimitiveTypeForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedPrimitiveTypeForInterfaceCreateCommand(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 NestedPrimitiveTypeForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedPrimitiveTypeForInterfaceCreateCommand(req, eObject);
+ public static NestedPrimitiveTypeForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedPrimitiveTypeForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedPrimitiveTypeForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedPrimitiveTypeForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedPrimitiveTypeForInterfaceCreateCommand extends EditElementCom * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedPrimitiveTypeForInterfaceCreateCommand extends EditElementCom */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_PrimitiveType_3048(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForClassCreateCommand.java index 74f38b67401..9597596888c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedSignalForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedSignalForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedSignalForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedSignalForClassCreateCommand(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 NestedSignalForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedSignalForClassCreateCommand(req, eObject);
+ public static NestedSignalForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedSignalForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedSignalForClassCreateCommand(CreateElementRequest req) {
+ public NestedSignalForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedSignalForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedSignalForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Signal_3050(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForComponentCreateCommand.java index 3dfbec53c6d..31dacf89bee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedSignalForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedSignalForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedSignalForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedSignalForComponentCreateCommand(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 NestedSignalForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedSignalForComponentCreateCommand(req, eObject);
+ public static NestedSignalForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedSignalForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedSignalForComponentCreateCommand(CreateElementRequest req) {
+ public NestedSignalForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedSignalForComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedSignalForComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Signal_3051(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForInterfaceCreateCommand.java index bc9c70aebac..7075db8b966 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/NestedSignalForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedSignalForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedSignalForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NestedSignalForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NestedSignalForInterfaceCreateCommand(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 NestedSignalForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NestedSignalForInterfaceCreateCommand(req, eObject);
+ public static NestedSignalForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedSignalForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedSignalForInterfaceCreateCommand(CreateElementRequest req) {
+ public NestedSignalForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class NestedSignalForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class NestedSignalForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- Interface owner = (Interface)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Signal_3049(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForClassCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForClassCommand.java index b50cab3d1fd..3d6f96db973 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForClassCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForClassCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class OperationForClassCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class OperationForClassCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForClassCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForClassCommand(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 OperationForClassCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForClassCommand(req, eObject);
+ public static OperationForClassCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForClassCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForClassCommand(CreateElementRequest req) {
+ public OperationForClassCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class OperationForClassCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class OperationForClassCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForComponentCreateCommand.java index 8f6d4f415cf..872ca1f17e8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class OperationForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class OperationForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForComponentCreateCommand(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 OperationForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForComponentCreateCommand(req, eObject);
+ public static OperationForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForComponentCreateCommand(CreateElementRequest req) {
+ public OperationForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class OperationForComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class OperationForComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3003(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForDataTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForDataTypeCreateCommand.java index e26cbfa7d54..3fc81d121db 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForDataTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForDataTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class OperationForDataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class OperationForDataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForDataTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForDataTypeCreateCommand(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 OperationForDataTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForDataTypeCreateCommand(req, eObject);
+ public static OperationForDataTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForDataTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForDataTypeCreateCommand(CreateElementRequest req) {
+ public OperationForDataTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class OperationForDataTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class OperationForDataTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedOperations().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3019(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForInterfaceCreateCommand.java index b6a626581a9..93e9e03ce5c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForInterfaceCreateCommand(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 OperationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForInterfaceCreateCommand(req, eObject);
+ public static OperationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForInterfaceCreateCommand(CreateElementRequest req) {
+ public OperationForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForPrimitiveTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForPrimitiveTypeCreateCommand.java index 56c7c98c882..7e8744bcdab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForPrimitiveTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationForPrimitiveTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class OperationForPrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class OperationForPrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForPrimitiveTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForPrimitiveTypeCreateCommand(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 OperationForPrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForPrimitiveTypeCreateCommand(req, eObject);
+ public static OperationForPrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForPrimitiveTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForPrimitiveTypeCreateCommand(CreateElementRequest req) {
+ public OperationForPrimitiveTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class OperationForPrimitiveTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class OperationForPrimitiveTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedOperations().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3042(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationTemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationTemplateParameterCreateCommand.java index ee59e23532f..66e5de5a7a3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationTemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/OperationTemplateParameterCreateCommand.java @@ -23,10 +23,14 @@ 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.OperationTemplateParameter;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class OperationTemplateParameterCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class OperationTemplateParameterCreateCommand extends EditElementCommand /**
* @generated
*/
- public OperationTemplateParameterCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationTemplateParameterCreateCommand(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 OperationTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationTemplateParameterCreateCommand(req, eObject);
+ public static OperationTemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationTemplateParameterCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationTemplateParameterCreateCommand(CreateElementRequest req) {
+ public OperationTemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class OperationTemplateParameterCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperationTemplateParameter());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class OperationTemplateParameterCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OperationTemplateParameter newElement = UMLFactory.eINSTANCE.createOperationTemplateParameter();
- TemplateSignature owner = (TemplateSignature)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 {
+ TemplateSignature qualifiedTarget = (TemplateSignature)target;
+ qualifiedTarget.getOwnedParameters().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
TemplateSignature childHolder = (TemplateSignature)getElementToEdit();
childHolder.getParameters().add(newElement);
doConfigure(newElement, monitor, info);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommand.java index 89974d7063f..f6f46a38bda 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommand.java @@ -23,10 +23,14 @@ 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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommand(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 PackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommand(req, eObject);
+ public static PackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req) {
+ public PackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class PackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class PackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_2007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommandCN.java index 0aeff043a6b..7f797e963ec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PackageCreateCommandCN.java @@ -23,10 +23,14 @@ 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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandCN(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 PackageCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandCN(req, eObject);
+ public static PackageCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req) {
+ public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class PackageCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_3009(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java index 3c587e14baf..8b60d789259 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommand(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 PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommand(req, eObject);
+ public static PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- 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_PrimitiveType_2009(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommandCN.java index e996a0e2b72..8c383195adc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PrimitiveTypeCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommandCN(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 PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommandCN(req, eObject);
+ public static PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- 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_PrimitiveType_3026(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForClassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForClassCreateCommand.java index 2c94b1f3ddc..a6bf0571f21 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForClassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForClassCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyForClassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyForClassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyForClassCreateCommand(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 PropertyForClassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyForClassCreateCommand(req, eObject);
+ public static PropertyForClassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyForClassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyForClassCreateCommand(CreateElementRequest req) {
+ public PropertyForClassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyForClassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyForClassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForComponentCreateCommand.java index c13b0d45e62..bcc518667ca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForComponentCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyForComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyForComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyForComponentCreateCommand(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 PropertyForComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyForComponentCreateCommand(req, eObject);
+ public static PropertyForComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyForComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyForComponentCreateCommand(CreateElementRequest req) {
+ public PropertyForComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyForComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyForComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForInterfaceCreateCommand.java index 61e3a166994..1ba032b1f3a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForInterfaceCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyForInterfaceCreateCommand(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 PropertyForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyForInterfaceCreateCommand(req, eObject);
+ public static PropertyForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyForInterfaceCreateCommand(CreateElementRequest req) {
+ public PropertyForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForSignalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForSignalCreateCommand.java index f1ec6a0786a..e85d3feb10b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForSignalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyForSignalCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyForSignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyForSignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyForSignalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyForSignalCreateCommand(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 PropertyForSignalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyForSignalCreateCommand(req, eObject);
+ public static PropertyForSignalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyForSignalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyForSignalCreateCommand(CreateElementRequest req) {
+ public PropertyForSignalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyForSignalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyForSignalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- Signal owner = (Signal)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ Signal qualifiedTarget = (Signal)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3005(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforDataTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforDataTypeCreateCommand.java index b515dc78a7c..553b4a4895c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforDataTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforDataTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyforDataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyforDataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyforDataTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyforDataTypeCreateCommand(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 PropertyforDataTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyforDataTypeCreateCommand(req, eObject);
+ public static PropertyforDataTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyforDataTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyforDataTypeCreateCommand(CreateElementRequest req) {
+ public PropertyforDataTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyforDataTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyforDataTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforPrimitiveTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforPrimitiveTypeCreateCommand.java index 32d2c27e14a..1b163f0ab9c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforPrimitiveTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/PropertyforPrimitiveTypeCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PropertyforPrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PropertyforPrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyforPrimitiveTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyforPrimitiveTypeCreateCommand(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 PropertyforPrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyforPrimitiveTypeCreateCommand(req, eObject);
+ public static PropertyforPrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyforPrimitiveTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyforPrimitiveTypeCreateCommand(CreateElementRequest req) {
+ public PropertyforPrimitiveTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PropertyforPrimitiveTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PropertyforPrimitiveTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3041(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionCreateCommand.java index 5a61dfe48b7..f9eec818cae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Reception;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ReceptionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ReceptionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ReceptionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReceptionCreateCommand(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 ReceptionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReceptionCreateCommand(req, eObject);
+ public static ReceptionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReceptionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReceptionCreateCommand(CreateElementRequest req) {
+ public ReceptionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ReceptionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReception());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ReceptionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Reception newElement = UMLFactory.eINSTANCE.createReception();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedReceptions().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedReceptions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Reception_3011(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionInInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionInInterfaceCreateCommand.java index 4d125329092..cba81547650 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionInInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ReceptionInInterfaceCreateCommand.java @@ -24,11 +24,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Reception;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ReceptionInInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReceptionInInterfaceCreateCommand(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 ReceptionInInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReceptionInInterfaceCreateCommand(req, eObject);
+ public static ReceptionInInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReceptionInInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReceptionInInterfaceCreateCommand(CreateElementRequest req) {
+ public ReceptionInInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReception());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Reception newElement = UMLFactory.eINSTANCE.createReception();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedReceptions().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedReceptions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Reception_3039(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java index 3f53d8f5840..1f9730f91f6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/RedefinableTemplateSignatureCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.RedefinableTemplateSignature;
import org.eclipse.uml2.uml.TemplateableElement;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class RedefinableTemplateSignatureCreateCommand extends EditElementComman /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class RedefinableTemplateSignatureCreateCommand extends EditElementComman /**
* @generated
*/
- public RedefinableTemplateSignatureCreateCommand(CreateElementRequest req, EObject eObject) {
+ public RedefinableTemplateSignatureCreateCommand(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 RedefinableTemplateSignatureCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new RedefinableTemplateSignatureCreateCommand(req, eObject);
+ public static RedefinableTemplateSignatureCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new RedefinableTemplateSignatureCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public RedefinableTemplateSignatureCreateCommand(CreateElementRequest req) {
+ public RedefinableTemplateSignatureCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -91,7 +96,9 @@ public class RedefinableTemplateSignatureCreateCommand extends EditElementComman if(container.getOwnedTemplateSignature() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getRedefinableTemplateSignature());
+ return data.isPermitted();
}
/**
@@ -99,8 +106,19 @@ public class RedefinableTemplateSignatureCreateCommand extends EditElementComman */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
RedefinableTemplateSignature newElement = UMLFactory.eINSTANCE.createRedefinableTemplateSignature();
- TemplateableElement owner = (TemplateableElement)getElementToEdit();
- owner.setOwnedTemplateSignature(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 {
+ TemplateableElement qualifiedTarget = (TemplateableElement)target;
+ qualifiedTarget.setOwnedTemplateSignature(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_RedefinableTemplateSignature_3015(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShapeNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShapeNamedElementCreateCommand.java index 8274cb84dc1..cd538de51d6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShapeNamedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShapeNamedElementCreateCommand.java @@ -23,8 +23,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
@@ -34,7 +38,7 @@ public class ShapeNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,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;
}
/**
@@ -84,7 +89,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.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShortCutDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShortCutDiagramCreateCommand.java index 271a8c4d117..aaeb69e43d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShortCutDiagramCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/ShortCutDiagramCreateCommand.java @@ -36,7 +36,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +46,25 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ShortCutDiagramCreateCommand(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 ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ShortCutDiagramCreateCommand(req, eObject);
+ public static ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ShortCutDiagramCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req) {
+ public ShortCutDiagramCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommand.java index 2c19339ca2b..ea6c4f68b2e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class SignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class SignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public SignalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SignalCreateCommand(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 SignalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SignalCreateCommand(req, eObject);
+ public static SignalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SignalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SignalCreateCommand(CreateElementRequest req) {
+ public SignalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class SignalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class SignalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- 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_Signal_2003(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommandCN.java index 13c6fb3e733..f518c73f6e4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SignalCreateCommandCN.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class SignalCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class SignalCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public SignalCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public SignalCreateCommandCN(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 SignalCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new SignalCreateCommandCN(req, eObject);
+ public static SignalCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SignalCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public SignalCreateCommandCN(CreateElementRequest req) {
+ public SignalCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class SignalCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class SignalCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- 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_Signal_3022(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SlotCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SlotCreateCommand.java index 069cecf226c..078047f8362 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SlotCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/SlotCreateCommand.java @@ -23,10 +23,14 @@ 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.InstanceSpecification;
import org.eclipse.uml2.uml.Slot;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class SlotCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class SlotCreateCommand extends EditElementCommand { /**
* @generated
*/
- public SlotCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SlotCreateCommand(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 SlotCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SlotCreateCommand(req, eObject);
+ public static SlotCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SlotCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SlotCreateCommand(CreateElementRequest req) {
+ public SlotCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class SlotCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSlot());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class SlotCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Slot newElement = UMLFactory.eINSTANCE.createSlot();
- InstanceSpecification owner = (InstanceSpecification)getElementToEdit();
- owner.getSlots().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 {
+ InstanceSpecification qualifiedTarget = (InstanceSpecification)target;
+ qualifiedTarget.getSlots().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.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java index e14c8296b83..186daffe494 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateParameterCreateCommand.java @@ -23,10 +23,14 @@ 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.TemplateParameter;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class TemplateParameterCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class TemplateParameterCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TemplateParameterCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TemplateParameterCreateCommand(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 TemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TemplateParameterCreateCommand(req, eObject);
+ public static TemplateParameterCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TemplateParameterCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TemplateParameterCreateCommand(CreateElementRequest req) {
+ public TemplateParameterCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class TemplateParameterCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTemplateParameter());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class TemplateParameterCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TemplateParameter newElement = UMLFactory.eINSTANCE.createTemplateParameter();
- TemplateSignature owner = (TemplateSignature)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 {
+ TemplateSignature qualifiedTarget = (TemplateSignature)target;
+ qualifiedTarget.getOwnedParameters().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
TemplateSignature childHolder = (TemplateSignature)getElementToEdit();
childHolder.getParameters().add(newElement);
doConfigure(newElement, monitor, info);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateSignatureCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateSignatureCreateCommand.java index 29e4b5f710d..9515c23c080 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateSignatureCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TemplateSignatureCreateCommand.java @@ -23,10 +23,14 @@ 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.TemplateSignature;
import org.eclipse.uml2.uml.TemplateableElement;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class TemplateSignatureCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class TemplateSignatureCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TemplateSignatureCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TemplateSignatureCreateCommand(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 TemplateSignatureCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TemplateSignatureCreateCommand(req, eObject);
+ public static TemplateSignatureCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TemplateSignatureCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TemplateSignatureCreateCommand(CreateElementRequest req) {
+ public TemplateSignatureCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +95,9 @@ public class TemplateSignatureCreateCommand extends EditElementCommand { if(container.getOwnedTemplateSignature() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTemplateSignature());
+ return data.isPermitted();
}
/**
@@ -98,8 +105,19 @@ public class TemplateSignatureCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TemplateSignature newElement = UMLFactory.eINSTANCE.createTemplateSignature();
- TemplateableElement owner = (TemplateableElement)getElementToEdit();
- owner.setOwnedTemplateSignature(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 {
+ TemplateableElement qualifiedTarget = (TemplateableElement)target;
+ qualifiedTarget.setOwnedTemplateSignature(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.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TimeObservationCreateCommand.java index 0518477262a..f57d996ff8c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/commands/TimeObservationCreateCommand.java @@ -23,11 +23,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.clazz.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeObservationCreateCommand(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 TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeObservationCreateCommand(req, eObject);
+ public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req) {
+ public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class TimeObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class TimeObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
- 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_TimeObservation_2096(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java index f22685cf835..00ea7dc0b55 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class AssociationClassAttributeCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForComponentCreateCommand(req));
+ return getGEFWrapper(new PropertyForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassNestedClassifierCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassNestedClassifierCompartmentItemSemanticEditPolicy.java index e08d4de903b..bc3f014a9fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassNestedClassifierCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassNestedClassifierCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class AssociationClassNestedClassifierCompartmentItemSemanticEditPolicy e if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedClassForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassOperationCompartmentItemSemanticEditPolicy.java index 03959c06f84..a9d9f578882 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/AssociationClassOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class AssociationClassOperationCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForComponentCreateCommand(req));
+ return getGEFWrapper(new OperationForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java index 941c93edb25..45344cea235 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class ClassAttributeCompartmentItemSemanticEditPolicy extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForClassCreateCommand(req));
+ return getGEFWrapper(new PropertyForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicyCN.java index edb2c710e47..1f7b3058b7c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class ClassAttributeCompartmentItemSemanticEditPolicyCN extends UMLBaseIt if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForClassCreateCommand(req));
+ return getGEFWrapper(new PropertyForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java index edd1ed2eadf..b7a41890028 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class ClassItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicyCN.java index b081119e1ad..0cbbcc460db 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class ClassItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java index decc08430b0..74ef441fbbe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForClassCreateCommand;
@@ -61,37 +62,37 @@ public class ClassNestedClassifierCompartmentItemSemanticEditPolicy extends UMLB if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForClassCreateCommand(req));
+ return getGEFWrapper(new NestedClassForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3036 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForClassCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3052 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForClassCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3047 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForClassCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3044 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForClassCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3050 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForClassCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicyCN.java index c93267f89b6..d60c19f11ca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassNestedClassifierCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForClassCreateCommand;
@@ -61,37 +62,37 @@ public class ClassNestedClassifierCompartmentItemSemanticEditPolicyCN extends UM if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForClassCreateCommand(req));
+ return getGEFWrapper(new NestedClassForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3036 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForClassCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3052 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForClassCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3047 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForClassCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3044 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForClassCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3050 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForClassCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java index d7e98c25ac6..5d65414905c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForClassCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class ClassOperationCompartmentItemSemanticEditPolicy extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionCreateCommand(req));
+ return getGEFWrapper(new ReceptionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Operation_3013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForClassCommand(req));
+ return getGEFWrapper(new OperationForClassCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicyCN.java index 437e8d2af44..1bd93f58518 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ClassOperationCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForClassCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class ClassOperationCompartmentItemSemanticEditPolicyCN extends UMLBaseIt if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionCreateCommand(req));
+ return getGEFWrapper(new ReceptionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Operation_3013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForClassCommand(req));
+ return getGEFWrapper(new OperationForClassCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java index 18042485a75..89c3b2477de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class ComponentAttributeCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForComponentCreateCommand(req));
+ return getGEFWrapper(new PropertyForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicyCN.java index c857808dd13..66ebc29c040 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class ComponentAttributeCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForComponentCreateCommand(req));
+ return getGEFWrapper(new PropertyForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java index 87f76653b01..367d38a5a8f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicyCN.java index 0e1f4bdbd1a..137abdb2518 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java index da516aaae42..e6144568bcc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForComponentCreateCommand;
@@ -61,37 +62,37 @@ public class ComponentNestedClassifierCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedClassForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3037 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3053 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3046 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3045 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3051 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicyCN.java index 3d22e9f66f7..ee24820f6ee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentNestedClassifierCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForComponentCreateCommand;
@@ -61,37 +62,37 @@ public class ComponentNestedClassifierCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedClassForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3037 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3053 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3046 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3045 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3051 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForComponentCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java index dae64dc968a..f5be5eed351 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class ComponentOperationCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForComponentCreateCommand(req));
+ return getGEFWrapper(new OperationForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_3011 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionCreateCommand(req));
+ return getGEFWrapper(new ReceptionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicyCN.java index 298dc71b44d..40dc2e8cac7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ComponentOperationCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class ComponentOperationCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForComponentCreateCommand(req));
+ return getGEFWrapper(new OperationForComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_3011 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionCreateCommand(req));
+ return getGEFWrapper(new ReceptionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java index a7dd04756b7..0105d3b0697 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyforDataTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyforDataTypeCreateCommand(req));
+ return getGEFWrapper(new PropertyforDataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java index 0ec3e4a193c..79d42bbab33 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyforDataTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyforDataTypeCreateCommand(req));
+ return getGEFWrapper(new PropertyforDataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java index 849fea5badd..337c0a07e09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -122,7 +123,7 @@ public class DataTypeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicyCN.java index 56e86a24d46..eea8245801f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -122,7 +123,7 @@ public class DataTypeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPol if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java index 17da8caddd1..96cc79c6ce8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForDataTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForDataTypeCreateCommand(req));
+ return getGEFWrapper(new OperationForDataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java index 0aaeb4352ae..e2d80c35ba5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForDataTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForDataTypeCreateCommand(req));
+ return getGEFWrapper(new OperationForDataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java index 0922a736849..55b1f16ae24 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.EnumerationLiteralCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy exte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java index 8723e3a8dde..a6493e27752 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.EnumerationLiteralCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN ex if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java index b31cb769462..73ca818bc79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.SlotCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class InstanceSpecificationSlotCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SlotCreateCommand(req));
+ return getGEFWrapper(new SlotCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicyCN.java index 16e965be9ab..bfcaff89ed3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InstanceSpecificationSlotCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.SlotCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class InstanceSpecificationSlotCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SlotCreateCommand(req));
+ return getGEFWrapper(new SlotCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java index 39fcb62210a..f9400890339 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForInterfaceCreateCommand(req));
+ return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java index 5b2e8917db6..2a9d8415de0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForInterfaceCreateCommand(req));
+ return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java index 6e556db30e1..3b39d616d4b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class InterfaceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicyCN.java index 2465baf67e8..e71007ad892 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -125,7 +126,7 @@ public class InterfaceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java index 566b16eb201..2d212119c6a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForInterfaceCreateCommand;
@@ -61,37 +62,37 @@ public class InterfaceNestedClassifierCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedClassForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3038 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3054 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3048 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3043 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3049 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicyCN.java index e4fcbce739a..9d9c56ffef6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceNestedClassifierCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedClassForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedDataTypeForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.NestedEnumerationForInterfaceCreateCommand;
@@ -61,37 +62,37 @@ public class InterfaceNestedClassifierCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedClassForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedClassForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3038 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedInterfaceForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedInterfaceForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3054 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedEnumerationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedEnumerationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3048 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedPrimitiveTypeForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedPrimitiveTypeForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3043 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDataTypeForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedDataTypeForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3049 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedSignalForInterfaceCreateCommand(req));
+ return getGEFWrapper(new NestedSignalForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java index 5d1a34d59fa..3345e67fba3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionInInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_3039 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req));
+ return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java index 7a3d38c7643..f5f4df66838 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ReceptionInInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -57,13 +58,13 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_3039 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req));
+ return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java index c0758c76a97..64c3233720b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicy.java @@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AssociationClassCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AssociationNodeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassCreateCommand;
@@ -81,127 +82,127 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DependencyNodeCreateCommand(req));
+ return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AssociationClass_2013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationClassCreateCommand(req));
+ return getGEFWrapper(new AssociationClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Association_2015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationNodeCreateCommand(req));
+ return getGEFWrapper(new AssociationNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InstanceSpecification_2001 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceSpecificationCreateCommand(req));
+ return getGEFWrapper(new InstanceSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_2002 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommand(req));
+ return getGEFWrapper(new ComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_2003 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommand(req));
+ return getGEFWrapper(new SignalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_2004 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_2005 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandTN(req));
+ return getGEFWrapper(new ModelCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_2006 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommand(req));
+ return getGEFWrapper(new EnumerationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_2007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommand(req));
+ return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_2099 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommand(req));
+ return getGEFWrapper(new InformationItemCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_2008 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCreateCommand(req));
+ return getGEFWrapper(new ClassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_2009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_2010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommand(req));
+ return getGEFWrapper(new DataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_2011 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_2012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Diagram_2016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShortCutDiagramCreateCommand(req));
+ return getGEFWrapper(new ShortCutDiagramCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_2095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommand(req));
+ return getGEFWrapper(new DurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_2096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DefaultNamedElementCreateCommand(req));
+ return getGEFWrapper(new DefaultNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2098 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShapeNamedElementCreateCommand(req));
+ return getGEFWrapper(new ShapeNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyCN.java index 5ecf4a63ee5..fd9ac821f8f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -115,13 +116,13 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateSignature_3033 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new TemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyTN.java index 99766422cb2..3725117e2c8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -115,13 +116,13 @@ public class ModelItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateSignature_3033 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new TemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java index 41ee9b14552..ce9100d565e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ComponentCreateCommandCN;
@@ -68,79 +69,79 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3021 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3023 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCreateCommandCN(req));
+ return getGEFWrapper(new ClassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3029 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3040 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java index b4989bfa8e2..5dd438967d0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ComponentCreateCommandCN;
@@ -68,79 +69,79 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyTN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3021 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3023 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCreateCommandCN(req));
+ return getGEFWrapper(new ClassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3029 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3040 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java index e16033c0f5f..024f9aba8e5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -115,13 +116,13 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateSignature_3033 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new TemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicyCN.java index 89a462ed9be..feac182f9ee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackageItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -115,13 +116,13 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateSignature_3033 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new TemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java index dfd5ee529a1..e28be6287c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ComponentCreateCommandCN;
@@ -68,79 +69,79 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3021 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3023 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCreateCommandCN(req));
+ return getGEFWrapper(new ClassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3029 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3040 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java index c0f0cc927b9..c1cb7537b09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ComponentCreateCommandCN;
@@ -68,79 +69,79 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new InstanceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3021 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3023 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCreateCommandCN(req));
+ return getGEFWrapper(new ClassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3029 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3040 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicy.java index 1d1426ba25a..6ddafb98ea3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyforPrimitiveTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class PrimitiveTypeAttributeCompartmentItemSemanticEditPolicy extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyforPrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new PropertyforPrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicyCN.java index 5b835d4b02f..d1d06ec9aaf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyforPrimitiveTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class PrimitiveTypeAttributeCompartmentItemSemanticEditPolicyCN extends U if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyforPrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new PropertyforPrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicy.java index 930e8c24d76..07a584d8d7e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForPrimitiveTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class PrimitiveTypeOperationCompartmentItemSemanticEditPolicy extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForPrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new OperationForPrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicyCN.java index 457c0b73f7f..a18e4b9d990 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/PrimitiveTypeOperationCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationForPrimitiveTypeCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class PrimitiveTypeOperationCompartmentItemSemanticEditPolicyCN extends U if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForPrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new OperationForPrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java index 45532d8361b..be9b71a07f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassifierTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ConnectableElementTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationTemplateParameterCreateCommand;
@@ -59,25 +60,25 @@ public class RedefinableTemplateSignatureTemplateParameterCompartmentItemSemanti if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassifierTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new ClassifierTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectableElementTemplateParameter_3034 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConnectableElementTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new ConnectableElementTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OperationTemplateParameter_3035 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new OperationTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateParameter_3016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateParameterCreateCommand(req));
+ return getGEFWrapper(new TemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java index 27184d6502c..1aade2bb7a8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForSignalCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class SignalAttributeCompartmentItemSemanticEditPolicy extends UMLBaseIte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForSignalCreateCommand(req));
+ return getGEFWrapper(new PropertyForSignalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicyCN.java index 471cc7717d1..e8fd19cae1f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalAttributeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.PropertyForSignalCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLElementTypes;
@@ -56,7 +57,7 @@ public class SignalAttributeCompartmentItemSemanticEditPolicyCN extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForSignalCreateCommand(req));
+ return getGEFWrapper(new PropertyForSignalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java index 7455325a449..31515f44124 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -122,7 +123,7 @@ public class SignalItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicyCN.java index aa1288ed546..4da19a617ed 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/SignalItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.AbstractionCreateCommand;
@@ -122,7 +123,7 @@ public class SignalItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req));
+ return getGEFWrapper(new RedefinableTemplateSignatureCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/TemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/TemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java index 18c6d745d13..3d5e8aad77f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/TemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/policies/TemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.ClassifierTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.OperationTemplateParameterCreateCommand;
import org.eclipse.papyrus.uml.diagram.clazz.edit.commands.TemplateParameterCreateCommand;
@@ -58,19 +59,19 @@ public class TemplateSignatureTemplateParameterCompartmentItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassifierTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new ClassifierTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OperationTemplateParameter_3035 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationTemplateParameterCreateCommand(req));
+ return getGEFWrapper(new OperationTemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TemplateParameter_3016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TemplateParameterCreateCommand(req));
+ return getGEFWrapper(new TemplateParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLVisualIDRegistry.java index be77b0896ee..7ee72fe4206 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLVisualIDRegistry.java @@ -91,13 +91,7 @@ public class UMLVisualIDRegistry { * @generated
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return ModelEditPart.VISUAL_ID;
- }
- return -1;
+ return ModelEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF index 0c971a7afbb..9f3ec2a2f01 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF @@ -1,105 +1,107 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.common,
- org.eclipse.papyrus.uml.diagram.common.actions,
- org.eclipse.papyrus.uml.diagram.common.actions.handlers,
- org.eclipse.papyrus.uml.diagram.common.command.wrappers,
- org.eclipse.papyrus.uml.diagram.common.commands,
- org.eclipse.papyrus.uml.diagram.common.dialogs,
- org.eclipse.papyrus.uml.diagram.common.directedit,
- org.eclipse.papyrus.uml.diagram.common.dragtracker,
- org.eclipse.papyrus.uml.diagram.common.draw2d,
- org.eclipse.papyrus.uml.diagram.common.draw2d.anchors,
- org.eclipse.papyrus.uml.diagram.common.editparts,
- org.eclipse.papyrus.uml.diagram.common.editpolicies,
- org.eclipse.papyrus.uml.diagram.common.figure.edge,
- org.eclipse.papyrus.uml.diagram.common.figure.layout,
- org.eclipse.papyrus.uml.diagram.common.figure.node,
- org.eclipse.papyrus.uml.diagram.common.handlers,
- org.eclipse.papyrus.uml.diagram.common.helper,
- org.eclipse.papyrus.uml.diagram.common.ids,
- org.eclipse.papyrus.uml.diagram.common.layout,
- org.eclipse.papyrus.uml.diagram.common.listeners,
- org.eclipse.papyrus.uml.diagram.common.locator,
- org.eclipse.papyrus.uml.diagram.common.parser,
- org.eclipse.papyrus.uml.diagram.common.parser.assist,
- org.eclipse.papyrus.uml.diagram.common.parser.custom,
- org.eclipse.papyrus.uml.diagram.common.parser.lookup,
- org.eclipse.papyrus.uml.diagram.common.parser.packageimport,
- org.eclipse.papyrus.uml.diagram.common.parser.stereotype,
- org.eclipse.papyrus.uml.diagram.common.parser.structural,
- org.eclipse.papyrus.uml.diagram.common.part,
- org.eclipse.papyrus.uml.diagram.common.preferences,
- org.eclipse.papyrus.uml.diagram.common.providers,
- org.eclipse.papyrus.uml.diagram.common.providers.assistant,
- org.eclipse.papyrus.uml.diagram.common.resourceupdate,
- org.eclipse.papyrus.uml.diagram.common.service,
- org.eclipse.papyrus.uml.diagram.common.service.palette,
- org.eclipse.papyrus.uml.diagram.common.sheet,
- org.eclipse.papyrus.uml.diagram.common.ui.dialogs,
- org.eclipse.papyrus.uml.diagram.common.ui.helper,
- org.eclipse.papyrus.uml.diagram.common.util,
- org.eclipse.papyrus.uml.diagram.common.util.functions,
- org.eclipse.papyrus.uml.diagram.common.util.predicates
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.common, + org.eclipse.papyrus.uml.diagram.common.actions, + org.eclipse.papyrus.uml.diagram.common.actions.handlers, + org.eclipse.papyrus.uml.diagram.common.command.wrappers, + org.eclipse.papyrus.uml.diagram.common.commands, + org.eclipse.papyrus.uml.diagram.common.dialogs, + org.eclipse.papyrus.uml.diagram.common.directedit, + org.eclipse.papyrus.uml.diagram.common.dragtracker, + org.eclipse.papyrus.uml.diagram.common.draw2d, + org.eclipse.papyrus.uml.diagram.common.draw2d.anchors, + org.eclipse.papyrus.uml.diagram.common.editparts, + org.eclipse.papyrus.uml.diagram.common.editpolicies, + org.eclipse.papyrus.uml.diagram.common.figure.edge, + org.eclipse.papyrus.uml.diagram.common.figure.layout, + org.eclipse.papyrus.uml.diagram.common.figure.node, + org.eclipse.papyrus.uml.diagram.common.handlers, + org.eclipse.papyrus.uml.diagram.common.helper, + org.eclipse.papyrus.uml.diagram.common.ids, + org.eclipse.papyrus.uml.diagram.common.layout, + org.eclipse.papyrus.uml.diagram.common.listeners, + org.eclipse.papyrus.uml.diagram.common.locator, + org.eclipse.papyrus.uml.diagram.common.parser, + org.eclipse.papyrus.uml.diagram.common.parser.assist, + org.eclipse.papyrus.uml.diagram.common.parser.custom, + org.eclipse.papyrus.uml.diagram.common.parser.lookup, + org.eclipse.papyrus.uml.diagram.common.parser.packageimport, + org.eclipse.papyrus.uml.diagram.common.parser.stereotype, + org.eclipse.papyrus.uml.diagram.common.parser.structural, + org.eclipse.papyrus.uml.diagram.common.part, + org.eclipse.papyrus.uml.diagram.common.preferences, + org.eclipse.papyrus.uml.diagram.common.providers, + org.eclipse.papyrus.uml.diagram.common.providers.assistant, + org.eclipse.papyrus.uml.diagram.common.resourceupdate, + org.eclipse.papyrus.uml.diagram.common.service, + org.eclipse.papyrus.uml.diagram.common.service.palette, + org.eclipse.papyrus.uml.diagram.common.sheet, + org.eclipse.papyrus.uml.diagram.common.ui.dialogs, + org.eclipse.papyrus.uml.diagram.common.ui.helper, + org.eclipse.papyrus.uml.diagram.common.util, + org.eclipse.papyrus.uml.diagram.common.util.functions, + org.eclipse.papyrus.uml.diagram.common.util.predicates +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0",
- org.eclipse.papyrus.editor;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0",
- org.eclipse.ui,
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.actions,
- org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0",
- org.eclipse.core.expressions,
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.printing,
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.papyrus.infra.services.decoration;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
- com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.uml.profile;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.appearance;bundle-version="1.0.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
- org.eclipse.jface,
- org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.localizer;bundle-version="1.0.0",
- org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
- org.w3c.dom.svg,
- org.apache.batik.css;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
- org.eclipse.core.databinding;bundle-version="1.4.1",
+Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0", + org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0", + org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0", + org.eclipse.papyrus.editor;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0", + org.eclipse.ui, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.actions, + org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0", + org.eclipse.core.expressions, + org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0", + org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.printing, + org.eclipse.gmf.runtime.diagram.ui.providers.ide, + org.eclipse.papyrus.infra.services.decoration;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", + com.google.guava;bundle-version="11.0.0", + org.eclipse.papyrus.uml.profile;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0", + org.eclipse.papyrus.uml.appearance;bundle-version="1.0.0", + org.eclipse.uml2.uml.edit;bundle-version="4.0.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.8.0", + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", + org.eclipse.jface, + org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.localizer;bundle-version="1.0.0", + org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)", + org.w3c.dom.svg, + org.apache.batik.css;bundle-version="[1.6.0,1.7.0)", + org.apache.batik.util;bundle-version="[1.6.0,1.7.0)", + org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding;bundle-version="1.4.1", org.eclipse.gmf.tooling.runtime,
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0"
-Bundle-Vendor: %providerName
-Ant-Version: Apache Ant 1.7.0
-Bundle-Version: 1.0.0.qualifier
-Eclipse-BuddyPolicy: dependent
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton:
- =true
-
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core.pluginexplorer;bundle-version="1.0.0", + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0" +Bundle-Vendor: %providerName +Ant-Version: Apache Ant 1.7.0 +Bundle-Version: 1.0.0.qualifier +Eclipse-BuddyPolicy: dependent +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton: + =true + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java index 892c01f65c7..9acd6744dd8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java @@ -1,168 +1,143 @@ -/******************************************************************************* - * Copyright (c) 2010 AtosOrigin. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * AtosOrigin - initial API and implementation - *******************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.commands; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; -import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.BehavioredClassifier; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.UMLFactory; - -/** - * Define a command to create a new Behavioral Diagram. This command is used by - * all UI (toolbar, outline, creation wizards) to create a new Behavioral - * Diagram. This class should be extended by behavioral diagram only. - */ -public abstract class CreateBehavioredClassifierDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - - private Behavior behavior = null; - - private String name = ""; //$NON-NLS-1$ - - /** - * {@inheritDoc} - */ - @Override - protected void initializeDiagram(EObject diagram) { - if(diagram instanceof Diagram) { - Diagram diag = (Diagram)diagram; - if(behavior != null) { - diag.setElement(behavior); - createBehaviorView(diag); - } - diag.setName(getName()); - } - - } - - /** - * Create the associated behavior - * - * @return - */ - protected Behavior createBehavior() { - Behavior newBehavior = (Behavior)UMLFactory.eINSTANCE.create(getBehaviorEClass()); - - return newBehavior; - } - - /** - * Get the kind of behavior associated to the diagram - * - * @return the EClass of the behavior supposed to own the diagram. - */ - protected abstract EClass getBehaviorEClass(); - - /** - * {@inheritDoc} - */ - protected void initializeModel(EObject owner) { - - if(owner.eClass() == getBehaviorEClass()) { - behavior = (Behavior)owner; - - } else { - behavior = (Behavior)UMLFactory.eINSTANCE.create(getBehaviorEClass()); - - if(owner instanceof BehavioredClassifier) { - BehavioredClassifier behaviorClassifier = (BehavioredClassifier)owner; - behaviorClassifier.getOwnedBehaviors().add(behavior); - - } else if(owner instanceof Package) { - org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package)owner; - pack.getPackagedElements().add(behavior); - - } - behavior.setName(NamedElementUtil.getName(behavior)); - } - } - - private void createBehaviorView(Diagram diagram) { - ViewService.getInstance().createView(Node.class, new EObjectAdapter(behavior), diagram, null, ViewUtil.APPEND, true, getPreferenceHint()); - } - - /** - * {@inheritDoc} - */ - @Override - protected Diagram createDiagram(Resource diagramResource, EObject owner, String name) { - Diagram diagram = null; - if(owner instanceof org.eclipse.uml2.uml.Package) { - diagram = ViewService.createDiagram(owner, getDiagramNotationID(), getPreferenceHint()); - } else if(owner instanceof BehavioredClassifier) { - diagram = ViewService.createDiagram(((BehavioredClassifier)owner).getNearestPackage(), getDiagramNotationID(), getPreferenceHint()); - } - // create diagram - if(diagram != null) { - setName(name); - - initializeModel(owner); - initializeDiagram(diagram); - diagramResource.getContents().add(diagram); - } - return diagram; - } - - /** - * Set the name of the diagram and its containing element - * - * @param newName - */ - protected void setName(String newName) { - if(newName == null || newName.equals(name)) { - return; - } - name = newName; - } - - protected String getName() { - return name; - } - - // @Override - // protected void runAsTransaction(DiResourceSet diResourceSet, EObject - // container, String name) { - // if(name == null && container instanceof NamedElement) { - // setName(((NamedElement)container).getName()); - // if(!"".equals(getName())) { - // // initialize name with activity's name - // name = openDiagramNameDialog(getName()); - // if(name == null) { - // // operation canceled - // return; - // } - // } - // } - // super.runAsTransaction(diResourceSet, container, - // getDefaultDiagramName()); - // } - - /** - * Check if the creation of this diagram is strongly attached to its parent - * or if it can be reassigned after creation. - * - * @return true if parent can be reassigned - */ - public boolean isParentReassignable() { - // Behavioral diagrams describe their parent behavior and only this one. - // They can not be moved to another parent. - return false; - } -} +/*******************************************************************************
+ * Copyright (c) 2010 AtosOrigin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * AtosOrigin - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehavioredClassifier;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * Define a command to create a new Behavioral Diagram. This command is used by
+ * all UI (toolbar, outline, creation wizards) to create a new Behavioral
+ * Diagram. This class should be extended by behavioral diagram only.
+ */
+public abstract class CreateBehavioredClassifierDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
+
+ private Behavior behavior = null;
+
+ private String name = ""; //$NON-NLS-1$
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeDiagram(EObject diagram) {
+ if(diagram instanceof Diagram) {
+ Diagram diag = (Diagram)diagram;
+ if(behavior != null) {
+ diag.setElement(behavior);
+ createBehaviorView(diag);
+ }
+ diag.setName(getName());
+ }
+
+ }
+
+ /**
+ * Create the associated behavior
+ *
+ * @return
+ */
+ protected Behavior createBehavior() {
+ Behavior newBehavior = (Behavior)UMLFactory.eINSTANCE.create(getBehaviorEClass());
+
+ return newBehavior;
+ }
+
+ /**
+ * Get the kind of behavior associated to the diagram
+ *
+ * @return the EClass of the behavior supposed to own the diagram.
+ */
+ protected abstract EClass getBehaviorEClass();
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void initializeModel(EObject owner) {
+
+ if(owner.eClass() == getBehaviorEClass()) {
+ behavior = (Behavior)owner;
+
+ } else {
+ behavior = (Behavior)UMLFactory.eINSTANCE.create(getBehaviorEClass());
+
+ if(owner instanceof BehavioredClassifier) {
+ BehavioredClassifier behaviorClassifier = (BehavioredClassifier)owner;
+ behaviorClassifier.getOwnedBehaviors().add(behavior);
+
+ } else if(owner instanceof Package) {
+ org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package)owner;
+ pack.getPackagedElements().add(behavior);
+
+ }
+ behavior.setName(NamedElementUtil.getName(behavior));
+ }
+ }
+
+ private void createBehaviorView(Diagram diagram) {
+ ViewService.getInstance().createView(Node.class, new EObjectAdapter(behavior), diagram, null, ViewUtil.APPEND, true, getPreferenceHint());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, ViewPrototype prototype, String name) { + Diagram diagram = null;
+ if(element instanceof org.eclipse.uml2.uml.Package) { + diagram = ViewService.createDiagram(element, getDiagramNotationID(), getPreferenceHint()); + } else if(element instanceof BehavioredClassifier) { + diagram = ViewService.createDiagram(((BehavioredClassifier)element).getNearestPackage(), getDiagramNotationID(), getPreferenceHint()); + }
+ // create diagram
+ if(diagram != null) {
+ setName(name);
+ diagram.setElement(element); + DiagramUtils.setOwner(diagram, owner); + if (!prototype.isNatural())
+ DiagramUtils.setPrototype(diagram, prototype);
+ initializeModel(element); + initializeDiagram(diagram);
+ diagramResource.getContents().add(diagram);
+ }
+ return diagram;
+ }
+
+ /**
+ * Set the name of the diagram and its containing element
+ *
+ * @param newName
+ */
+ protected void setName(String newName) {
+ if(newName == null || newName.equals(name)) {
+ return;
+ }
+ name = newName;
+ }
+
+ protected String getName() {
+ return name;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/SupplementCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/SupplementCommand.java index 475d61a2eb0..bb59b7aa757 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/SupplementCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/SupplementCommand.java @@ -1,112 +1,116 @@ -/***************************************************************************** - * Copyright (c) 2008 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.commands; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; - -/** - * This class is used to supplement a gmf connection command. - * - * @author Patrick Tessier - */ -public abstract class SupplementCommand { - - private EObject container; - - private final EObject source; - - private final EObject target; - - /** - * the supplement command has the same parameter as connection create - * command of gmf command - * - * @param container - * the container of the link - * @param source - * the source of the link - * - * @param target - * the target of the link - */ - public SupplementCommand(EObject container, EObject source, EObject target) { - super(); - this.container = container; - this.source = source; - this.target = target; - } - - /** - * this is the same fucntionnality as {@link IUndoableOperation} - * - * @return true if the command ca be executed - */ - // @unused - public abstract boolean canExecute(); - - /** - * Creates the request to configure the new element. - * - * @see EditElementCommand - * @return the request - */ - // @unused - protected abstract ConfigureRequest createConfigureRequest(ConfigureRequest request); - - /** - * this is the method tat realize the execution of the command - * - * @param newElement - * the new element ro configure - * @return the new element - */ - public abstract EObject doDefaultElementCreation(TransactionalEditingDomain domain, EObject newElement); - - /** - * use to obtain the container of the link - * - * @return the container of the link - */ - public EObject getContainer() { - return container; - } - - /** - * use to obtain the source of the link - * - * @return the source of the link - */ - public EObject getSource() { - return source; - } - - /** - * use to obtain the target of the link - * - * @return the target of the link - */ - public EObject getTarget() { - return target; - } - - /** - * use to set the container of the link - */ - // @unused - public void setContainer(EObject container) { - this.container = container; - } -} +/*****************************************************************************
+ * Copyright (c) 2008 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.notation.Diagram; +
+/**
+ * This class is used to supplement a gmf connection command.
+ *
+ * @author Patrick Tessier
+ */
+public abstract class SupplementCommand {
+
+ private EObject container;
+
+ private final EObject source;
+
+ private final EObject target;
+
+ protected final Diagram diagram; + + /**
+ * the supplement command has the same parameter as connection create
+ * command of gmf command
+ *
+ * @param container
+ * the container of the link
+ * @param source
+ * the source of the link
+ *
+ * @param target
+ * the target of the link
+ */
+ public SupplementCommand(EObject container, EObject source, EObject target, Diagram diagram) { + super();
+ this.container = container;
+ this.source = source;
+ this.target = target;
+ this.diagram = diagram; + }
+
+ /**
+ * this is the same fucntionnality as {@link IUndoableOperation}
+ *
+ * @return true if the command ca be executed
+ */
+ // @unused
+ public abstract boolean canExecute();
+
+ /**
+ * Creates the request to configure the new element.
+ *
+ * @see EditElementCommand
+ * @return the request
+ */
+ // @unused
+ protected abstract ConfigureRequest createConfigureRequest(ConfigureRequest request);
+
+ /**
+ * this is the method tat realize the execution of the command
+ *
+ * @param newElement
+ * the new element ro configure
+ * @return the new element
+ */
+ public abstract EObject doDefaultElementCreation(TransactionalEditingDomain domain, EObject newElement);
+
+ /**
+ * use to obtain the container of the link
+ *
+ * @return the container of the link
+ */
+ public EObject getContainer() {
+ return container;
+ }
+
+ /**
+ * use to obtain the source of the link
+ *
+ * @return the source of the link
+ */
+ public EObject getSource() {
+ return source;
+ }
+
+ /**
+ * use to obtain the target of the link
+ *
+ * @return the target of the link
+ */
+ public EObject getTarget() {
+ return target;
+ }
+
+ /**
+ * use to set the container of the link
+ */
+ // @unused
+ public void setContainer(EObject container) {
+ this.container = container;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/PaletteUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/PaletteUtil.java index 0038328f8ca..eb1a09af05b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/PaletteUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/PaletteUtil.java @@ -1,498 +1,510 @@ -/***************************************************************************** - * Copyright (c) 2009 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.uml.diagram.common.part; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.Tool; -import org.eclipse.gef.palette.PaletteContainer; -import org.eclipse.gef.palette.PaletteEntry; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.palette.ToolEntry; -import org.eclipse.gmf.runtime.common.core.service.IProvider; -import org.eclipse.gmf.runtime.common.core.service.ProviderPriority; -import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.ContributeToPaletteOperation; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette; -import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.SpecializationType; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.core.utils.PapyrusTrace; -import org.eclipse.papyrus.uml.diagram.common.Activator; -import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool; -import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool; -import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant; -import org.eclipse.papyrus.uml.diagram.common.service.IProfileDependantPaletteProvider; -import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService; -import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor; -import org.eclipse.papyrus.uml.diagram.common.service.palette.AspectToolService; -import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction; -import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectActionProvider; -import org.eclipse.papyrus.uml.diagram.common.service.palette.IPostAction; -import org.eclipse.papyrus.uml.diagram.common.service.palette.IPreAction; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IMemento; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Profile; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Utility class for palette. - */ -public class PaletteUtil { - - /** - * Returns the parent container by its ID - * - * @param entry - * the palette container for which parent container is looked - * @param parentID - * the id of the parent container - * @return the parent - */ - public static PaletteContainer getContainerByID(PaletteContainer container, String parentID) { - // check this element is the searched parent; - if(parentID.equals(container.getId())) { - return container; - } - - // element is not the parent. Look its children - Iterator<PaletteContainer> it = getDirectChildContainers(container).iterator(); - while(it.hasNext()) { - PaletteContainer tmp = getContainerByID(it.next(), parentID); - if(tmp != null) { - return tmp; - } - } - return null; - } - - /** - * Returns the type of metaclasses created by the toolentry - * - * @param entry - * the entry for which metaclass created is searched - * @return the type of metaclasses created by the toolentry or <code>null</code>. - */ - public static EClass getToolMetaclass(ToolEntry entry) { - Tool tool = entry.createTool(); - List<IElementType> types = null; - if(tool instanceof AspectUnspecifiedTypeCreationTool) { - types = ((AspectUnspecifiedTypeCreationTool)tool).getElementTypes(); - } else if(tool instanceof AspectUnspecifiedTypeConnectionTool) { - types = ((AspectUnspecifiedTypeConnectionTool)tool).getElementTypes(); - } - if(types != null && types.size() > 0) { - IElementType type = types.get(0); - - if(type instanceof SpecializationType) { - type = ((SpecializationType)type).getSpecializedTypes()[0]; - } - return type.getEClass(); - } - return null; - } - - /** - * Returns the parent container by its ID - * - * @param entry - * the palette entry for which parent container is looked - * @param parentID - * the id of the parent container - * @return the parent - */ - public static PaletteContainer getContainerByID(PaletteEntry entry, String parentID) { - // retrieve the root - PaletteContainer root = getRoot(entry); - return getContainerByID(root, parentID); - } - - /** - * Return the child containers directly contained by the specified container - * - * @param container - * the container to look in. - * @return the list of directly contained elements - */ - @SuppressWarnings("unchecked") - public static List<PaletteContainer> getDirectChildContainers(PaletteContainer container) { - List<PaletteContainer> containers = new ArrayList<PaletteContainer>(); - Iterator<PaletteEntry> it = container.getChildren().iterator(); - while(it.hasNext()) { - PaletteEntry entry = it.next(); - if(entry instanceof PaletteContainer) { - containers.add((PaletteContainer)entry); - } - } - return containers; - } - - /** - * Retrieves the root element for the given container - * - * @param container - * the container for which the root is searched - * @return the root of the container - */ - public static PaletteContainer getRoot(PaletteContainer container) { - // if container has a parent, returns it. - if(container.getParent() != null) { - return getRoot(container.getParent()); - } - // else, root element is the container itself. - return container; - } - - /** - * Retrieves the root element for the given palette entry - * - * @param container - * the container for which the root is searched - * @return the root of the container - */ - public static PaletteContainer getRoot(PaletteEntry entry) { - return getRoot(entry.getParent()); - } - - /** - * Default constructor. Should never be used, as method are static in this - * class. - */ - // @unused - private PaletteUtil() { - - } - - /** - * return tool entries for the given {@link PaletteContainer} and its - * sub-containers - * - * @param container - * the container that contains the ToolEntries - * @return the list of tool entries or an empty list - */ - public static List<ToolEntry> getAllToolEntries(PaletteContainer container) { - final List<ToolEntry> entries = new ArrayList<ToolEntry>(); - Iterator<PaletteEntry> it = container.getChildren().iterator(); - while(it.hasNext()) { - PaletteEntry entry = it.next(); - if(entry instanceof ToolEntry) { - entries.add((ToolEntry)entry); - } - if(entry instanceof PaletteContainer) { - entries.addAll(getAllToolEntries((PaletteContainer)entry)); - } - } - return entries; - } - - /** - * Looks for the memento with the correct id from the root momento - * - * @param rootMemento - * the root memento from which the memento is searched - * @param id - * the id of the memento to search - * @return the memento with the given ID or <code>null</code> if no memento - * was found - */ - // @unused - public static IMemento getMemento(IMemento rootMemento, String id) { - IMemento memento = null; - memento = rootMemento.getChild(id); - return memento; - } - - /** - * Return all entries from a palette - * - * @param paletteRoot - * the root from which tools are retrieved - * @return the list of entries - */ - public static List<PaletteEntry> getAllEntries(PaletteContainer container) { - List<PaletteEntry> elements = new ArrayList<PaletteEntry>(); - for(Object object : container.getChildren()) { - if(object instanceof PaletteContainer) { - elements.add((PaletteContainer)object); - elements.addAll(getAllEntries((PaletteContainer)object)); - } else if(object instanceof ToolEntry) { - elements.add((ToolEntry)object); - } - } - return elements; - } - - /** - * Returns all available entries for the given editor ID - * - * @param editorID - * the editor to be contributed - * @param priority - * the priority max for the entries - * @return the set of available entries - */ - public static Set<? extends PaletteEntry> getAvailableEntries(IEditorPart part, ProviderPriority priority) { - Set<? extends PaletteEntry> entries = new HashSet<PaletteEntry>(); - - // retrieve all provider for the given editor ID - PaletteRoot root = new PaletteRoot(); - List<? extends PapyrusPaletteService.ProviderDescriptor> providers = (List<? extends ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders(); - ContributeToPaletteOperation operation = new ContributeToPaletteOperation(part, part.getEditorInput(), root, new HashMap<Object, Object>()); - - // generate for each provider, according to priority - @SuppressWarnings("unchecked") - List<PapyrusPaletteService.ProviderDescriptor> providerList = (List<PapyrusPaletteService.ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders(); - for(PapyrusPaletteService.ProviderDescriptor descriptor : providerList) { - int compare = descriptor.getPriority().compareTo(priority); - if(compare < 0) { - if(descriptor.providesWithVisibility(operation)) { - ((IPaletteProvider)descriptor.getProvider()).contributeToPalette(part, part.getEditorInput(), root, new HashMap<Object, Object>()); - } - } - } - return entries; - } - - /** - * Returns all available entries for the given editor ID - * - * @param editorID - * the editor to be contributed - * @param priority - * the priority max for the entries - * @return the set of available entries - */ - public static Map<String, PaletteEntry> getAvailableEntriesSet(IEditorPart part, ProviderPriority priority) { - Map<String, PaletteEntry> entries = new HashMap<String, PaletteEntry>(); - - // retrieve all provider for the given editor ID - PaletteRoot root = new PaletteRoot(); - List<? extends PapyrusPaletteService.ProviderDescriptor> providers = (List<? extends ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders(); - ContributeToPaletteOperation operation = new ContributeToPaletteOperation(part, part.getEditorInput(), root, entries); - - // generate for each provider, according to priority - @SuppressWarnings("unchecked") - List<PapyrusPaletteService.ProviderDescriptor> providerList = (List<PapyrusPaletteService.ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders(); - for(PapyrusPaletteService.ProviderDescriptor descriptor : providerList) { - int compare = descriptor.getPriority().compareTo(priority); - if(compare <= 0) { - if(descriptor.providesWithVisibility(operation)) { - ((IPaletteProvider)descriptor.getProvider()).contributeToPalette(part, part.getEditorInput(), root, entries); - } - } - } - return entries; - } - - /** - * Returns the list of stereotypes String from a serialize string form - * - * @param serializedForm - * the serialized form of the list of stereotypes - * @return the list of stereotypes String from a serialize string form - */ - public static List<String> getStereotypeListFromString(String serializedForm) { - StringTokenizer tokenizer = new StringTokenizer(serializedForm, ","); - List<String> list = new ArrayList<String>(); - while(tokenizer.hasMoreElements()) { - list.add(tokenizer.nextToken().trim()); - } - return list; - } - - /** - * Returns the list of stereotypes String under a serialized form - * - * @param list - * the list of stereotypes to serialize - * @return the list of stereotypes String under a serialized form - */ - public static String getSerializedStereotypeList(Collection<String> stereotypes) { - return convertToCommaSeparatedRepresentation(stereotypes); - } - - /** - * Returns the name of the profile from the given stereotype qualified Name - * - * @param stereotypeName - * the name of the stereotype to parse - * @return the qualified name of the profile from the given stereotype - * qualified Name - */ - public static String findProfileNameFromStereotypeName(String stereotypeName) { - return stereotypeName.substring(0, stereotypeName.lastIndexOf(NamedElement.SEPARATOR)); - } - - /** - * Returns the list of profile Qualified Names String under a serialized - * form - * - * @param list - * the list of profiles to serialize - * @return the list of profiles String under a serialized form - */ - public static String getSerializedProfileList(Collection<String> profiles) { - return convertToCommaSeparatedRepresentation(profiles); - } - - public static String convertToCommaSeparatedRepresentation(Collection objects) { - return convertToFlatRepresentation(objects, ","); - } +/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.part;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gmf.runtime.common.core.service.IProvider;
+import org.eclipse.gmf.runtime.common.core.service.ProviderPriority;
+import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.ContributeToPaletteOperation;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.SpecializationType;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.core.utils.PapyrusTrace;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeCreationTool;
+import org.eclipse.papyrus.uml.diagram.common.service.IPapyrusPaletteConstant;
+import org.eclipse.papyrus.uml.diagram.common.service.IProfileDependantPaletteProvider;
+import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService;
+import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.ProviderDescriptor;
+import org.eclipse.papyrus.uml.diagram.common.service.palette.AspectToolService;
+import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectAction;
+import org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectActionProvider;
+import org.eclipse.papyrus.uml.diagram.common.service.palette.IPostAction;
+import org.eclipse.papyrus.uml.diagram.common.service.palette.IPreAction;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Profile;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Utility class for palette.
+ */
+public class PaletteUtil {
+
+ /**
+ * Returns the parent container by its ID
+ *
+ * @param entry
+ * the palette container for which parent container is looked
+ * @param parentID
+ * the id of the parent container
+ * @return the parent
+ */
+ public static PaletteContainer getContainerByID(PaletteContainer container, String parentID) {
+ // check this element is the searched parent;
+ if(parentID.equals(container.getId())) {
+ return container;
+ }
+
+ // element is not the parent. Look its children
+ Iterator<PaletteContainer> it = getDirectChildContainers(container).iterator();
+ while(it.hasNext()) {
+ PaletteContainer tmp = getContainerByID(it.next(), parentID);
+ if(tmp != null) {
+ return tmp;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the type of metaclasses created by the toolentry
+ *
+ * @param entry
+ * the entry for which metaclass created is searched
+ * @return the type of metaclasses created by the toolentry or <code>null</code>.
+ */
+ public static EClass getToolMetaclass(ToolEntry entry) {
+ Tool tool = entry.createTool();
+ List<IElementType> types = null;
+ if(tool instanceof AspectUnspecifiedTypeCreationTool) {
+ types = ((AspectUnspecifiedTypeCreationTool)tool).getElementTypes();
+ } else if(tool instanceof AspectUnspecifiedTypeConnectionTool) {
+ types = ((AspectUnspecifiedTypeConnectionTool)tool).getElementTypes();
+ }
+ if(types != null && types.size() > 0) {
+ IElementType type = types.get(0);
+
+ if(type instanceof SpecializationType) {
+ type = ((SpecializationType)type).getSpecializedTypes()[0];
+ }
+ return type.getEClass();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the parent container by its ID
+ *
+ * @param entry
+ * the palette entry for which parent container is looked
+ * @param parentID
+ * the id of the parent container
+ * @return the parent
+ */
+ public static PaletteContainer getContainerByID(PaletteEntry entry, String parentID) {
+ // retrieve the root
+ PaletteContainer root = getRoot(entry);
+ return getContainerByID(root, parentID);
+ }
+
+ /**
+ * Return the child containers directly contained by the specified container
+ *
+ * @param container
+ * the container to look in.
+ * @return the list of directly contained elements
+ */
+ @SuppressWarnings("unchecked")
+ public static List<PaletteContainer> getDirectChildContainers(PaletteContainer container) {
+ List<PaletteContainer> containers = new ArrayList<PaletteContainer>();
+ Iterator<PaletteEntry> it = container.getChildren().iterator();
+ while(it.hasNext()) {
+ PaletteEntry entry = it.next();
+ if(entry instanceof PaletteContainer) {
+ containers.add((PaletteContainer)entry);
+ }
+ }
+ return containers;
+ }
+
+ /**
+ * Retrieves the root element for the given container
+ *
+ * @param container
+ * the container for which the root is searched
+ * @return the root of the container
+ */
+ public static PaletteContainer getRoot(PaletteContainer container) {
+ // if container has a parent, returns it.
+ if(container.getParent() != null) {
+ return getRoot(container.getParent());
+ }
+ // else, root element is the container itself.
+ return container;
+ }
+
+ /**
+ * Retrieves the root element for the given palette entry
+ *
+ * @param container
+ * the container for which the root is searched
+ * @return the root of the container
+ */
+ public static PaletteContainer getRoot(PaletteEntry entry) {
+ return getRoot(entry.getParent());
+ }
+
+ /**
+ * Default constructor. Should never be used, as method are static in this
+ * class.
+ */
+ // @unused
+ private PaletteUtil() {
+
+ }
+
+ /**
+ * return tool entries for the given {@link PaletteContainer} and its
+ * sub-containers
+ *
+ * @param container
+ * the container that contains the ToolEntries
+ * @return the list of tool entries or an empty list
+ */
+ public static List<ToolEntry> getAllToolEntries(PaletteContainer container) {
+ final List<ToolEntry> entries = new ArrayList<ToolEntry>();
+ Iterator<PaletteEntry> it = container.getChildren().iterator();
+ while(it.hasNext()) {
+ PaletteEntry entry = it.next();
+ if(entry instanceof ToolEntry) {
+ entries.add((ToolEntry)entry);
+ }
+ if(entry instanceof PaletteContainer) {
+ entries.addAll(getAllToolEntries((PaletteContainer)entry));
+ }
+ }
+ return entries;
+ }
+
+ /**
+ * Looks for the memento with the correct id from the root momento
+ *
+ * @param rootMemento
+ * the root memento from which the memento is searched
+ * @param id
+ * the id of the memento to search
+ * @return the memento with the given ID or <code>null</code> if no memento
+ * was found
+ */
+ // @unused
+ public static IMemento getMemento(IMemento rootMemento, String id) {
+ IMemento memento = null;
+ memento = rootMemento.getChild(id);
+ return memento;
+ }
+
+ /**
+ * Return all entries from a palette
+ *
+ * @param paletteRoot
+ * the root from which tools are retrieved
+ * @return the list of entries
+ */
+ public static List<PaletteEntry> getAllEntries(PaletteContainer container) {
+ List<PaletteEntry> elements = new ArrayList<PaletteEntry>();
+ for(Object object : container.getChildren()) {
+ if(object instanceof PaletteContainer) {
+ elements.add((PaletteContainer)object);
+ elements.addAll(getAllEntries((PaletteContainer)object));
+ } else if(object instanceof ToolEntry) {
+ elements.add((ToolEntry)object);
+ }
+ }
+ return elements;
+ }
+
+ /**
+ * Returns all available entries for the given editor ID
+ *
+ * @param editorID
+ * the editor to be contributed
+ * @param priority
+ * the priority max for the entries
+ * @return the set of available entries
+ */
+ public static Set<? extends PaletteEntry> getAvailableEntries(IEditorPart part, ProviderPriority priority) {
+ Set<? extends PaletteEntry> entries = new HashSet<PaletteEntry>();
+
+ // retrieve all provider for the given editor ID
+ PaletteRoot root = new PaletteRoot();
+ List<? extends PapyrusPaletteService.ProviderDescriptor> providers = (List<? extends ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders();
+ ContributeToPaletteOperation operation = new ContributeToPaletteOperation(part, part.getEditorInput(), root, new HashMap<Object, Object>());
+
+ // generate for each provider, according to priority
+ @SuppressWarnings("unchecked")
+ List<PapyrusPaletteService.ProviderDescriptor> providerList = (List<PapyrusPaletteService.ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders();
+ for(PapyrusPaletteService.ProviderDescriptor descriptor : providerList) {
+ int compare = descriptor.getPriority().compareTo(priority);
+ if(compare < 0) {
+ if(descriptor.providesWithVisibility(operation)) {
+ ((IPaletteProvider)descriptor.getProvider()).contributeToPalette(part, part.getEditorInput(), root, new HashMap<Object, Object>());
+ }
+ }
+ }
+ return entries;
+ }
+
+ /**
+ * Returns all available entries for the given editor ID
+ *
+ * @param editorID
+ * the editor to be contributed
+ * @param priority
+ * the priority max for the entries
+ * @return the set of available entries
+ */
+ public static Map<String, PaletteEntry> getAvailableEntriesSet(IEditorPart part, ProviderPriority priority) {
+ Map<String, PaletteEntry> entries = new HashMap<String, PaletteEntry>();
+
+ // retrieve all provider for the given editor ID
+ PaletteRoot root = new PaletteRoot();
+ List<? extends PapyrusPaletteService.ProviderDescriptor> providers = (List<? extends ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders();
+ ContributeToPaletteOperation operation = new ContributeToPaletteOperation(part, part.getEditorInput(), root, entries);
+
+ // generate for each provider, according to priority
+ @SuppressWarnings("unchecked")
+ List<PapyrusPaletteService.ProviderDescriptor> providerList = (List<PapyrusPaletteService.ProviderDescriptor>)PapyrusPaletteService.getInstance().getProviders();
+ for(PapyrusPaletteService.ProviderDescriptor descriptor : providerList) {
+ int compare = descriptor.getPriority().compareTo(priority);
+ if(compare <= 0) {
+ if(descriptor.providesWithVisibility(operation)) {
+ ((IPaletteProvider)descriptor.getProvider()).contributeToPalette(part, part.getEditorInput(), root, entries);
+ }
+ }
+ }
+ return entries;
+ }
+
+ /**
+ * Returns the list of stereotypes String from a serialize string form
+ *
+ * @param serializedForm
+ * the serialized form of the list of stereotypes
+ * @return the list of stereotypes String from a serialize string form
+ */
+ public static List<String> getStereotypeListFromString(String serializedForm) {
+ StringTokenizer tokenizer = new StringTokenizer(serializedForm, ",");
+ List<String> list = new ArrayList<String>();
+ while(tokenizer.hasMoreElements()) {
+ list.add(tokenizer.nextToken().trim());
+ }
+ return list;
+ }
+
+ /**
+ * Returns the list of stereotypes String under a serialized form
+ *
+ * @param list
+ * the list of stereotypes to serialize
+ * @return the list of stereotypes String under a serialized form
+ */
+ public static String getSerializedStereotypeList(Collection<String> stereotypes) {
+ return convertToCommaSeparatedRepresentation(stereotypes);
+ }
+
+ /**
+ * Returns the name of the profile from the given stereotype qualified Name
+ *
+ * @param stereotypeName
+ * the name of the stereotype to parse
+ * @return the qualified name of the profile from the given stereotype
+ * qualified Name
+ */
+ public static String findProfileNameFromStereotypeName(String stereotypeName) {
+ return stereotypeName.substring(0, stereotypeName.lastIndexOf(NamedElement.SEPARATOR));
+ }
+
+ /**
+ * Returns the list of profile Qualified Names String under a serialized
+ * form
+ *
+ * @param list
+ * the list of profiles to serialize
+ * @return the list of profiles String under a serialized form
+ */
+ public static String getSerializedProfileList(Collection<String> profiles) {
+ return convertToCommaSeparatedRepresentation(profiles);
+ }
+
+ public static String convertToCommaSeparatedRepresentation(Collection objects) {
+ return convertToFlatRepresentation(objects, ",");
+ }
+
+ public static String convertToFlatRepresentation(Collection objects, String separator) {
+ StringBuilder buffer = new StringBuilder();
+ Iterator it = objects.iterator();
+ while(it.hasNext()) {
+ buffer.append(it.next());
+ if(it.hasNext()) {
+ buffer.append(separator);
+ }
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Returns the list of profiles String from a serialize string form
+ *
+ * @param serializedForm
+ * the serialized form of the list of stereotypes
+ * @return the list of profiles String from a serialize string form
+ */
+ public static Set<String> getProfileSetFromString(String serializedForm) {
+ StringTokenizer tokenizer = new StringTokenizer(serializedForm, ",");
+ Set<String> list = new HashSet<String>();
+ while(tokenizer.hasMoreElements()) {
+ list.add(tokenizer.nextToken());
+ }
+ return list;
+ }
+
+ /**
+ * returns <code>true</code> if the descriptor have all necessary profiles
+ *
+ * @param part
+ * the editor part for which the palette is shown
+ * @param papyrusProviderDesc
+ * the current provider descriptor to test
+ * @return <code>true</code> if all required profile are present
+ */
+ public static boolean areRequiredProfileApplied(IEditorPart part, PapyrusPaletteService.ProviderDescriptor papyrusProviderDesc) {
+ if(!(part instanceof DiagramEditorWithFlyOutPalette)) {
+ PapyrusTrace.log(IStatus.WARNING, "trying to check a papyrus palette descriptor outside papyrus framework");
+ return false;
+ }
+ if(papyrusProviderDesc instanceof PapyrusPaletteService.LocalProviderDescriptor) {
+ IPaletteDescription description = ((PapyrusPaletteService.LocalProviderDescriptor)papyrusProviderDesc).getDescription();
+ // checks the presence of required profile
+ Diagram diagram = ((DiagramEditorWithFlyOutPalette)part).getDiagram();
+ EObject element = diagram.getElement();
+ if(element instanceof Element) {
+ org.eclipse.uml2.uml.Package package_ = ((Element)element).getNearestPackage();
+ List<Profile> appliedProfiles = package_.getAllAppliedProfiles();
+ List<String> appliedProfilesNames = new ArrayList<String>();
+ for(Profile profile : appliedProfiles) {
+ appliedProfilesNames.add(profile.getQualifiedName());
+ }
+
+ // compare to the list of profiles used by the palette
+ Map<String, String> properties = description.getProperties();
+ if(description != null) {
+ String requiredProfilesList = properties.get(IPapyrusPaletteConstant.PROFILE_LIST);
+ if(requiredProfilesList != null) {
+ // parse requiredProfile string (profile1QN, profile2QN,
+ // etc.)
+ Set<String> requiredProfiles = PaletteUtil.getProfileSetFromString(requiredProfilesList);
+ for(String requiredProfileName : requiredProfiles) {
+ if(!appliedProfilesNames.contains(requiredProfileName)) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ IProvider provider = papyrusProviderDesc.getProvider();
+ if(provider instanceof IProfileDependantPaletteProvider) {
+ Diagram diagram = ((DiagramEditorWithFlyOutPalette)part).getDiagram();
+ return areRequiredProfileApplied(diagram, (IProfileDependantPaletteProvider)provider); + }
+ }
+ // by default, returns true if the descriptor is not a local descriptor,
+ // as they do not use
+ // profile
+ return true;
+ }
- public static String convertToFlatRepresentation(Collection objects, String separator) { - StringBuilder buffer = new StringBuilder(); - Iterator it = objects.iterator(); - while(it.hasNext()) { - buffer.append(it.next()); - if(it.hasNext()) { - buffer.append(separator); - } - } - return buffer.toString(); - } - - /** - * Returns the list of profiles String from a serialize string form - * - * @param serializedForm - * the serialized form of the list of stereotypes - * @return the list of profiles String from a serialize string form - */ - public static Set<String> getProfileSetFromString(String serializedForm) { - StringTokenizer tokenizer = new StringTokenizer(serializedForm, ","); - Set<String> list = new HashSet<String>(); - while(tokenizer.hasMoreElements()) { - list.add(tokenizer.nextToken()); - } - return list; - } - /** * returns <code>true</code> if the descriptor have all necessary profiles - * - * @param part - * the editor part for which the palette is shown - * @param papyrusProviderDesc - * the current provider descriptor to test + * @param diagram The diagram being provided palette elements + * @param provider The profile-dependent palette provider * @return <code>true</code> if all required profile are present */ - public static boolean areRequiredProfileApplied(IEditorPart part, PapyrusPaletteService.ProviderDescriptor papyrusProviderDesc) { - if(!(part instanceof DiagramEditorWithFlyOutPalette)) { - PapyrusTrace.log(IStatus.WARNING, "trying to check a papyrus palette descriptor outside papyrus framework"); - return false; - } - if(papyrusProviderDesc instanceof PapyrusPaletteService.LocalProviderDescriptor) { - IPaletteDescription description = ((PapyrusPaletteService.LocalProviderDescriptor)papyrusProviderDesc).getDescription(); - // checks the presence of required profile - Diagram diagram = ((DiagramEditorWithFlyOutPalette)part).getDiagram(); - EObject element = diagram.getElement(); - if(element instanceof Element) { - org.eclipse.uml2.uml.Package package_ = ((Element)element).getNearestPackage(); - List<Profile> appliedProfiles = package_.getAllAppliedProfiles(); - List<String> appliedProfilesNames = new ArrayList<String>(); - for(Profile profile : appliedProfiles) { - appliedProfilesNames.add(profile.getQualifiedName()); - } - - // compare to the list of profiles used by the palette - Map<String, String> properties = description.getProperties(); - if(description != null) { - String requiredProfilesList = properties.get(IPapyrusPaletteConstant.PROFILE_LIST); - if(requiredProfilesList != null) { - // parse requiredProfile string (profile1QN, profile2QN, - // etc.) - Set<String> requiredProfiles = PaletteUtil.getProfileSetFromString(requiredProfilesList); - for(String requiredProfileName : requiredProfiles) { - if(!appliedProfilesNames.contains(requiredProfileName)) { - return false; - } - } - } - } + public static boolean areRequiredProfileApplied(Diagram diagram, IProfileDependantPaletteProvider provider) { + EObject element = diagram.getElement(); + if(element instanceof Element) { + org.eclipse.uml2.uml.Package package_ = ((Element)element).getNearestPackage();
+ if (package_ == null)
+ return false; + List<Profile> appliedProfiles = package_.getAllAppliedProfiles(); + List<String> appliedProfilesNames = new ArrayList<String>(); + for(Profile profile : appliedProfiles) { + appliedProfilesNames.add(profile.getQualifiedName()); } - } else { - IProvider provider = papyrusProviderDesc.getProvider(); - if(provider instanceof IProfileDependantPaletteProvider) { - Diagram diagram = ((DiagramEditorWithFlyOutPalette)part).getDiagram(); - EObject element = diagram.getElement(); - if(element instanceof Element) { - org.eclipse.uml2.uml.Package package_ = ((Element)element).getNearestPackage(); - List<Profile> appliedProfiles = package_.getAllAppliedProfiles(); - List<String> appliedProfilesNames = new ArrayList<String>(); - for(Profile profile : appliedProfiles) { - appliedProfilesNames.add(profile.getQualifiedName()); - } - // not null also - Collection<String> requiredProfiles = ((IProfileDependantPaletteProvider)provider).getRequiredProfiles(); - for(String requiredProfileName : requiredProfiles) { - if(!appliedProfilesNames.contains(requiredProfileName)) { - return false; - } - } + // not null also + Collection<String> requiredProfiles = ((IProfileDependantPaletteProvider)provider).getRequiredProfiles(); + for(String requiredProfileName : requiredProfiles) { + if(!appliedProfilesNames.contains(requiredProfileName)) { + return false; } - return true; } } - // by default, returns true if the descriptor is not a local descriptor, - // as they do not use - // profile return true; } - - public static void initAspectActions(NodeList aspectActionNodes, List<IPostAction> postActions, List<IPreAction> preActions) { - for(int i = 0; i < aspectActionNodes.getLength(); i++) { - Node childNode = aspectActionNodes.item(i); - String childName = childNode.getNodeName(); - if(IPapyrusPaletteConstant.POST_ACTION.equals(childName)) { - // node is a post action => retrieve the id of the factory in charge of this configuration - IAspectActionProvider provider = AspectToolService.getInstance().getProvider(AspectToolService.getProviderId(childNode)); - if(provider != null) { - IAspectAction action = provider.createAction(childNode); - if (action instanceof IPostAction) { - postActions.add((IPostAction)action); - } - } else { - Activator.log.error("impossible to find factory with id: " + AspectToolService.getProviderId(childNode), null); - } - } else if(IPapyrusPaletteConstant.PRE_ACTION.equals(childName)) { - // node is a pre action => retrieve the id of the factory in charge of this configuration - IAspectActionProvider provider = AspectToolService.getInstance().getProvider(AspectToolService.getProviderId(childNode)); - if(provider != null) { - IAspectAction action = provider.createAction(childNode); - if (action instanceof IPreAction) { - preActions.add((IPreAction)action); - } - } else { - Activator.log.error("impossible to find factory with id: " + AspectToolService.getProviderId(childNode), null); - } - } - } - } - -} +
+ public static void initAspectActions(NodeList aspectActionNodes, List<IPostAction> postActions, List<IPreAction> preActions) {
+ for(int i = 0; i < aspectActionNodes.getLength(); i++) {
+ Node childNode = aspectActionNodes.item(i);
+ String childName = childNode.getNodeName();
+ if(IPapyrusPaletteConstant.POST_ACTION.equals(childName)) {
+ // node is a post action => retrieve the id of the factory in charge of this configuration
+ IAspectActionProvider provider = AspectToolService.getInstance().getProvider(AspectToolService.getProviderId(childNode));
+ if(provider != null) {
+ IAspectAction action = provider.createAction(childNode);
+ if (action instanceof IPostAction) {
+ postActions.add((IPostAction)action);
+ }
+ } else {
+ Activator.log.error("impossible to find factory with id: " + AspectToolService.getProviderId(childNode), null);
+ }
+ } else if(IPapyrusPaletteConstant.PRE_ACTION.equals(childName)) {
+ // node is a pre action => retrieve the id of the factory in charge of this configuration
+ IAspectActionProvider provider = AspectToolService.getInstance().getProvider(AspectToolService.getProviderId(childNode));
+ if(provider != null) {
+ IAspectAction action = provider.createAction(childNode);
+ if (action instanceof IPreAction) {
+ preActions.add((IPreAction)action);
+ }
+ } else {
+ Activator.log.error("impossible to find factory with id: " + AspectToolService.getProviderId(childNode), null);
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java new file mode 100755 index 00000000000..a99beb955cb --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java @@ -0,0 +1,306 @@ +/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram;
+import org.eclipse.papyrus.infra.viewpoints.policy.Activator;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.ui.IEditorPart;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Represents a palette provider which filters it content based on the use cases
+ * @author Laurent Wouters
+ */
+public class FilteringPaletteProvider implements IPaletteProvider {
+
+ /**
+ * Provider of a policy-enforced custom palette
+ *
+ * @author Laurent Wouters
+ */
+ private static class CustomPaletteProvider extends LocalPaletteProvider {
+ /**
+ * Sets the palette at the given uri as the contribution
+ *
+ * @param uri
+ * URI of a custom palette
+ */
+ public void setContributions(String uri) {
+ readXMLDocument(uri);
+ }
+
+ public NodeList getContributions() {
+ return contributions;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.service.LocalPaletteProvider#getXmlFile(java.lang.String)
+ */
+ @Override
+ public InputStream getXmlFile(String path) throws IOException {
+ return URIConverter.INSTANCE.createInputStream(URI.createURI(path));
+ }
+ }
+
+ /**
+ * Retrieve all elements of a palette contribution
+ *
+ */
+ private static class WalkerPaletteContribution implements IPapyrusPaletteConstant {
+
+ /**
+ * Retrieve all elements ID of the palette contributions
+ *
+ * @param contributions
+ * the palette contributions
+ * @return the list of palette nodes ID
+ */
+ public static List<String> getAllPaletteNodesID(NodeList contributions) {
+ List<String> paletteNodesID = new ArrayList<String>();
+ for(int i = 0; i < contributions.getLength(); i++) {
+ Node node = contributions.item(i);
+ if(PALETTE_DEFINITION.equals(node.getNodeName())) {
+ paletteNodesID.addAll(walkDefinition(node));
+ }
+ }
+ return paletteNodesID;
+ }
+
+ /**
+ * Parse the given node, assuming its type is a palette definition
+ *
+ * @param paletteDefinitionNode
+ * the node to parse
+ * @return the list of palette nodes ID
+ */
+ private static List<String> walkDefinition(Node paletteDefinitionNode) {
+ List<String> paletteNodesID = new ArrayList<String>();
+ NodeList nodes = paletteDefinitionNode.getChildNodes();
+ for(int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ if(CONTENT.equals(node.getNodeName())) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ }
+ return paletteNodesID;
+ }
+
+ /**
+ * Parse the contents of a palette definition
+ *
+ * @param paletteContentNode
+ * the node to parse
+ * @return the list of palette nodes ID
+ */
+ private static List<String> walkContentNode(Node paletteContentNode) {
+ List<String> paletteNodesID = new ArrayList<String>();
+ NodeList nodes = paletteContentNode.getChildNodes();
+ for(int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ String name = node.getNodeName();
+ String nodeID = null;
+ if(DRAWER.equals(name)) {
+ nodeID = node.getAttributes().getNamedItem(ID).getNodeValue();
+ paletteNodesID.add(nodeID);
+ if(node.getChildNodes().getLength() > 0) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ } else if(STACK.equals(name)) {
+ nodeID = node.getAttributes().getNamedItem(ID).getNodeValue();
+ paletteNodesID.add(nodeID);
+ if(node.getChildNodes().getLength() > 0) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ } else if(SEPARATOR.equals(name)) {
+ nodeID = node.getAttributes().getNamedItem(ID).getNodeValue();
+ paletteNodesID.add(nodeID);
+ if(node.getChildNodes().getLength() > 0) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ } else if(TOOL.equals(name)) {
+ nodeID = node.getAttributes().getNamedItem(ID).getNodeValue();
+ paletteNodesID.add(nodeID);
+ if(node.getChildNodes().getLength() > 0) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ } else if(ASPECT_TOOL.equals(name)) {
+ nodeID = node.getAttributes().getNamedItem(ID).getNodeValue();
+ paletteNodesID.add(nodeID);
+ if(node.getChildNodes().getLength() > 0) {
+ paletteNodesID.addAll(walkContentNode(node));
+ }
+ }
+ }
+ return paletteNodesID;
+ }
+ }
+
+ /**
+ * The original palette provider to delegate to
+ */
+ private DefaultPaletteProvider proxied;
+ /**
+ * The root configuration element for this palette provider
+ */
+ private IConfigurationElement config;
+ /**
+ * The view to which the palette will be provided
+ */
+ private Diagram diagram;
+ /**
+ * The exception to the filtering scheme.
+ * Palette entry IDs in this array are always allowed, regardless of the current configuration.
+ */
+ private String[] exceptions;
+
+ private NodeList contributions;
+
+ /**
+ * Initializes the provider
+ * @param proxied The original provider
+ * @param exceptions Entry IDs that should never be filtered
+ */
+ public FilteringPaletteProvider(DefaultPaletteProvider proxied, String[] exceptions) {
+ this.proxied = proxied;
+ this.exceptions = exceptions.clone();
+ }
+
+ /**
+ * Determines whether a palette element with the given entry ID should be exposed to the user
+ * @param entryID A palette element entry ID
+ * @return <code>true</code> if the element should be exposed
+ */
+ public boolean shouldExpose(String entryID) {
+ for (int i=0; i!=exceptions.length; i++)
+ if (entryID.startsWith(exceptions[i]))
+ return true;
+ return PolicyChecker.getCurrent().isInPalette(diagram, entryID);
+ }
+
+ /**
+ * Clear the contributions of the proxied palette provider.
+ * This is necessary because the actual contributions depends on the diagram's properties.
+ */
+ private void clearContributions() {
+ // this is going to be dirty ...
+ try {
+ Field field = proxied.getClass().getDeclaredField("contributions");
+ field.setAccessible(true);
+ List<?> list = (List<?>)field.get(proxied);
+ list.clear();
+ }
+ catch (Exception e) {
+ Activator.getDefault().getPapyrusLog().error("Failed to setup the filtering palette's configuration", e);
+ }
+ }
+
+ /**
+ * Retrieves the URI of the policy-enforced custom palette, if any
+ *
+ * @return The policy-enforced custom palette's URI
+ */
+ private String getCustomPalette() {
+ ViewPrototype proto = ViewPrototype.get(diagram);
+ PapyrusDiagram pd = (PapyrusDiagram) proto.getConfiguration();
+ if (pd == null)
+ return null;
+ return pd.getCustomPalette();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider#contributeToPalette(org.eclipse.ui.IEditorPart, java.lang.Object, org.eclipse.gef.palette.PaletteRoot, java.util.Map)
+ */
+ public void contributeToPalette(IEditorPart editor, Object content, PaletteRoot root, Map predefinedEntries) {
+ // the view needs to be known now because the actual filtering is called within setContributions
+ diagram = ((DiagramEditor)editor).getDiagram();
+
+ // Setting up the actual contribution
+ clearContributions();
+ proxied.setContributions(config);
+ // delegate the call to the proxied provider which is now ready
+ proxied.contributeToPalette(editor, content, root, predefinedEntries);
+
+ // retrieves the custom palette
+ String paletteURI = getCustomPalette();
+ if (paletteURI != null && !paletteURI.isEmpty()) {
+ CustomPaletteProvider provider = new CustomPaletteProvider();
+ provider.setContributions(paletteURI);
+ contributions = provider.getContributions();
+ List<String> nodesID = WalkerPaletteContribution.getAllPaletteNodesID(contributions);
+
+ // verify if the elements (nodes) from the custom palette already contributed
+ if (!isCustomPaletteContributed(predefinedEntries, nodesID)) {
+ provider.contributeToPalette(editor, content, root, predefinedEntries);
+ }
+ }
+ }
+
+ /**
+ * Verify if the elements (nodes) from the custom palette already contributed
+ *
+ * @param predefinedEntries
+ * the Predefined Entries already added
+ * @param nodesID
+ * the list of elements (nodes) ID from the custom palette
+ * @return true or false
+ */
+ public boolean isCustomPaletteContributed(Map predefinedEntries, List<String> nodesID) {
+ for (String nodeID : nodesID ) {
+ if (!predefinedEntries.containsKey(nodeID)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider#setContributions(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ public void setContributions(IConfigurationElement configElement) { config = configElement; }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(org.eclipse.gmf.runtime.common.core.service.IOperation)
+ */
+ public boolean provides(IOperation operation) { return proxied.provides(operation); }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#addProviderChangeListener(org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener)
+ */
+ public void addProviderChangeListener(IProviderChangeListener listener) { proxied.addProviderChangeListener(listener); }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gmf.runtime.common.core.service.IProvider#removeProviderChangeListener(org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener)
+ */
+ public void removeProviderChangeListener(IProviderChangeListener listener) { proxied.removeProviderChangeListener(listener); }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalPaletteProvider.java index 5126b349a45..a7389275633 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalPaletteProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalPaletteProvider.java @@ -26,6 +26,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.gef.palette.PaletteRoot; import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; import org.eclipse.gmf.runtime.common.core.service.IOperation; +import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.part.IPaletteDescription; @@ -45,9 +46,6 @@ public class LocalPaletteProvider extends AbstractProvider implements IPalettePr */ protected NodeList contributions = null; - /** parser used for the xml file */ - protected XMLDefinitionPaletteParser parser; - /** * {@inheritDoc} */ @@ -56,12 +54,12 @@ public class LocalPaletteProvider extends AbstractProvider implements IPalettePr if(contributions ==null) { return; } - parser = new XMLDefinitionPaletteParser(new XMLDefinitionPaletteFactory(root, predefinedEntries)); + XMLPaletteDefinitionWalker walker = new XMLPaletteDefinitionWalker(new XMLPaletteApplicator(((DiagramEditor) editor).getDiagram(), root, predefinedEntries)); for(int i = 0; i < contributions.getLength(); i++) { Node node = contributions.item(i); if(PALETTE_DEFINITION.equals(node.getNodeName())) { - parser.parsePaletteDefinition(node); + walker.walk(node); } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java index ff6b681f8ba..0a68ed39006 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java @@ -38,10 +38,12 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChang import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.palette.PaletteContainer; +import org.eclipse.gef.palette.PaletteDrawer; import org.eclipse.gef.palette.PaletteEntry; import org.eclipse.gef.palette.PaletteRoot; import org.eclipse.gef.palette.PaletteSeparator; @@ -58,10 +60,16 @@ import org.eclipse.gmf.runtime.common.ui.services.util.ActivityFilterProviderDes import org.eclipse.gmf.runtime.common.ui.util.ActivityUtil; import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin; import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.ContributeToPaletteOperation; +import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette; +import org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider; import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider; import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteService; import org.eclipse.gmf.runtime.diagram.ui.services.palette.SelectionToolEx; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.Messages; import org.eclipse.papyrus.uml.diagram.common.part.IPaletteDescription; @@ -70,6 +78,7 @@ import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences; import org.eclipse.papyrus.uml.diagram.common.service.XMLPaletteProviderConfiguration.EditorDescriptor; import org.eclipse.ui.IEditorPart; import org.osgi.framework.Bundle; +import org.w3c.dom.NodeList; /** * Service that contributes to the palette of a given editor with a given @@ -279,14 +288,16 @@ public class PapyrusPaletteService extends PaletteService implements IPalettePro @Override public IProvider getProvider() { if(provider == null) { - IProvider newProvider = super.getProvider(); - if(provider instanceof IPaletteProvider) { - IPaletteProvider defaultProvider = (IPaletteProvider)newProvider; - defaultProvider.setContributions(getElement()); + super.getProvider(); + if (provider instanceof DefaultPaletteProvider) { + IPaletteProvider filtering = new FilteringPaletteProvider((DefaultPaletteProvider) provider, new String[] { GROUP_STANDARD, SEPARATOR_STANDARD, TOOL_SELECTION }); + filtering.setContributions(getElement()); + provider = filtering; + } else if (provider instanceof IPaletteProvider) { + ((IPaletteProvider)provider).setContributions(getElement()); } - return newProvider; } - return super.getProvider(); + return provider; } } @@ -867,9 +878,27 @@ public class PapyrusPaletteService extends PaletteService implements IPalettePro } catch (Exception e) { Activator.getDefault().logError("Error in PapyrusPaletteService::createPalette()", e); //$NON-NLS-1$ } + + Diagram diagram = ((DiagramEditor)editor).getDiagram(); + for (Object o : root.getChildren()) { + if (o instanceof PaletteDrawer) { + PaletteDrawer drawer = (PaletteDrawer)o; + boolean isVisible = PolicyChecker.getCurrent().isInPalette(diagram, drawer.getId()); + drawer.setVisible(isVisible); + if (isVisible) { + for (Object x : drawer.getChildren()) { + if (x instanceof PaletteEntry) { + PaletteEntry entry = (PaletteEntry)x; + entry.setVisible(PolicyChecker.getCurrent().isInPalette(diagram, entry.getId())); + } + } + } + } + } return root; } - + + /** * {@inheritDoc} */ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PluginPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PluginPaletteProvider.java index 8f11d0c7dbf..651e5980ee3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PluginPaletteProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PluginPaletteProvider.java @@ -13,19 +13,16 @@ package org.eclipse.papyrus.uml.diagram.common.service; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.util.Collection; import java.util.Collections; import java.util.HashSet; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.Platform; +import org.eclipse.papyrus.infra.core.pluginexplorer.Plugin; +import org.eclipse.papyrus.infra.core.pluginexplorer.PluginEntry; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.osgi.framework.Bundle; import org.w3c.dom.Node; @@ -60,28 +57,9 @@ public class PluginPaletteProvider extends LocalPaletteProvider implements IProf // try to read it in a plugin... Bundle bundle = Platform.getBundle(getProviderID()); if(bundle != null && bundle.getEntry(path)!=null) { - URL urlFile = bundle.getEntry(path); - urlFile = FileLocator.resolve(urlFile); - urlFile = FileLocator.toFileURL(urlFile); - if("file".equals(urlFile.getProtocol())) { //$NON-NLS-1$ - return new FileInputStream(urlFile.getFile()); - } else if("jar".equals(urlFile.getProtocol())) { //$NON-NLS-1$ - String filePath = urlFile.getPath(); - if(filePath.startsWith("file:")) { - // strip off the file: and the !/ - int jarPathEndIndex = filePath.indexOf("!/"); - if(jarPathEndIndex < 0) { - Activator.log.error("Impossible to find the jar path end", null); - return null; - } - String jarPath = filePath.substring("file:".length(), jarPathEndIndex); - ZipFile zipFile = new ZipFile(jarPath); - filePath = filePath.substring(jarPathEndIndex + 2, filePath.length()); - ZipEntry entry = zipFile.getEntry(filePath); - return zipFile.getInputStream(entry); - // return new File(filePath); - } - } + Plugin plugin = new Plugin(bundle); + PluginEntry entry = plugin.getEntry(path); + return entry.getInputStream(); } return null; } @@ -112,11 +90,13 @@ public class PluginPaletteProvider extends LocalPaletteProvider implements IProf // parse the content of the file to discover the required // profiles // using safe computation - XMLDefinitionPaletteParser profileParser = new XMLDefinitionPaletteParser(new XMLRequiredProfileFactory(requiredProfiles)); + XMLPaletteDefinitionProfileInspector inspector = new XMLPaletteDefinitionProfileInspector(); + XMLPaletteDefinitionWalker walker = new XMLPaletteDefinitionWalker(inspector); for(int i = 0; i < contributions.getLength(); i++) { Node node = contributions.item(i); if(PALETTE_DEFINITION.equals(node.getNodeName())) { - profileParser.parsePaletteDefinition(node); + walker.walk(node); + requiredProfiles.addAll(inspector.getRequiredProfiles()); } } } catch (Throwable e) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLDefinitionPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java index 01aa3267423..ed9b858fac0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLDefinitionPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java @@ -8,6 +8,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Refactoring * *****************************************************************************/ @@ -26,7 +27,9 @@ import org.eclipse.gef.palette.PaletteEntry; import org.eclipse.gef.palette.PaletteRoot; import org.eclipse.gef.palette.PaletteSeparator; import org.eclipse.gef.palette.PaletteStack; +import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.w3c.dom.Node; @@ -34,40 +37,47 @@ import org.w3c.dom.Node; * Standard implementation of the palette factory. This one should be use to * provide palette content */ -public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFactory implements IPapyrusPaletteConstant { - - /** palette root for the palette to be built */ - protected PaletteRoot root; - - /** map of predefined entries */ - protected Map<String, PaletteEntry> predefinedEntries; +public class XMLPaletteApplicator implements XMLPaletteDefinitionVisitor, IPapyrusPaletteConstant { /** + * The diagram owning which palette is to be filled + */ + private Diagram diagram; + + /** + * Target palette to be filled + */ + private PaletteRoot target; + + /** + * Map of predefined entries + */ + private Map<String, PaletteEntry> predefinedEntries; + + /** * Creates a new XMLDefinitionPaletteFactory * - * @param root - * the palette root to fill - * @param predefinedEntries - * existing predefined entries + * @param diagram The diagram to provide for + * @param target The root of the palette to provide for + * @param predefinedEntries existing predefined entries */ - public XMLDefinitionPaletteFactory(PaletteRoot root, Map<String, PaletteEntry> predefinedEntries) { - this.root = root; + public XMLPaletteApplicator(Diagram diagram, PaletteRoot target, Map<String, PaletteEntry> predefinedEntries) { + this.diagram = diagram; + this.target = target; this.predefinedEntries = predefinedEntries; } /** * {@inheritDoc} */ - @Override - public void traverseContentNode(Node node) { + public void onContent(Node node) { // nothing to do here } /** * {@inheritDoc} */ - @Override - public void traverseDrawerNode(Node node) { + public void onDrawer(Node node) { String id = node.getAttributes().getNamedItem(ID).getNodeValue(); PaletteEntry entry = predefinedEntries.get(id); if(entry == null) { @@ -82,7 +92,7 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac } predefinedEntries.put(id, entry); } - appendPaletteEntry(root, predefinedEntries, computePath(node), entry); + appendPaletteEntry(computePath(node), entry); } /** @@ -105,23 +115,21 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac /** * {@inheritDoc} */ - @Override - public void traverseSeparatorNode(Node node) { + public void onSeparator(Node node) { String id = node.getAttributes().getNamedItem(ID).getNodeValue(); PaletteEntry entry = predefinedEntries.get(id); if(entry == null) { entry = new PaletteSeparator(id); predefinedEntries.put(id, entry); } - appendPaletteEntry(root, predefinedEntries, computePath(node), entry); + appendPaletteEntry(computePath(node), entry); } /** * {@inheritDoc} */ - @Override - public void traverseStackNode(Node node) { + public void onStack(Node node) { String id = node.getAttributes().getNamedItem(ID).getNodeValue(); PaletteEntry entry = predefinedEntries.get(id); if(entry == null) { @@ -130,24 +138,23 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac entry.setId(id); predefinedEntries.put(id, entry); } - appendPaletteEntry(root, predefinedEntries, computePath(node), entry); + appendPaletteEntry(computePath(node), entry); } /** * {@inheritDoc} */ - @Override - public void traverseToolEntryNode(Node node) { + public void onToolEntry(Node node) { String id = node.getAttributes().getNamedItem(ID).getNodeValue(); PaletteEntry entry = predefinedEntries.get(id); - appendPaletteEntry(root, predefinedEntries, computePath(node), entry); + if (PolicyChecker.getCurrent().isInPalette(diagram, id)) + appendPaletteEntry(computePath(node), entry); } /** * {@inheritDoc} */ - @Override - public void traverseAspectToolEntryNode(Node node) { + public void onAspectToolEntry(Node node) { final String id = node.getAttributes().getNamedItem(ID).getNodeValue(); final String refToolID = node.getAttributes().getNamedItem(REF_TOOL_ID).getNodeValue(); @@ -189,24 +196,21 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac CombinedTemplateCreationEntry realEntry = new AspectCreationEntry(name, desc, id, iconDesc, entry, properties); predefinedEntries.put(id, realEntry); - appendPaletteEntry(root, predefinedEntries, computePath(node), realEntry); + if (PolicyChecker.getCurrent().isInPalette(diagram, id)) + appendPaletteEntry(computePath(node), realEntry); } /** * Appends the given palette entry to the appropriate location in either a * predefined palette entry or the palette root. * - * @param root - * @param predefinedEntries - * map of predefined palette entries where the key is the palette - * entry id and the value is the palette entry * @param path * @param paletteEntry */ - private static void appendPaletteEntry(PaletteRoot root, Map predefinedEntries, String path, PaletteEntry paletteEntry) { - PaletteEntry fEntry = findPaletteEntry(root, path); + private void appendPaletteEntry(String path, PaletteEntry paletteEntry) { + PaletteEntry fEntry = findPaletteEntry(path); if(fEntry == null) { - fEntry = findPredefinedEntry(predefinedEntries, path); + fEntry = findPredefinedEntry(path); } if(fEntry == null) { Activator.log.error("Invalid palette entry path: " + path, null); @@ -222,33 +226,32 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac } /** - * Finds a palette container starting from the given root and using the - * given path + * Finds a palette container using the given path * - * @param root - * @param aPath + * @param path * @return the container or <code>null</code> if not found */ - private static PaletteEntry findPaletteEntry(PaletteEntry root, String aPath) { - StringTokenizer tokens = new StringTokenizer(aPath, "/"); //$NON-NLS-1$ + private PaletteEntry findPaletteEntry(String path) { + PaletteEntry current = target; + StringTokenizer tokens = new StringTokenizer(path, "/"); //$NON-NLS-1$ while(tokens.hasMoreElements()) { - if(root instanceof PaletteContainer) - root = findChildPaletteEntry((PaletteContainer)root, tokens.nextToken()); + if(current instanceof PaletteContainer) + current = findChildPaletteEntry((PaletteContainer)current, tokens.nextToken()); else return null; } - return root; + return current; } /** * Finds a palette entry starting from the given container and using the * given path * - * @param root - * @param path + * @param container + * @param childId * @return the entry or <code>null</code> if not found */ - private static PaletteEntry findChildPaletteEntry(PaletteContainer container, String childId) { + private PaletteEntry findChildPaletteEntry(PaletteContainer container, String childId) { Iterator entries = container.getChildren().iterator(); while(entries.hasNext()) { PaletteEntry entry = (PaletteEntry)entries.next(); @@ -262,14 +265,11 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac * Searches the predefined entries for a palette entry given the full path * as it was predefined. * - * @param predefinedEntries - * map of predefined palette entries where the key is the palette - * entry id and the value is the palette entry * @param path * the path to the palette entry starting as it was predefined * @return the palette entry if one exists; null otherwise. */ - private static PaletteEntry findPredefinedEntry(Map predefinedEntries, String path) { + private PaletteEntry findPredefinedEntry(String path) { StringTokenizer tokens = new StringTokenizer(path, "/"); //$NON-NLS-1$ PaletteEntry root = (PaletteEntry)predefinedEntries.get(tokens.nextToken()); @@ -289,7 +289,7 @@ public class XMLDefinitionPaletteFactory extends AbstractXMLDefinitionPaletteFac * @param separator * @param entry */ - private static void appendTo(PaletteSeparator separator, PaletteEntry entry) { + private void appendTo(PaletteSeparator separator, PaletteEntry entry) { List children = separator.getParent().getChildren(); int index = children.indexOf(separator); for(index++; index < children.size(); index++) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLRequiredProfileFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionProfileInspector.java index 4e0940c594f..7877b17dc50 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLRequiredProfileFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionProfileInspector.java @@ -8,10 +8,13 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Refactoring + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.service; import java.util.Collection; +import java.util.HashSet; import java.util.List; import org.eclipse.papyrus.uml.diagram.common.Activator; @@ -24,67 +27,66 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * Factory that collects all required profiles for the given palette + * Visitor of an XML palette definition that keeps track of the required profiles */ -public class XMLRequiredProfileFactory extends AbstractXMLDefinitionPaletteFactory implements IPapyrusPaletteConstant { +public class XMLPaletteDefinitionProfileInspector implements XMLPaletteDefinitionVisitor, IPapyrusPaletteConstant { - final protected Collection<String> requiredProfiles; + final private Collection<String> requiredProfiles; /** - * Creates a new XMLRequiredProfileFactory. - * - * @param requiredProfiles - * list of required profiles to complete + * Gets the profiles required for the palette + * @return A collection of the required profiles */ - public XMLRequiredProfileFactory(Collection<String> requiredProfiles) { - this.requiredProfiles = requiredProfiles; + public Collection<String> getRequiredProfiles() { + return requiredProfiles; + } + + /** + * Initializes the inspector + */ + public XMLPaletteDefinitionProfileInspector() { + this.requiredProfiles = new HashSet<String>(); } /** * {@inheritDoc} */ - @Override - public void traverseContentNode(Node node) { + public void onContent(Node node) { // nothing specific here } /** * {@inheritDoc} */ - @Override - public void traverseDrawerNode(Node node) { + public void onDrawer(Node node) { // nothing specific here } /** * {@inheritDoc} */ - @Override - public void traverseToolEntryNode(Node node) { + public void onToolEntry(Node node) { // nothing specific here } /** * {@inheritDoc} */ - @Override - public void traverseStackNode(Node node) { + public void onStack(Node node) { // nothing specific here } /** * {@inheritDoc} */ - @Override - public void traverseSeparatorNode(Node node) { + public void onSeparator(Node node) { // nothing specific here } /** * {@inheritDoc} */ - @Override - public void traverseAspectToolEntryNode(Node node) { + public void onAspectToolEntry(Node node) { if(node.getChildNodes().getLength() > 0) { NodeList children = node.getChildNodes(); for(int i = 0; i < children.getLength(); i++) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AbstractXMLDefinitionPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionVisitor.java index 9b0e4e7daa9..b023dba89e6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AbstractXMLDefinitionPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionVisitor.java @@ -8,6 +8,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Refactoring * *****************************************************************************/ @@ -16,9 +17,9 @@ package org.eclipse.papyrus.uml.diagram.common.service; import org.w3c.dom.Node; /** - * Basic factory to create elements from the xml definition of the palette + * Represents a handler of events fired when walking through the XML definition of a palette */ -public abstract class AbstractXMLDefinitionPaletteFactory { +public interface XMLPaletteDefinitionVisitor { /** * action when visiting a content node @@ -26,7 +27,7 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseContentNode(Node node); + void onContent(Node node); /** * action when visiting a drawer node @@ -34,7 +35,7 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseDrawerNode(Node node); + void onDrawer(Node node); /** * action when visiting a drawer node @@ -42,7 +43,7 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseToolEntryNode(Node node); + void onToolEntry(Node node); /** * action when visiting a drawer node @@ -50,7 +51,7 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseStackNode(Node node); + void onStack(Node node); /** * action when visiting a drawer node @@ -58,7 +59,7 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseSeparatorNode(Node node); + void onSeparator(Node node); /** * action when visiting a aspect tool node @@ -66,6 +67,6 @@ public abstract class AbstractXMLDefinitionPaletteFactory { * @param node * the node to visit */ - public abstract void traverseAspectToolEntryNode(Node node); + void onAspectToolEntry(Node node); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLDefinitionPaletteParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionWalker.java index 3719c37bdda..eb43e98ca8a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLDefinitionPaletteParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteDefinitionWalker.java @@ -8,6 +8,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Refactoring * *****************************************************************************/ @@ -17,22 +18,22 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * Parser for the local definition of palettes. + * Walks through the XML definition of a palette and fires events on nodes */ -public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { +public class XMLPaletteDefinitionWalker implements IPapyrusPaletteConstant { - /** factory used to create elements from the parsed xml file */ - final protected AbstractXMLDefinitionPaletteFactory factory; + /** + * The handler for the walking events + */ + final private XMLPaletteDefinitionVisitor handler; /** - * Create a new XMLDefinitionPaletteParser + * Initializes this walker * - * @param factory - * the factory used to create elements from the parsing of the - * xml file + * @param handler The handler to be used for the walking events */ - public XMLDefinitionPaletteParser(AbstractXMLDefinitionPaletteFactory factory) { - this.factory = factory; + public XMLPaletteDefinitionWalker(XMLPaletteDefinitionVisitor handler) { + this.handler = handler; } /** @@ -41,13 +42,13 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parsePaletteDefinition(Node paletteDefinitionNode) { + public void walk(Node paletteDefinitionNode) { NodeList nodes = paletteDefinitionNode.getChildNodes(); for(int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if(CONTENT.equals(node.getNodeName())) { - factory.traverseContentNode(node); - parsePaletteContent(node); + handler.onContent(node); + walkContentNode(node); } } } @@ -57,24 +58,22 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * * @param node * the node to parse - * @param root - * the palette root to fill */ - public void parsePaletteContent(Node paletteContentNode) { + private void walkContentNode(Node paletteContentNode) { NodeList nodes = paletteContentNode.getChildNodes(); for(int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); String name = node.getNodeName(); if(DRAWER.equals(name)) { - parserDrawerNode(node); + walkDrawerNode(node); } else if(STACK.equals(name)) { - parserStackNode(node); + walkStackNode(node); } else if(SEPARATOR.equals(name)) { - parseSeparatorNode(node); + walkSeparatorNode(node); } else if(TOOL.equals(name)) { - parseToolNode(node); + walkToolNode(node); } else if(ASPECT_TOOL.equals(name)) { - parseAspectToolNode(node); + walkAspectToolNode(node); } } @@ -86,8 +85,8 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parseAspectToolNode(Node node) { - factory.traverseAspectToolEntryNode(node); + private void walkAspectToolNode(Node node) { + handler.onAspectToolEntry(node); } /** @@ -96,12 +95,11 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parserDrawerNode(Node node) { - factory.traverseDrawerNode(node); + private void walkDrawerNode(Node node) { + handler.onDrawer(node); if(node.getChildNodes().getLength() > 0) { - parsePaletteContent(node); + walkContentNode(node); } - // return entry; } /** @@ -110,11 +108,10 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parserStackNode(Node node) { - factory.traverseStackNode(node); - + private void walkStackNode(Node node) { + handler.onStack(node); if(node.getChildNodes().getLength() > 0) { - parsePaletteContent(node); + walkContentNode(node); } } @@ -124,11 +121,10 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parseToolNode(Node node) { - factory.traverseToolEntryNode(node); - + private void walkToolNode(Node node) { + handler.onToolEntry(node); if(node.getChildNodes().getLength() > 0) { - parsePaletteContent(node); + walkContentNode(node); } } @@ -138,11 +134,10 @@ public class XMLDefinitionPaletteParser implements IPapyrusPaletteConstant { * @param node * the node to parse */ - public void parseSeparatorNode(Node node) { - factory.traverseSeparatorNode(node); - + private void walkSeparatorNode(Node node) { + handler.onSeparator(node); if(node.getChildNodes().getLength() > 0) { - parsePaletteContent(node); + walkContentNode(node); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF index 84bd5b5bd44..9511803f965 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/META-INF/MANIFEST.MF @@ -46,7 +46,9 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties, org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0",
org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0"
+ org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java index 57605a7ad56..a426d79461c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CommunicationDiagramCreationCondition.java @@ -16,7 +16,6 @@ package org.eclipse.papyrus.uml.diagram.communication; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Interaction;
// TODO: Auto-generated Javadoc
/**
@@ -32,9 +31,6 @@ public class CommunicationDiagramCreationCondition extends PerspectiveContextDep * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof Interaction;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CreateCommunicationDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CreateCommunicationDiagramWithNavigationHandler.java deleted file mode 100644 index 2077dec0826..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/CreateCommunicationDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.communication;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateCommunicationDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateCommunicationDiagramWithNavigationHandler() {
- super(new CreateCommunicationDiagramCommand(), new CommunicationDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomDurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomDurationObservationCreateCommandCN.java index 14da8c7207c..26c202d59b8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomDurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomDurationObservationCreateCommandCN.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.DurationObservationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationObservation;
@@ -38,8 +39,8 @@ public class CustomDurationObservationCreateCommandCN extends DurationObservatio *
* @param req
*/
- public CustomDurationObservationCreateCommandCN(CreateElementRequest req) {
- super(req);
+ public CustomDurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
// TODO Auto-generated constructor stub
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomTimeObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomTimeObservationCreateCommandCN.java index e808e37c86f..16c154f8b7b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomTimeObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/commands/CustomTimeObservationCreateCommandCN.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.TimeObservationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
@@ -37,8 +38,8 @@ public class CustomTimeObservationCreateCommandCN extends TimeObservationCreateC *
* @param req
*/
- public CustomTimeObservationCreateCommandCN(CreateElementRequest req) {
- super(req);
+ public CustomTimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
// TODO Auto-generated constructor stub
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomInteractionCompartmentSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomInteractionCompartmentSemanticEditPolicy.java index dbffd5eeb94..3f64ffdf31a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomInteractionCompartmentSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomInteractionCompartmentSemanticEditPolicy.java @@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.communication.custom.policies.itemsemant import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomDurationObservationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomTimeObservationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.edit.policies.InteractionCompartmentItemSemanticEditPolicy;
@@ -35,10 +36,10 @@ public class CustomInteractionCompartmentSemanticEditPolicy extends InteractionC protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.TimeObservation_8006 == req.getElementType()) {
- return getGEFWrapper(new CustomTimeObservationCreateCommandCN(req));
+ return getGEFWrapper(new CustomTimeObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_8007 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommandCN(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml index ed621d16703..5be22933d29 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml @@ -26,69 +26,7 @@ </command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramCommand">
- <activeWhen>
- <or>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </or>
- </activeWhen>
- </handler>
- </extension>
-<extension
- point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramCommand"
- icon="icons/obj16/Diagram_Communication.gif"
- label="Create a new Communication Diagram"
- style="push"
- tooltip="Create a new Communication Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command commandId="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramCommand"
- icon="icons/obj16/Diagram_Communication.gif"
- label="Create a new Communication Diagram"
- style="push"
- tooltip="Create a new Communication Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramCommand"
- icon="icons/obj16/Diagram_Communication.gif"
- label="Create a new Communication Diagram"
- style="push"
- tooltip="Create a new Communication Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
-</extension>
<extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java index 44c8f04a2e8..b7b70e54e4b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java @@ -24,11 +24,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.communication.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentCreateCommandCN 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentCreateCommandCN 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_8005(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java index 1da79108539..0e3e7d4b3df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java @@ -24,11 +24,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.communication.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,7 +93,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();
}
/**
@@ -96,8 +103,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_8004(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java index 0ccce5dc9c1..91f9b748a66 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java @@ -24,11 +24,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.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DurationObservationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DurationObservationCreateCommandCN(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 DurationObservationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DurationObservationCreateCommandCN(req, eObject);
+ public static DurationObservationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationObservationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationObservationCreateCommandCN(CreateElementRequest req) {
+ public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
- 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_DurationObservation_8007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java index 980d156ff98..220e558fbcf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java @@ -24,12 +24,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.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class InteractionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class InteractionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionCreateCommand(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 InteractionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionCreateCommand(req, eObject);
+ public static InteractionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCreateCommand(CreateElementRequest req) {
+ public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +94,9 @@ public class InteractionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
@@ -97,8 +104,19 @@ public class InteractionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- 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");
+ }
Component childHolder = (Component)getElementToEdit();
childHolder.getPackagedElements().add(newElement);
ElementInitializers.getInstance().init_Interaction_8002(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java index a1d60b9a224..6badaf413ae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java @@ -24,11 +24,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.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public LifelineCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public LifelineCreateCommandCN(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 LifelineCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new LifelineCreateCommandCN(req, eObject);
+ public static LifelineCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LifelineCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public LifelineCreateCommandCN(CreateElementRequest req) {
+ public LifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class LifelineCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class LifelineCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getLifelines().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getLifelines().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Lifeline_8001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ShortCutDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ShortCutDiagramCreateCommand.java index 1e31753c902..dac46b1d016 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ShortCutDiagramCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ShortCutDiagramCreateCommand.java @@ -37,7 +37,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +47,25 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ShortCutDiagramCreateCommand(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 ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ShortCutDiagramCreateCommand(req, eObject);
+ public static ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ShortCutDiagramCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req) {
+ public ShortCutDiagramCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java index 88b2513e141..5bb09c2214b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java @@ -24,11 +24,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.communication.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public TimeObservationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public TimeObservationCreateCommandCN(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 TimeObservationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new TimeObservationCreateCommandCN(req, eObject);
+ public static TimeObservationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeObservationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeObservationCreateCommandCN(CreateElementRequest req) {
+ public TimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class TimeObservationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class TimeObservationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
- 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_TimeObservation_8006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/InteractionCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/InteractionCompartmentItemSemanticEditPolicy.java index 82015493283..4c9ca2e1d58 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/InteractionCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/InteractionCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.DurationObservationCreateCommandCN;
@@ -61,31 +62,31 @@ public class InteractionCompartmentItemSemanticEditPolicy extends UMLBaseItemSem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LifelineCreateCommandCN(req));
+ return getGEFWrapper(new LifelineCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_8005 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_8004 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_8006 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommandCN(req));
+ return getGEFWrapper(new TimeObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_8007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommandCN(req));
+ return getGEFWrapper(new DurationObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/ModelCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/ModelCanonicalEditPolicy.java index e1a85fe1964..1ce2f7cbd25 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/ModelCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/ModelCanonicalEditPolicy.java @@ -41,6 +41,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
import org.eclipse.papyrus.uml.diagram.communication.edit.parts.CommentEditPartCN;
import org.eclipse.papyrus.uml.diagram.communication.edit.parts.ConstraintEditPartCN;
import org.eclipse.papyrus.uml.diagram.communication.edit.parts.DurationObservationEditPartCN;
@@ -191,7 +192,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { * @generated
*/
private Collection<IAdaptable> refreshConnections() {
- Map<EObject, View> domain2NotationMap = new HashMap<EObject, View>();
+ Domain2Notation domain2NotationMap = new Domain2Notation();
Collection<UMLLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
Collection existingLinks = new LinkedList(getDiagram().getEdges());
for(Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
@@ -222,7 +223,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private Collection<UMLLinkDescriptor> collectAllLinks(View view, Map<EObject, View> domain2NotationMap) {
+ private Collection<UMLLinkDescriptor> collectAllLinks(View view, Domain2Notation domain2NotationMap) {
if(!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
return Collections.emptyList();
}
@@ -233,9 +234,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPackage_1000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case InteractionEditPart.VISUAL_ID:
@@ -243,9 +242,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getInteraction_8002ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case ShortCutDiagramEditPart.VISUAL_ID:
@@ -253,9 +250,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getDiagram_8016ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case LifelineEditPartCN.VISUAL_ID:
@@ -263,9 +258,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getLifeline_8001ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConstraintEditPartCN.VISUAL_ID:
@@ -273,9 +266,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getConstraint_8004ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case CommentEditPartCN.VISUAL_ID:
@@ -283,9 +274,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getComment_8005ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case TimeObservationEditPartCN.VISUAL_ID:
@@ -293,9 +282,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getTimeObservation_8006ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case DurationObservationEditPartCN.VISUAL_ID:
@@ -303,9 +290,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getDurationObservation_8007ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case MessageEditPart.VISUAL_ID:
@@ -313,9 +298,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getMessage_8009ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
}
@@ -331,11 +314,11 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private Collection<IAdaptable> createConnections(Collection<UMLLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
+ private Collection<IAdaptable> createConnections(Collection<UMLLinkDescriptor> linkDescriptors, Domain2Notation domain2NotationMap) {
LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
for(UMLLinkDescriptor nextLinkDescriptor : linkDescriptors) {
- EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
- EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+ EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, domain2NotationMap);
+ EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, domain2NotationMap);
if(sourceEditPart == null || targetEditPart == null) {
continue;
}
@@ -361,7 +344,7 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private EditPart getEditPart(EObject domainModelElement, Map<EObject, View> domain2NotationMap) {
+ private EditPart getEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap) {
View view = (View)domain2NotationMap.get(domainModelElement);
if(view != null) {
return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
@@ -375,4 +358,59 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { private Diagram getDiagram() {
return ((View)getHost().getModel()).getDiagram();
}
+
+ /**
+ * @generated
+ */
+ private EditPart getSourceEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
+ return getEditPart(descriptor.getSource(), domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart getTargetEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
+ return getEditPart(descriptor.getDestination(), domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ protected final EditPart getHintedEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap, int hintVisualId) {
+ View view = (View)domain2NotationMap.getHinted(domainModelElement, UMLVisualIDRegistry.getType(hintVisualId));
+ if(view != null) {
+ return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("serial")
+ protected static class Domain2Notation extends HashMap<EObject, View> {
+
+ /**
+ * @generated
+ */
+ public boolean containsDomainElement(EObject domainElement) {
+ return this.containsKey(domainElement);
+ }
+
+ /**
+ * @generated
+ */
+ public View getHinted(EObject domainEObject, String hint) {
+ return this.get(domainEObject);
+ }
+
+ /**
+ * @generated
+ */
+ public void putView(EObject domainElement, View view) {
+ if(!containsKey(view.getElement())) {
+ this.put(domainElement, view);
+ }
+ }
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/PackageItemSemanticEditPolicy.java index 6ee3940938b..d11b0f9de0f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/PackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/edit/policies/PackageItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.InteractionCreateCommand;
import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ShortCutDiagramCreateCommand;
@@ -63,13 +64,13 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCreateCommand(req));
+ return getGEFWrapper(new InteractionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Diagram_8016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShortCutDiagramCreateCommand(req));
+ return getGEFWrapper(new ShortCutDiagramCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF index 5a76a3e47f3..dd5181f3002 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF @@ -60,7 +60,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
org.eclipse.papyrus.uml.diagram.menu;bundle-version="1.0.0",
org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java index 78355864205..4513d2660b2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/ComponentDiagramCreationCondition.java @@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.component; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Component;
/**
* ComponentDiagramCreationCondition class allows to check if a Component diagram can be added to the
@@ -24,11 +23,7 @@ public class ComponentDiagramCreationCondition extends PerspectiveContextDepende * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package || selectedElement instanceof Component;
- }
return false;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/CreateComponentDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/CreateComponentDiagramWithNavigationHandler.java deleted file mode 100644 index 67f6f530eaf..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/CreateComponentDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.component;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateComponentDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateComponentDiagramWithNavigationHandler() {
- super(new CreateComponentDiagramCommand(), new ComponentDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/command/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/command/PortCreateCommand.java index 03c882bdb54..beafe3b7254 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/command/PortCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/command/PortCreateCommand.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
@@ -32,8 +33,8 @@ import org.eclipse.uml2.uml.UMLFactory; public class PortCreateCommand extends org.eclipse.papyrus.uml.diagram.component.edit.commands.PortCreateCommand {
/** Constructor **/
- public PortCreateCommand(CreateElementRequest req) {
- super(req);
+ public PortCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java index a911fec83c6..61d732a7841 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.component.custom.edit.command.ConnectorCreateCommand;
@@ -51,7 +52,7 @@ public class PropertyPartItemSemanticEditPolicyCN extends org.eclipse.papyrus.um @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes.Port_3069 == req.getElementType()) {
- return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.component.custom.command.PortCreateCommand(req));
+ return getGEFWrapper(new org.eclipse.papyrus.uml.diagram.component.custom.command.PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml index b0206b46ec9..469f4280c84 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml @@ -117,74 +117,6 @@ </command>
</extension>
<extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand">
- <activeWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand"
- icon="icons/obj16/ComponentDiagram.gif"
- label="Create a new Component Diagram"
- style="push"
- tooltip="Create a new Component Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand"
- icon="icons/obj16/ComponentDiagram.gif"
- label="Create a new Component Diagram"
- style="push"
- tooltip="Create a new Component Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand"
- icon="icons/obj16/ComponentDiagram.gif"
- label="Create a new Component Diagram"
- style="push"
- tooltip="Create a new Component Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
- </extension>
- <extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
<editorDiagram
actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java index 2ad93c96a65..16639cbe345 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommand.java @@ -23,12 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,11 +93,9 @@ public class CommentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,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_3201(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java index 1a7cc517567..afec170dc02 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/CommentCreateCommandPCN.java @@ -23,11 +23,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.component.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class CommentCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class CommentCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandPCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandPCN(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 CommentCreateCommandPCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandPCN(req, eObject);
+ public static CommentCreateCommandPCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandPCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandPCN(CreateElementRequest req) {
+ public CommentCreateCommandPCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class CommentCreateCommandPCN 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();
}
/**
@@ -95,8 +102,19 @@ public class CommentCreateCommandPCN 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_3074(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java index 438bf73bdb3..04800087280 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommand.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ComponentCreateCommand(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 ComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ComponentCreateCommand(req, eObject);
+ public static ComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCreateCommand(CreateElementRequest req) {
+ public ComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,11 +92,9 @@ public class ComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -99,8 +102,19 @@ public class ComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_2002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java index b9d914ae021..7a6d493b9a7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandCN.java @@ -23,10 +23,14 @@ 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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class ComponentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class ComponentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ComponentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ComponentCreateCommandCN(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 ComponentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ComponentCreateCommandCN(req, eObject);
+ public static ComponentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCreateCommandCN(CreateElementRequest req) {
+ public ComponentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class ComponentCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class ComponentCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- Component owner = (Component)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 {
+ Component qualifiedTarget = (Component)target;
+ qualifiedTarget.getPackagedElements().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Component_3070(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java index 14a8d5f50ab..02023e802f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ComponentCreateCommandPCN.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ComponentCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ComponentCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- public ComponentCreateCommandPCN(CreateElementRequest req, EObject eObject) {
+ public ComponentCreateCommandPCN(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 ComponentCreateCommandPCN create(CreateElementRequest req, EObject eObject) {
- return new ComponentCreateCommandPCN(req, eObject);
+ public static ComponentCreateCommandPCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCreateCommandPCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCreateCommandPCN(CreateElementRequest req) {
+ public ComponentCreateCommandPCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ComponentCreateCommandPCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ComponentCreateCommandPCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_3071(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java index e2f9a22b157..e58602981fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommand.java @@ -23,12 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ConstraintCreateCommand 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_3199(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java index 950f4f52fdb..951b32bdb06 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ConstraintCreateCommandPCN.java @@ -23,11 +23,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.component.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class ConstraintCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ConstraintCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommandPCN(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommandPCN(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 ConstraintCreateCommandPCN create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommandPCN(req, eObject);
+ public static ConstraintCreateCommandPCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommandPCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommandPCN(CreateElementRequest req) {
+ public ConstraintCreateCommandPCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ConstraintCreateCommandPCN 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();
}
/**
@@ -95,8 +102,19 @@ public class ConstraintCreateCommandPCN 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_3075(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java index 4d65f4b345c..a497eb61351 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DefaultNamedElementCreateCommand.java @@ -23,9 +23,13 @@ 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.Package;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -35,7 +39,7 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -45,24 +49,25 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DefaultNamedElementCreateCommand(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 DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DefaultNamedElementCreateCommand(req, eObject);
+ public static DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DefaultNamedElementCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req) {
+ public DefaultNamedElementCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -85,11 +90,9 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- 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.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java index a72dd4895a9..815587c8406 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/DependencyNodeCreateCommand.java @@ -23,10 +23,14 @@ 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.Dependency;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DependencyNodeCreateCommand(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 DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DependencyNodeCreateCommand(req, eObject);
+ public static DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DependencyNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req) {
+ public DependencyNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,11 +91,9 @@ public class DependencyNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
+ return data.isPermitted();
}
/**
@@ -98,8 +101,19 @@ public class DependencyNodeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
- 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");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java index 02b8ca9b591..3a9d86ace25 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommand.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
+import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +42,7 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +52,25 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommand(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 InterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommand(req, eObject);
+ public static InterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req) {
+ public InterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +93,9 @@ public class InterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +103,19 @@ public class InterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_3078(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java index 4932dbb6c6c..66affeab429 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/InterfaceCreateCommandPCN.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InterfaceCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InterfaceCreateCommandPCN extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommandPCN(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommandPCN(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 InterfaceCreateCommandPCN create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommandPCN(req, eObject);
+ public static InterfaceCreateCommandPCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommandPCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommandPCN(CreateElementRequest req) {
+ public InterfaceCreateCommandPCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InterfaceCreateCommandPCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class InterfaceCreateCommandPCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_3072(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java index 20544ba5c8a..2c5b58850fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommand.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommand(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 ModelCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommand(req, eObject);
+ public static ModelCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommand(CreateElementRequest req) {
+ public ModelCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,11 +92,9 @@ public class ModelCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -99,8 +102,19 @@ public class ModelCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_3202(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java index 533dca5741f..aa04bf4eddb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ModelCreateCommandCN.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandCN(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 ModelCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandCN(req, eObject);
+ public static ModelCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req) {
+ public ModelCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ModelCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ModelCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_3077(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java index 05f34a79613..4f7b2242c50 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java @@ -24,11 +24,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OperationForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OperationForInterfaceCreateCommand(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 OperationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OperationForInterfaceCreateCommand(req, eObject);
+ public static OperationForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationForInterfaceCreateCommand(CreateElementRequest req) {
+ public OperationForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_5(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java index 0eacbbec62c..7a272833ffe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommand.java @@ -23,10 +23,14 @@ 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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommand(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 PackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommand(req, eObject);
+ public static PackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req) {
+ public PackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,11 +91,9 @@ public class PackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -98,8 +101,19 @@ public class PackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_3200(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java index 9cbdbe82369..fa2cbbb21da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PackageCreateCommandCN.java @@ -23,10 +23,14 @@ 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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandCN(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 PackageCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandCN(req, eObject);
+ public static PackageCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req) {
+ public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -86,7 +91,9 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -94,8 +101,19 @@ public class PackageCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_3076(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java index c766a8af7de..ca0f8c7d2c1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PortCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PortCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PortCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PortCreateCommand(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 PortCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PortCreateCommand(req, eObject);
+ public static PortCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PortCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PortCreateCommand(CreateElementRequest req) {
+ public PortCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PortCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPort());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PortCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Port newElement = UMLFactory.eINSTANCE.createPort();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Port_3069(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java index f52dbd6f352..83eee5f02e6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyCreateCommand.java @@ -14,11 +14,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class PropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class PropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyCreateCommand(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 PropertyCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyCreateCommand(req, eObject);
+ public static PropertyCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyCreateCommand(CreateElementRequest req) {
+ public PropertyCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -78,7 +83,9 @@ public class PropertyCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -86,8 +93,19 @@ public class PropertyCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3079(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java index 5b6adc4aaa0..3c91cc58b56 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/PropertyForInterfaceCreateCommand.java @@ -24,11 +24,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PropertyForInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PropertyForInterfaceCreateCommand(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 PropertyForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PropertyForInterfaceCreateCommand(req, eObject);
+ public static PropertyForInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyForInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyForInterfaceCreateCommand(CreateElementRequest req) {
+ public PropertyForInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PropertyForInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_1(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java index f6e8d707c73..faf25af41ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/ReceptionInInterfaceCreateCommand.java @@ -24,11 +24,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Reception;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ReceptionInInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ReceptionInInterfaceCreateCommand(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 ReceptionInInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ReceptionInInterfaceCreateCommand(req, eObject);
+ public static ReceptionInInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReceptionInInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ReceptionInInterfaceCreateCommand(CreateElementRequest req) {
+ public ReceptionInInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReception());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ReceptionInInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Reception newElement = UMLFactory.eINSTANCE.createReception();
- Interface owner = (Interface)getElementToEdit();
- owner.getOwnedReceptions().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 {
+ Interface qualifiedTarget = (Interface)target;
+ qualifiedTarget.getOwnedReceptions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Reception_6(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java index 288e4757be6..8111a9b85e4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java @@ -23,11 +23,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.component.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public RectangleInterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public RectangleInterfaceCreateCommand(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 RectangleInterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new RectangleInterfaceCreateCommand(req, eObject);
+ public static RectangleInterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new RectangleInterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public RectangleInterfaceCreateCommand(CreateElementRequest req) {
+ public RectangleInterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_3205(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java index 473de7eaf50..d31d6709f2c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.PropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -68,13 +69,13 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyCreateCommand(req));
+ return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java index be548445f52..2959bcd5075 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.PropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -68,13 +69,13 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyCreateCommand(req));
+ return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java index b205d5452e7..1101e151b4b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyPCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.PropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -68,13 +69,13 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicyPCN extends UMLB if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyCreateCommand(req));
+ return getGEFWrapper(new PropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java index 8330303e218..f28e83803dc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentDiagramItemSemanticEditPolicy.java @@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.CommentCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommand;
@@ -79,55 +80,55 @@ public class ComponentDiagramItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DependencyNodeCreateCommand(req));
+ return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_2002 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommand(req));
+ return getGEFWrapper(new ComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3202 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommand(req));
+ return getGEFWrapper(new ModelCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3200 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommand(req));
+ return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3205 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RectangleInterfaceCreateCommand(req));
+ return getGEFWrapper(new RectangleInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3201 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3199 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_3204 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DefaultNamedElementCreateCommand(req));
+ return getGEFWrapper(new DefaultNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2003 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java index d34afba5f3d..96880c59773 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.AbstractionCreateCommand;
@@ -100,7 +101,7 @@ public class ComponentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java index e4e36c74826..6d29a15bcb1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.AbstractionCreateCommand;
@@ -100,7 +101,7 @@ public class ComponentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java index dc3c384f216..56be47a17a3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ComponentItemSemanticEditPolicyPCN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.AbstractionCreateCommand;
@@ -100,7 +101,7 @@ public class ComponentItemSemanticEditPolicyPCN extends UMLBaseItemSemanticEditP if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java index 16b2906acbc..5c435c53bfb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.PropertyForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForInterfaceCreateCommand(req));
+ return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java index 57a380c06e2..8c4592e2c59 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceAttributeCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.PropertyForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -47,7 +48,7 @@ public class InterfaceAttributeCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyForInterfaceCreateCommand(req));
+ return getGEFWrapper(new PropertyForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java index bc66d096333..557c72abc3e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java index e0502859da2..e4e10beb54c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.OperationForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ReceptionInInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -58,13 +59,13 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_6 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req));
+ return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java index 30f55bc324c..804c1d15e54 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/InterfaceOperationCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.OperationForInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ReceptionInInterfaceCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
@@ -48,13 +49,13 @@ public class InterfaceOperationCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationForInterfaceCreateCommand(req));
+ return getGEFWrapper(new OperationForInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Reception_6 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req));
+ return getGEFWrapper(new ReceptionInInterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java index de3e2087dc7..16f1f7544f3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.CommentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ConstraintCreateCommandPCN;
@@ -62,43 +63,43 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicy extends UM if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandPCN(req));
+ return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandPCN(req));
+ return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandPCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandPCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java index 34535e0c50f..eac327dc776 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.CommentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ConstraintCreateCommandPCN;
@@ -62,43 +63,43 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandPCN(req));
+ return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandPCN(req));
+ return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandPCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandPCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java index 6bd24b31d6e..d749951a36d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.CommentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ConstraintCreateCommandPCN;
@@ -73,43 +74,43 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandPCN(req));
+ return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandPCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandPCN(req));
+ return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandPCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java index d5fee615eb8..420a1f553a5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.CommentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ComponentCreateCommandPCN;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.ConstraintCreateCommandPCN;
@@ -62,43 +63,43 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCreateCommandPCN(req));
+ return getGEFWrapper(new ComponentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandPCN(req));
+ return getGEFWrapper(new CommentCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandPCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandPCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandPCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java index 904d15e34f1..c7aae5140f3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java @@ -39,6 +39,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.component.edit.commands.AbstractionCreateCommand;
@@ -105,7 +106,7 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
@@ -361,25 +362,7 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic * @generated
*/
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
- ICommand reorientCommand =null;
switch(getVisualID(req)) {
- case org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorEditPart.VISUAL_ID:
- if(provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // Add graphical new end View in request parameters
- View targetView = (View)getHost().getModel();
- req.setParameter(RequestParameterConstants.EDGE_REORIENT_REQUEST_END_VIEW, targetView);
-
- // Retrieve re-orient command from the Element Edit service
- reorientCommand = provider.getEditCommand(req);
- if(reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
-
case UsageEditPart.VISUAL_ID:
case InterfaceRealizationEditPart.VISUAL_ID:
case SubstitutionEditPart.VISUAL_ID:
@@ -388,12 +371,12 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic case AbstractionEditPart.VISUAL_ID:
case DependencyEditPart.VISUAL_ID:
case DependencyBranchEditPart.VISUAL_ID:
-
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve re-orient command from the Element Edit service
- reorientCommand = provider.getEditCommand(req);
+ ICommand reorientCommand = provider.getEditCommand(req);
if(reorientCommand == null) {
return UnexecutableCommand.INSTANCE;
}
@@ -417,5 +400,4 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java index 03df5d81052..6ccb7b8c931 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -304,20 +304,6 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
protected Command getCreateCommand(CreateElementRequest req) {
// no more usage of the extended types here.
- IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof IExtendedHintedElementType) {
- IExtendedHintedElementType extendedElementType = (IExtendedHintedElementType) requestElementType;
-
- // try to get a semantic create command from the extended type
- IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandProvider != null) {
- ICommand command = commandProvider.getEditCommand(req);
- if (command != null && command.canExecute()) {
- return new ICommandProxy(command);
- }
- }
- }
-
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java index 0b694f6d6b3..5e0c12c194c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLVisualIDRegistry.java @@ -168,16 +168,7 @@ public class UMLVisualIDRegistry { * @generated not
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return ComponentDiagramEditPart.VISUAL_ID;
- }
- if(UMLPackage.eINSTANCE.getComponent().isSuperTypeOf(domainElement.eClass())) {
- return ComponentDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return ComponentDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF index 0035ce00726..b4e6e6f9196 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF @@ -69,13 +69,12 @@ Require-Bundle: org.eclipse.emf.ecore, org.eclipse.gef,
org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.composite.part.UMLDi
- agramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.composite;singlet
- on:=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.composite; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java index 8e0e3458b8a..755749a612c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CompositeDiagramCreationCondition.java @@ -15,7 +15,6 @@ package org.eclipse.papyrus.uml.diagram.composite; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Collaboration;
/**
* CompositeDiagramCreationCondition class allows to check if a Composite diagram can be added to the
@@ -27,9 +26,6 @@ public class CompositeDiagramCreationCondition extends PerspectiveContextDepende * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package || selectedElement instanceof org.eclipse.uml2.uml.Class || selectedElement instanceof Collaboration;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java index 9b23ea680f3..663d37fdccc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; +import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; import org.eclipse.uml2.uml.Collaboration; @@ -54,7 +55,7 @@ public class CreateCompositeDiagramCommand extends AbstractPapyrusGmfCreateDiagr * Name of the Diagram */ protected static final String CSD_DEFAULT_NAME = "CompositeDiagram"; //$NON-NLS-1$ - + /** * {@inheritDoc} */ @@ -99,17 +100,17 @@ public class CreateCompositeDiagramCommand extends AbstractPapyrusGmfCreateDiagr * {@inheritDoc} */ @Override - protected Diagram createDiagram(Resource diagramResource, EObject owner, String name) { + protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, ViewPrototype prototype, String name) { Diagram diagram = null; - if(owner instanceof org.eclipse.uml2.uml.Class || (owner instanceof Collaboration)) { - canvasDomainElement = (EObject)owner; - Package owningPackage = ((Element)owner).getNearestPackage(); - diagram = super.createDiagram(diagramResource, owningPackage, name); + if(element instanceof org.eclipse.uml2.uml.Class || (element instanceof Collaboration)) { + canvasDomainElement = (EObject)element; + Package owningPackage = ((Element)element).getNearestPackage(); + diagram = super.doCreateDiagram(diagramResource, owner, owningPackage, prototype, name); - } else if(owner instanceof Package) { + } else if(element instanceof Package) { canvasDomainElement = null; - diagram = super.createDiagram(diagramResource, owner, name); + diagram = super.doCreateDiagram(diagramResource, owner, element, prototype, name); } return diagram; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramWithNavigationHandler.java deleted file mode 100644 index 85b15880bae..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateCompositeDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateCompositeDiagramWithNavigationHandler() {
- super(new CreateCompositeDiagramCommand(), new CompositeDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java index c1a12f94af0..65abb920576 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java @@ -23,6 +23,8 @@ import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
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.uml.diagram.composite.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.composite.custom.ui.CollaborationRoleValidator;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationRoleCreateCommandCN;
@@ -49,8 +51,8 @@ public class CollaborationRoleCreateCommand extends CollaborationRoleCreateComma * @param req
* the creation request
*/
- public CollaborationRoleCreateCommand(CreateElementRequest req) {
- super(req);
+ public CollaborationRoleCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
@@ -61,8 +63,8 @@ public class CollaborationRoleCreateCommand extends CollaborationRoleCreateComma * @param eObject
* the element to edit
*/
- public CollaborationRoleCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CollaborationRoleCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -74,8 +76,8 @@ public class CollaborationRoleCreateCommand extends CollaborationRoleCreateComma * the element to edit
* @return the new creation command for CollaborationRole
*/
- public static CollaborationRoleCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CollaborationRoleCreateCommand(req, eObject);
+ public static CollaborationRoleCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationRoleCreateCommand(req, eObject, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PortCreateCommand.java index 0e1990e6e19..3c2262d9b3e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PortCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PortCreateCommand.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
@@ -32,8 +33,8 @@ import org.eclipse.uml2.uml.UMLFactory; public class PortCreateCommand extends org.eclipse.papyrus.uml.diagram.composite.edit.commands.PortCreateCommand {
/** Constructor **/
- public PortCreateCommand(CreateElementRequest req) {
- super(req);
+ public PortCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartCreateCommand.java index f392ae4b55b..531aee7a7c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/PropertyPartCreateCommand.java @@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
@@ -26,8 +27,8 @@ import org.eclipse.uml2.uml.UMLFactory; public class PropertyPartCreateCommand extends org.eclipse.papyrus.uml.diagram.composite.edit.commands.PropertyPartCreateCommandCN {
/** Constructor **/
- public PropertyPartCreateCommand(CreateElementRequest req) {
- super(req);
+ public PropertyPartCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java index 59d93e76318..182ce4b96c3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.command.CollaborationRoleCreateCommand;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -37,7 +38,7 @@ public class CollaborationCompositeCompartmentItemSemanticEditPolicy extends org @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.ConnectableElement_3115 == req.getElementType()) {
- return getGEFWrapper(new CollaborationRoleCreateCommand(req));
+ return getGEFWrapper(new CollaborationRoleCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java index c563f2eedd0..c42dc853dd7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.command.PropertyPartCreateCommand;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -38,7 +39,7 @@ public class PropertyPartCompartmentItemSemanticEditPolicyCN extends org.eclipse @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.Property_3070 == req.getElementType()) {
- return getGEFWrapper(new PropertyPartCreateCommand(req));
+ return getGEFWrapper(new PropertyPartCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartItemSemanticEditPolicyCN.java index 228f406855f..a1fd27518e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyPartItemSemanticEditPolicyCN.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.command.ConnectorCreateCommand;
@@ -53,7 +54,7 @@ public class PropertyPartItemSemanticEditPolicyCN extends org.eclipse.papyrus.um @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.Port_3069 == req.getElementType()) {
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml index ca319e79822..9ccccb0d499 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml @@ -1583,51 +1583,6 @@ </creationCommand> </extension> -<extension - point="org.eclipse.ui.menus"> - - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> - <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar"> - <command commandId="org.eclipse.papyrus.uml.diagram.composite.createCompositeDiagram" - icon="icons/obj16/Diagram_CompositeStructure.gif" - label="Create a new Composite Structure Diagram" - style="push" - tooltip="Create a new Composite Structure Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </toolbar> - </menuContribution> - - <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu"> - <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" - label="Diagrams"> - <command commandId="org.eclipse.papyrus.uml.diagram.composite.createCompositeDiagram" - icon="icons/obj16/Diagram_CompositeStructure.gif" - label="Create a new Composite Structure Diagram" - style="push" - tooltip="Create a new Composite Structure Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menu> - </menuContribution> - - <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram"> - <command commandId="org.eclipse.papyrus.uml.diagram.composite.createCompositeDiagram" - icon="icons/obj16/Diagram_CompositeStructure.gif" - label="Create a new Composite Structure Diagram" - style="push" - tooltip="Create a new Composite Structure Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menuContribution> - -</extension> <extension point="org.eclipse.ui.commands"> @@ -1637,23 +1592,6 @@ id="org.eclipse.papyrus.uml.diagram.composite.createCompositeDiagram" name="Create a new Composite Structure Diagram"> </command> - </extension> - <extension - point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.papyrus.uml.diagram.composite.CreateCompositeDiagramWithNavigationHandler" - commandId="org.eclipse.papyrus.uml.diagram.composite.createCompositeDiagram"> - <activeWhen> - <or> - <with - variable="activeEditorId"> - <equals - value="org.eclipse.papyrus.infra.core.papyrusEditor"> - </equals> - </with> - </or> - </activeWhen> - </handler> </extension><extension point="org.eclipse.ui.menus" id="context-menus"> <?gmfgen generated="true"?> <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after="> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommand.java index 08d4ef87ee4..dea43095eeb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ActivityCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActivityCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ActivityCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActivityCompositeCreateCommand(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 ActivityCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActivityCompositeCreateCommand(req, eObject);
+ public static ActivityCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityCompositeCreateCommand(CreateElementRequest req) {
+ public ActivityCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ActivityCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActivity());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ActivityCompositeCreateCommand 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_2060(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommandCN.java index 47e3e0e1fc7..7d38c2c5379 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActivityCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActivityCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ActivityCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ActivityCompositeCreateCommandCN(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 ActivityCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ActivityCompositeCreateCommandCN(req, eObject);
+ public static ActivityCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityCompositeCreateCommandCN(CreateElementRequest req) {
+ public ActivityCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActivityCompositeCreateCommandCN 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();
}
/**
@@ -96,8 +103,19 @@ public class ActivityCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Activity newElement = UMLFactory.eINSTANCE.createActivity();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Activity_3072(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCreateCommandCLN.java index 82fcb35bfb2..cb188242089 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActivityCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActivityCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActivityCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public ActivityCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public ActivityCreateCommandCLN(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 ActivityCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new ActivityCreateCommandCLN(req, eObject);
+ public static ActivityCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActivityCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActivityCreateCommandCLN(CreateElementRequest req) {
+ public ActivityCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActivityCreateCommandCLN 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();
}
/**
@@ -96,8 +103,19 @@ public class ActivityCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Activity newElement = UMLFactory.eINSTANCE.createActivity();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Activity_3103(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommand.java index 7a3d84eae28..79c89f4c907 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ActorCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActorCreateCommand(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 ActorCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActorCreateCommand(req, eObject);
+ public static ActorCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorCreateCommand(CreateElementRequest req) {
+ public ActorCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ActorCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ActorCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- 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_Actor_2077(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommandCN.java index 93f20c23c9c..be4c0822937 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ActorCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ActorCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ActorCreateCommandCN(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 ActorCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ActorCreateCommandCN(req, eObject);
+ public static ActorCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorCreateCommandCN(CreateElementRequest req) {
+ public ActorCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActorCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ActorCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Actor_3091(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/AnyReceiveEventCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/AnyReceiveEventCreateCommand.java index f6b1ec264a5..771b28cf3e3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/AnyReceiveEventCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/AnyReceiveEventCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.AnyReceiveEvent;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class AnyReceiveEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class AnyReceiveEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- public AnyReceiveEventCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AnyReceiveEventCreateCommand(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 AnyReceiveEventCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AnyReceiveEventCreateCommand(req, eObject);
+ public static AnyReceiveEventCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AnyReceiveEventCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AnyReceiveEventCreateCommand(CreateElementRequest req) {
+ public AnyReceiveEventCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class AnyReceiveEventCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAnyReceiveEvent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class AnyReceiveEventCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
AnyReceiveEvent newElement = UMLFactory.eINSTANCE.createAnyReceiveEvent();
- 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_AnyReceiveEvent_2085(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommand.java index 6a5d53dbdd4..d2e559184b5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ArtifactCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ArtifactCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ArtifactCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ArtifactCreateCommand(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 ArtifactCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ArtifactCreateCommand(req, eObject);
+ public static ArtifactCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ArtifactCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ArtifactCreateCommand(CreateElementRequest req) {
+ public ArtifactCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ArtifactCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ArtifactCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
- 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_Artifact_2079(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommandCN.java index d256872c3fc..faa7800defe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ArtifactCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ArtifactCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ArtifactCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ArtifactCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ArtifactCreateCommandCN(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 ArtifactCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ArtifactCreateCommandCN(req, eObject);
+ public static ArtifactCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ArtifactCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ArtifactCreateCommandCN(CreateElementRequest req) {
+ public ArtifactCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ArtifactCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ArtifactCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Artifact_3093(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CallEventCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CallEventCreateCommand.java index 80a7654624a..2587ee11904 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CallEventCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CallEventCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.CallEvent;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CallEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CallEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- public CallEventCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CallEventCreateCommand(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 CallEventCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CallEventCreateCommand(req, eObject);
+ public static CallEventCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CallEventCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CallEventCreateCommand(CreateElementRequest req) {
+ public CallEventCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class CallEventCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCallEvent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class CallEventCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CallEvent newElement = UMLFactory.eINSTANCE.createCallEvent();
- 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_CallEvent_2084(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ChangeEventCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ChangeEventCreateCommand.java index 9b9fb6bf27d..93ab13e7c83 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ChangeEventCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ChangeEventCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.ChangeEvent;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ChangeEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ChangeEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ChangeEventCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ChangeEventCreateCommand(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 ChangeEventCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ChangeEventCreateCommand(req, eObject);
+ public static ChangeEventCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ChangeEventCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ChangeEventCreateCommand(CreateElementRequest req) {
+ public ChangeEventCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ChangeEventCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getChangeEvent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ChangeEventCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ChangeEvent newElement = UMLFactory.eINSTANCE.createChangeEvent();
- 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_ChangeEvent_2088(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommand.java index 15b11b78d29..fa6c01e9656 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ClassCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ClassCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ClassCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ClassCompositeCreateCommand(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 ClassCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ClassCompositeCreateCommand(req, eObject);
+ public static ClassCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassCompositeCreateCommand(CreateElementRequest req) {
+ public ClassCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ClassCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ClassCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- 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_Class_2073(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommandCN.java index 0abb6030a17..0261e8994db 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCompositeCreateCommandCN.java @@ -24,10 +24,14 @@ 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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ClassCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ClassCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ClassCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ClassCompositeCreateCommandCN(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 ClassCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ClassCompositeCreateCommandCN(req, eObject);
+ public static ClassCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassCompositeCreateCommandCN(CreateElementRequest req) {
+ public ClassCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ClassCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ClassCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Class_3085(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCreateCommandCLN.java index 00744a13adb..44e3f1318fb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ClassCreateCommandCLN.java @@ -24,10 +24,14 @@ 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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ClassCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ClassCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public ClassCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public ClassCreateCommandCLN(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 ClassCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new ClassCreateCommandCLN(req, eObject);
+ public static ClassCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassCreateCommandCLN(CreateElementRequest req) {
+ public ClassCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ClassCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ClassCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Class_3114(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommand.java index 975f94b54c0..89182045645 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CollaborationCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CollaborationCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public CollaborationCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CollaborationCompositeCreateCommand(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 CollaborationCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CollaborationCompositeCreateCommand(req, eObject);
+ public static CollaborationCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CollaborationCompositeCreateCommand(CreateElementRequest req) {
+ public CollaborationCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class CollaborationCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCollaboration());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class CollaborationCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Collaboration newElement = UMLFactory.eINSTANCE.createCollaboration();
- 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_Collaboration_2075(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommandCN.java index 7a7f9b5afd8..4573349ee60 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CollaborationCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CollaborationCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CollaborationCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CollaborationCompositeCreateCommandCN(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 CollaborationCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CollaborationCompositeCreateCommandCN(req, eObject);
+ public static CollaborationCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CollaborationCompositeCreateCommandCN(CreateElementRequest req) {
+ public CollaborationCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CollaborationCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCollaboration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class CollaborationCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Collaboration newElement = UMLFactory.eINSTANCE.createCollaboration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Collaboration_3086(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCreateCommandCLN.java index f9610be706e..1cbe0be564e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Collaboration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CollaborationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CollaborationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public CollaborationCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public CollaborationCreateCommandCLN(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 CollaborationCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new CollaborationCreateCommandCLN(req, eObject);
+ public static CollaborationCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public CollaborationCreateCommandCLN(CreateElementRequest req) {
+ public CollaborationCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CollaborationCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCollaboration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class CollaborationCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Collaboration newElement = UMLFactory.eINSTANCE.createCollaboration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Collaboration_3109(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationRoleCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationRoleCreateCommandCN.java index 1a0d1104394..3c71fc3caf2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationRoleCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationRoleCreateCommandCN.java @@ -24,8 +24,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.ConnectableElement;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -35,7 +39,7 @@ public class CollaborationRoleCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -45,24 +49,25 @@ public class CollaborationRoleCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CollaborationRoleCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CollaborationRoleCreateCommandCN(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 CollaborationRoleCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CollaborationRoleCreateCommandCN(req, eObject);
+ public static CollaborationRoleCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationRoleCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CollaborationRoleCreateCommandCN(CreateElementRequest req) {
+ public CollaborationRoleCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -85,7 +90,9 @@ public class CollaborationRoleCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConnectableElement());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationUseCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationUseCreateCommandCN.java index b6552868de0..7766e1db7b5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationUseCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CollaborationUseCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.CollaborationUse;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CollaborationUseCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CollaborationUseCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CollaborationUseCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CollaborationUseCreateCommandCN(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 CollaborationUseCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CollaborationUseCreateCommandCN(req, eObject);
+ public static CollaborationUseCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CollaborationUseCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CollaborationUseCreateCommandCN(CreateElementRequest req) {
+ public CollaborationUseCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CollaborationUseCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCollaborationUse());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class CollaborationUseCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CollaborationUse newElement = UMLFactory.eINSTANCE.createCollaborationUse();
- Classifier owner = (Classifier)getElementToEdit();
- owner.getCollaborationUses().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 {
+ Classifier qualifiedTarget = (Classifier)target;
+ qualifiedTarget.getCollaborationUses().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CollaborationUse_3071(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommand.java index cf9a2f020e0..c1a4052338a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,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,11 +94,9 @@ public class CommentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,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_2109(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommandCN.java index a92f5923eef..dfa61732214 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/CommentCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentCreateCommandCN 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentCreateCommandCN 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_3097(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommand.java index 73b47b973d7..b2f377147ef 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ComponentCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ComponentCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ComponentCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ComponentCompositeCreateCommand(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 ComponentCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ComponentCompositeCreateCommand(req, eObject);
+ public static ComponentCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCompositeCreateCommand(CreateElementRequest req) {
+ public ComponentCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ComponentCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ComponentCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_2069(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommandCN.java index c4ef914b2de..6f75995d080 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ComponentCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ComponentCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ComponentCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ComponentCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ComponentCompositeCreateCommandCN(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 ComponentCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ComponentCompositeCreateCommandCN(req, eObject);
+ public static ComponentCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentCompositeCreateCommandCN(CreateElementRequest req) {
+ public ComponentCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ComponentCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ComponentCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Component_3081(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommand.java index e38ac029b09..bcdd44c5aab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,11 +94,9 @@ public class ConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,19 @@ public class ConstraintCreateCommand 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_2114(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommandCN.java index 932ca4e236a..41d731227b3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ConstraintCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,7 +93,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();
}
/**
@@ -96,8 +103,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_3120(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommand.java index d35adef9781..569c7133877 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommand(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 DataTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommand(req, eObject);
+ public static DataTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req) {
+ public DataTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DataTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DataTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- 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_DataType_2068(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCLN.java index 9f3305c9a26..609d03b6fe7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommandCLN(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 DataTypeCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommandCLN(req, eObject);
+ public static DataTypeCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommandCLN(CreateElementRequest req) {
+ public DataTypeCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypeCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypeCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataType_3113(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCN.java index 9de8ac980f4..c9b5b9ff851 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DataTypeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommandCN(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 DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommandCN(req, eObject);
+ public static DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req) {
+ public DataTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DataType_3080(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommand.java index 25f19bdbcb5..9e11e35f328 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DeploymentSpecification;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DeploymentSpecificationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DeploymentSpecificationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DeploymentSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DeploymentSpecificationCreateCommand(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 DeploymentSpecificationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DeploymentSpecificationCreateCommand(req, eObject);
+ public static DeploymentSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeploymentSpecificationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DeploymentSpecificationCreateCommand(CreateElementRequest req) {
+ public DeploymentSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DeploymentSpecificationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDeploymentSpecification());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DeploymentSpecificationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DeploymentSpecification newElement = UMLFactory.eINSTANCE.createDeploymentSpecification();
- 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_DeploymentSpecification_2078(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommandCN.java index 219ec793fb7..083e20fe64d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeploymentSpecificationCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.DeploymentSpecification;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DeploymentSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DeploymentSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DeploymentSpecificationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DeploymentSpecificationCreateCommandCN(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 DeploymentSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DeploymentSpecificationCreateCommandCN(req, eObject);
+ public static DeploymentSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeploymentSpecificationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DeploymentSpecificationCreateCommandCN(CreateElementRequest req) {
+ public DeploymentSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DeploymentSpecificationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDeploymentSpecification());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DeploymentSpecificationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DeploymentSpecification newElement = UMLFactory.eINSTANCE.createDeploymentSpecification();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DeploymentSpecification_3092(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommand.java index 2d2794e128f..2c4ab5b38b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Device;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DeviceCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DeviceCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DeviceCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DeviceCompositeCreateCommand(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 DeviceCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DeviceCompositeCreateCommand(req, eObject);
+ public static DeviceCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeviceCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DeviceCompositeCreateCommand(CreateElementRequest req) {
+ public DeviceCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DeviceCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DeviceCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Device newElement = UMLFactory.eINSTANCE.createDevice();
- 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_Device_2070(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommandCN.java index 9078391c556..8b9fa1ef9a6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DeviceCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Device;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DeviceCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DeviceCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DeviceCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DeviceCompositeCreateCommandCN(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 DeviceCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DeviceCompositeCreateCommandCN(req, eObject);
+ public static DeviceCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeviceCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DeviceCompositeCreateCommandCN(CreateElementRequest req) {
+ public DeviceCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DeviceCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DeviceCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Device newElement = UMLFactory.eINSTANCE.createDevice();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Device_3082(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommand.java index 4f84d6f79ab..f069de1afd3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class DurationConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class DurationConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintCreateCommand(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 DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintCreateCommand(req, eObject);
+ public static DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintCreateCommand(CreateElementRequest req) {
+ public DurationConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,11 +94,9 @@ public class DurationConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,19 @@ public class DurationConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- 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_DurationConstraint_2110(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommandCN.java index bfedbad1401..b58c6299ac4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationConstraintCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DurationConstraintCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintCreateCommandCN(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 DurationConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintCreateCommandCN(req, eObject);
+ public static DurationConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintCreateCommandCN(CreateElementRequest req) {
+ public DurationConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- 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_DurationConstraint_3116(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationCreateCommand.java index a4cfdab65ca..a76c0efb1df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Duration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationCreateCommand(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 DurationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationCreateCommand(req, eObject);
+ public static DurationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationCreateCommand(CreateElementRequest req) {
+ public DurationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DurationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDuration());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DurationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Duration newElement = UMLFactory.eINSTANCE.createDuration();
- 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_Duration_2104(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationIntervalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationIntervalCreateCommand.java index 56ceb554bad..1839cc58c05 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationIntervalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationIntervalCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationInterval;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationIntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationIntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationIntervalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationIntervalCreateCommand(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 DurationIntervalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationIntervalCreateCommand(req, eObject);
+ public static DurationIntervalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationIntervalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationIntervalCreateCommand(CreateElementRequest req) {
+ public DurationIntervalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DurationIntervalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationInterval());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DurationIntervalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationInterval newElement = UMLFactory.eINSTANCE.createDurationInterval();
- 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_DurationInterval_2106(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationObservationCreateCommand.java index 7b4d0b5b464..888e72c8052 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/DurationObservationCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationObservationCreateCommand(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 DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationObservationCreateCommand(req, eObject);
+ public static DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req) {
+ public DurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class DurationObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class DurationObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
- 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_DurationObservation_2093(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommand.java index 5770c643070..dfbf07c831e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommand(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 EnumerationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommand(req, eObject);
+ public static EnumerationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req) {
+ public EnumerationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class EnumerationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class EnumerationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- 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_Enumeration_2067(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCLN.java index 8b6951b8579..efe5bdcb319 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommandCLN(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 EnumerationCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommandCLN(req, eObject);
+ public static EnumerationCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommandCLN(CreateElementRequest req) {
+ public EnumerationCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Enumeration_3111(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCN.java index 49471eda4b6..c82acf1e734 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommandCN(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 EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommandCN(req, eObject);
+ public static EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req) {
+ public EnumerationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Enumeration_3079(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationLiteralCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationLiteralCreateCommandCLN.java index f99097d42ad..5efbd743b3f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationLiteralCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/EnumerationLiteralCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationLiteralCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationLiteralCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public EnumerationLiteralCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public EnumerationLiteralCreateCommandCLN(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 EnumerationLiteralCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new EnumerationLiteralCreateCommandCLN(req, eObject);
+ public static EnumerationLiteralCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationLiteralCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationLiteralCreateCommandCLN(CreateElementRequest req) {
+ public EnumerationLiteralCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationLiteralCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumerationLiteral());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationLiteralCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
EnumerationLiteral newElement = UMLFactory.eINSTANCE.createEnumerationLiteral();
- Enumeration owner = (Enumeration)getElementToEdit();
- owner.getOwnedLiterals().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 {
+ Enumeration qualifiedTarget = (Enumeration)target;
+ qualifiedTarget.getOwnedLiterals().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_EnumerationLiteral_3066(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommand.java index 3c26171aaf2..86aebd22065 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExecutionEnvironment;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ExecutionEnvironmentCompositeCreateCommand extends EditElementComma /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ExecutionEnvironmentCompositeCreateCommand extends EditElementComma /**
* @generated
*/
- public ExecutionEnvironmentCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExecutionEnvironmentCompositeCreateCommand(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 ExecutionEnvironmentCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExecutionEnvironmentCompositeCreateCommand(req, eObject);
+ public static ExecutionEnvironmentCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExecutionEnvironmentCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExecutionEnvironmentCompositeCreateCommand(CreateElementRequest req) {
+ public ExecutionEnvironmentCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ExecutionEnvironmentCompositeCreateCommand extends EditElementComma * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ExecutionEnvironmentCompositeCreateCommand extends EditElementComma */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
- 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_ExecutionEnvironment_2071(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommandCN.java index c366de24fb5..5f4ad0dee02 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExecutionEnvironmentCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.ExecutionEnvironment;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ExecutionEnvironmentCompositeCreateCommandCN extends EditElementCom /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ExecutionEnvironmentCompositeCreateCommandCN extends EditElementCom /**
* @generated
*/
- public ExecutionEnvironmentCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ExecutionEnvironmentCompositeCreateCommandCN(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 ExecutionEnvironmentCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ExecutionEnvironmentCompositeCreateCommandCN(req, eObject);
+ public static ExecutionEnvironmentCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExecutionEnvironmentCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ExecutionEnvironmentCompositeCreateCommandCN(CreateElementRequest req) {
+ public ExecutionEnvironmentCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ExecutionEnvironmentCompositeCreateCommandCN extends EditElementCom * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ExecutionEnvironmentCompositeCreateCommandCN extends EditElementCom */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ExecutionEnvironment_3083(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExpressionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExpressionCreateCommand.java index e3a00d51578..c20872e3776 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExpressionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ExpressionCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Expression;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ExpressionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExpressionCreateCommand(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 ExpressionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExpressionCreateCommand(req, eObject);
+ public static ExpressionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExpressionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExpressionCreateCommand(CreateElementRequest req) {
+ public ExpressionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ExpressionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExpression());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ExpressionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Expression newElement = UMLFactory.eINSTANCE.createExpression();
- 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_Expression_2103(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommand.java index 5251ebf02b8..05ba88f1841 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.FunctionBehavior;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class FunctionBehaviorCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class FunctionBehaviorCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public FunctionBehaviorCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public FunctionBehaviorCompositeCreateCommand(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 FunctionBehaviorCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new FunctionBehaviorCompositeCreateCommand(req, eObject);
+ public static FunctionBehaviorCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FunctionBehaviorCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public FunctionBehaviorCompositeCreateCommand(CreateElementRequest req) {
+ public FunctionBehaviorCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class FunctionBehaviorCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getFunctionBehavior());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class FunctionBehaviorCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
FunctionBehavior newElement = UMLFactory.eINSTANCE.createFunctionBehavior();
- 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_FunctionBehavior_2064(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommandCN.java index f35192f503c..53ce1a8042b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.FunctionBehavior;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class FunctionBehaviorCompositeCreateCommandCN extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class FunctionBehaviorCompositeCreateCommandCN extends EditElementCommand /**
* @generated
*/
- public FunctionBehaviorCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public FunctionBehaviorCompositeCreateCommandCN(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 FunctionBehaviorCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new FunctionBehaviorCompositeCreateCommandCN(req, eObject);
+ public static FunctionBehaviorCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FunctionBehaviorCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public FunctionBehaviorCompositeCreateCommandCN(CreateElementRequest req) {
+ public FunctionBehaviorCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class FunctionBehaviorCompositeCreateCommandCN extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getFunctionBehavior());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class FunctionBehaviorCompositeCreateCommandCN extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
FunctionBehavior newElement = UMLFactory.eINSTANCE.createFunctionBehavior();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_FunctionBehavior_3076(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCreateCommandCLN.java index 697910123a7..5add797436a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/FunctionBehaviorCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.FunctionBehavior;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class FunctionBehaviorCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class FunctionBehaviorCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public FunctionBehaviorCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public FunctionBehaviorCreateCommandCLN(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 FunctionBehaviorCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new FunctionBehaviorCreateCommandCLN(req, eObject);
+ public static FunctionBehaviorCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FunctionBehaviorCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public FunctionBehaviorCreateCommandCLN(CreateElementRequest req) {
+ public FunctionBehaviorCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class FunctionBehaviorCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getFunctionBehavior());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class FunctionBehaviorCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
FunctionBehavior newElement = UMLFactory.eINSTANCE.createFunctionBehavior();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_FunctionBehavior_3107(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommand.java index c8a876b33b1..a075d222cfe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.InformationItem;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InformationItemCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InformationItemCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InformationItemCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InformationItemCreateCommand(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 InformationItemCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InformationItemCreateCommand(req, eObject);
+ public static InformationItemCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InformationItemCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InformationItemCreateCommand(CreateElementRequest req) {
+ public InformationItemCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class InformationItemCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInformationItem());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class InformationItemCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InformationItem newElement = UMLFactory.eINSTANCE.createInformationItem();
- 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_InformationItem_2080(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommandCN.java index cdad80fdfab..7a83beb550a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InformationItemCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.InformationItem;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InformationItemCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InformationItemCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InformationItemCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InformationItemCreateCommandCN(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 InformationItemCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InformationItemCreateCommandCN(req, eObject);
+ public static InformationItemCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InformationItemCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InformationItemCreateCommandCN(CreateElementRequest req) {
+ public InformationItemCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InformationItemCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInformationItem());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InformationItemCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InformationItem newElement = UMLFactory.eINSTANCE.createInformationItem();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InformationItem_3094(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InstanceValueCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InstanceValueCreateCommand.java index 31bc4950150..2ed34bf32ea 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InstanceValueCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InstanceValueCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InstanceValueCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InstanceValueCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InstanceValueCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InstanceValueCreateCommand(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 InstanceValueCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InstanceValueCreateCommand(req, eObject);
+ public static InstanceValueCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InstanceValueCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InstanceValueCreateCommand(CreateElementRequest req) {
+ public InstanceValueCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class InstanceValueCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInstanceValue());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class InstanceValueCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InstanceValue newElement = UMLFactory.eINSTANCE.createInstanceValue();
- 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_InstanceValue_2108(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommand.java index fddb0dabcc1..8f4126a8492 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionCompositeCreateCommand(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 InteractionCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionCompositeCreateCommand(req, eObject);
+ public static InteractionCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCompositeCreateCommand(CreateElementRequest req) {
+ public InteractionCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class InteractionCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class InteractionCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- 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_Interaction_2061(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommandCN.java index 9031f5936ad..cc4781b571c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InteractionCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InteractionCompositeCreateCommandCN(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 InteractionCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InteractionCompositeCreateCommandCN(req, eObject);
+ public static InteractionCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCompositeCreateCommandCN(CreateElementRequest req) {
+ public InteractionCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InteractionCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InteractionCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interaction_3073(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommand.java index be9d55f50c2..9a7207f5f45 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.InteractionConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class InteractionConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class InteractionConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionConstraintCreateCommand(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 InteractionConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionConstraintCreateCommand(req, eObject);
+ public static InteractionConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionConstraintCreateCommand(CreateElementRequest req) {
+ public InteractionConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,11 +94,9 @@ public class InteractionConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionConstraint());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,19 @@ public class InteractionConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InteractionConstraint newElement = UMLFactory.eINSTANCE.createInteractionConstraint();
- 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_InteractionConstraint_2113(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommandCN.java index 0e3263d07f6..b504082d0b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionConstraintCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.InteractionConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InteractionConstraintCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InteractionConstraintCreateCommandCN(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 InteractionConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InteractionConstraintCreateCommandCN(req, eObject);
+ public static InteractionConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionConstraintCreateCommandCN(CreateElementRequest req) {
+ public InteractionConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InteractionConstraintCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InteractionConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InteractionConstraint newElement = UMLFactory.eINSTANCE.createInteractionConstraint();
- 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_InteractionConstraint_3119(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCreateCommandCLN.java index 558bf779f50..49bfabd5c81 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InteractionCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public InteractionCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public InteractionCreateCommandCLN(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 InteractionCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new InteractionCreateCommandCLN(req, eObject);
+ public static InteractionCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCreateCommandCLN(CreateElementRequest req) {
+ public InteractionCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InteractionCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InteractionCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interaction_3104(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommand.java index a1b69372147..7ea4bf733a3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InterfaceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommand(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 InterfaceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommand(req, eObject);
+ public static InterfaceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommand(CreateElementRequest req) {
+ public InterfaceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class InterfaceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class InterfaceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- 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_Interface_2076(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCLN.java index 405d483d307..def4bbe8c81 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InterfaceCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InterfaceCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommandCLN(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 InterfaceCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommandCLN(req, eObject);
+ public static InterfaceCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommandCLN(CreateElementRequest req) {
+ public InterfaceCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InterfaceCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InterfaceCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interface_3110(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCN.java index bfd650f9afd..46a93ee3584 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/InterfaceCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InterfaceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InterfaceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public InterfaceCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public InterfaceCreateCommandCN(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 InterfaceCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new InterfaceCreateCommandCN(req, eObject);
+ public static InterfaceCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InterfaceCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public InterfaceCreateCommandCN(CreateElementRequest req) {
+ public InterfaceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InterfaceCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InterfaceCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interface newElement = UMLFactory.eINSTANCE.createInterface();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Interface_3087(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommand.java index a0e29dcc550..77cb5aac704 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class IntervalConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class IntervalConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public IntervalConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public IntervalConstraintCreateCommand(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 IntervalConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new IntervalConstraintCreateCommand(req, eObject);
+ public static IntervalConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new IntervalConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public IntervalConstraintCreateCommand(CreateElementRequest req) {
+ public IntervalConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,11 +94,9 @@ public class IntervalConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getIntervalConstraint());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,19 @@ public class IntervalConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
IntervalConstraint newElement = UMLFactory.eINSTANCE.createIntervalConstraint();
- 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_IntervalConstraint_2112(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommandCN.java index 88fb20d5bb2..af5ed29ff2b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalConstraintCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.IntervalConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class IntervalConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class IntervalConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public IntervalConstraintCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public IntervalConstraintCreateCommandCN(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 IntervalConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new IntervalConstraintCreateCommandCN(req, eObject);
+ public static IntervalConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new IntervalConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public IntervalConstraintCreateCommandCN(CreateElementRequest req) {
+ public IntervalConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class IntervalConstraintCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getIntervalConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class IntervalConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
IntervalConstraint newElement = UMLFactory.eINSTANCE.createIntervalConstraint();
- 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_IntervalConstraint_3118(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalCreateCommand.java index a3c3e410844..871b46c400d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/IntervalCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interval;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class IntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class IntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public IntervalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public IntervalCreateCommand(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 IntervalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new IntervalCreateCommand(req, eObject);
+ public static IntervalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new IntervalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public IntervalCreateCommand(CreateElementRequest req) {
+ public IntervalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class IntervalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterval());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class IntervalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interval newElement = UMLFactory.eINSTANCE.createInterval();
- 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_Interval_2107(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralBooleanCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralBooleanCreateCommand.java index f17b10fa85b..313fa76ac05 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralBooleanCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralBooleanCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.LiteralBoolean;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LiteralBooleanCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LiteralBooleanCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LiteralBooleanCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LiteralBooleanCreateCommand(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 LiteralBooleanCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LiteralBooleanCreateCommand(req, eObject);
+ public static LiteralBooleanCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LiteralBooleanCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LiteralBooleanCreateCommand(CreateElementRequest req) {
+ public LiteralBooleanCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class LiteralBooleanCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLiteralBoolean());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class LiteralBooleanCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LiteralBoolean newElement = UMLFactory.eINSTANCE.createLiteralBoolean();
- 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_LiteralBoolean_2095(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralIntegerCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralIntegerCreateCommand.java index d49441cd35a..929b9a88726 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralIntegerCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralIntegerCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.LiteralInteger;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LiteralIntegerCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LiteralIntegerCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LiteralIntegerCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LiteralIntegerCreateCommand(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 LiteralIntegerCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LiteralIntegerCreateCommand(req, eObject);
+ public static LiteralIntegerCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LiteralIntegerCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LiteralIntegerCreateCommand(CreateElementRequest req) {
+ public LiteralIntegerCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class LiteralIntegerCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLiteralInteger());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class LiteralIntegerCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LiteralInteger newElement = UMLFactory.eINSTANCE.createLiteralInteger();
- 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_LiteralInteger_2096(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralNullCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralNullCreateCommand.java index d73c5467b93..cf2032c9b7c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralNullCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralNullCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.LiteralNull;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LiteralNullCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LiteralNullCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LiteralNullCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LiteralNullCreateCommand(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 LiteralNullCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LiteralNullCreateCommand(req, eObject);
+ public static LiteralNullCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LiteralNullCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LiteralNullCreateCommand(CreateElementRequest req) {
+ public LiteralNullCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class LiteralNullCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLiteralNull());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class LiteralNullCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LiteralNull newElement = UMLFactory.eINSTANCE.createLiteralNull();
- 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_LiteralNull_2097(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralStringCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralStringCreateCommand.java index 8c431acdbe0..8ec887d195e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralStringCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralStringCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.LiteralString;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LiteralStringCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LiteralStringCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LiteralStringCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LiteralStringCreateCommand(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 LiteralStringCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LiteralStringCreateCommand(req, eObject);
+ public static LiteralStringCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LiteralStringCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LiteralStringCreateCommand(CreateElementRequest req) {
+ public LiteralStringCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class LiteralStringCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLiteralString());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class LiteralStringCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LiteralString newElement = UMLFactory.eINSTANCE.createLiteralString();
- 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_LiteralString_2098(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralUnlimitedNaturalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralUnlimitedNaturalCreateCommand.java index 3122af0dcbe..635dc70730e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralUnlimitedNaturalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/LiteralUnlimitedNaturalCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LiteralUnlimitedNaturalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LiteralUnlimitedNaturalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LiteralUnlimitedNaturalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LiteralUnlimitedNaturalCreateCommand(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 LiteralUnlimitedNaturalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LiteralUnlimitedNaturalCreateCommand(req, eObject);
+ public static LiteralUnlimitedNaturalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LiteralUnlimitedNaturalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LiteralUnlimitedNaturalCreateCommand(CreateElementRequest req) {
+ public LiteralUnlimitedNaturalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class LiteralUnlimitedNaturalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLiteralUnlimitedNatural());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class LiteralUnlimitedNaturalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LiteralUnlimitedNatural newElement = UMLFactory.eINSTANCE.createLiteralUnlimitedNatural();
- 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_LiteralUnlimitedNatural_2099(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommand.java index 4e36ffd85b1..0539351a7cb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class NodeCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class NodeCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NodeCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NodeCompositeCreateCommand(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 NodeCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NodeCompositeCreateCommand(req, eObject);
+ public static NodeCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NodeCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NodeCompositeCreateCommand(CreateElementRequest req) {
+ public NodeCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class NodeCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class NodeCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Node newElement = UMLFactory.eINSTANCE.createNode();
- 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_Node_2072(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommandCN.java index 5a731d17284..cd0db0a18de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/NodeCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class NodeCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class NodeCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public NodeCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NodeCompositeCreateCommandCN(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 NodeCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NodeCompositeCreateCommandCN(req, eObject);
+ public static NodeCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NodeCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NodeCompositeCreateCommandCN(CreateElementRequest req) {
+ public NodeCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class NodeCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class NodeCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Node newElement = UMLFactory.eINSTANCE.createNode();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Node_3084(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommand.java index 3c5ad477e1e..50617463e4f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OpaqueBehaviorCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OpaqueBehaviorCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OpaqueBehaviorCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OpaqueBehaviorCompositeCreateCommand(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 OpaqueBehaviorCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OpaqueBehaviorCompositeCreateCommand(req, eObject);
+ public static OpaqueBehaviorCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OpaqueBehaviorCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OpaqueBehaviorCompositeCreateCommand(CreateElementRequest req) {
+ public OpaqueBehaviorCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class OpaqueBehaviorCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOpaqueBehavior());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class OpaqueBehaviorCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OpaqueBehavior newElement = UMLFactory.eINSTANCE.createOpaqueBehavior();
- 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_OpaqueBehavior_2065(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommandCN.java index 56c8e6fa777..de9a7ac5663 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OpaqueBehaviorCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OpaqueBehaviorCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public OpaqueBehaviorCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public OpaqueBehaviorCompositeCreateCommandCN(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 OpaqueBehaviorCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new OpaqueBehaviorCompositeCreateCommandCN(req, eObject);
+ public static OpaqueBehaviorCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OpaqueBehaviorCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public OpaqueBehaviorCompositeCreateCommandCN(CreateElementRequest req) {
+ public OpaqueBehaviorCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class OpaqueBehaviorCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOpaqueBehavior());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class OpaqueBehaviorCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OpaqueBehavior newElement = UMLFactory.eINSTANCE.createOpaqueBehavior();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OpaqueBehavior_3077(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCreateCommandCLN.java index 20db17aed51..34df0cd47fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueBehaviorCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OpaqueBehaviorCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OpaqueBehaviorCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public OpaqueBehaviorCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public OpaqueBehaviorCreateCommandCLN(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 OpaqueBehaviorCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new OpaqueBehaviorCreateCommandCLN(req, eObject);
+ public static OpaqueBehaviorCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OpaqueBehaviorCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public OpaqueBehaviorCreateCommandCLN(CreateElementRequest req) {
+ public OpaqueBehaviorCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class OpaqueBehaviorCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOpaqueBehavior());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class OpaqueBehaviorCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OpaqueBehavior newElement = UMLFactory.eINSTANCE.createOpaqueBehavior();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_OpaqueBehavior_3108(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueExpressionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueExpressionCreateCommand.java index 3376e239c05..ad70071dc53 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueExpressionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OpaqueExpressionCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.OpaqueExpression;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OpaqueExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OpaqueExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public OpaqueExpressionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public OpaqueExpressionCreateCommand(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 OpaqueExpressionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new OpaqueExpressionCreateCommand(req, eObject);
+ public static OpaqueExpressionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OpaqueExpressionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public OpaqueExpressionCreateCommand(CreateElementRequest req) {
+ public OpaqueExpressionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class OpaqueExpressionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOpaqueExpression());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class OpaqueExpressionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
OpaqueExpression newElement = UMLFactory.eINSTANCE.createOpaqueExpression();
- 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_OpaqueExpression_2101(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OperationCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OperationCreateCommandCLN.java index 08abf319e99..3ad382d35ad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OperationCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/OperationCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class OperationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class OperationCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public OperationCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public OperationCreateCommandCLN(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 OperationCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new OperationCreateCommandCLN(req, eObject);
+ public static OperationCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OperationCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public OperationCreateCommandCLN(CreateElementRequest req) {
+ public OperationCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class OperationCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class OperationCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3102(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ParameterCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ParameterCreateCommand.java index fff003a66a3..d7af577d38a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ParameterCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ParameterCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ParameterCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,7 +93,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();
}
/**
@@ -96,8 +103,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_3088(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PortCreateCommand.java index 6fd38fb5906..07e372c0bae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PortCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PortCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PortCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PortCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PortCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PortCreateCommand(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 PortCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PortCreateCommand(req, eObject);
+ public static PortCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PortCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PortCreateCommand(CreateElementRequest req) {
+ public PortCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PortCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPort());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PortCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Port newElement = UMLFactory.eINSTANCE.createPort();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Port_3069(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommand.java index 2eb008b6097..70dbecf2af3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommand(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 PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommand(req, eObject);
+ public static PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- 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_PrimitiveType_2066(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCLN.java index 3ecc0443fbc..2a2403fb50c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PrimitiveTypeCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PrimitiveTypeCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommandCLN(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 PrimitiveTypeCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommandCLN(req, eObject);
+ public static PrimitiveTypeCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommandCLN(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PrimitiveTypeCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PrimitiveTypeCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_PrimitiveType_3112(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCN.java index 5b1229f36df..ab34b3bf0b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PrimitiveTypeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommandCN(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 PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommandCN(req, eObject);
+ public static PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_PrimitiveType_3078(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyCreateCommandCLN.java index 425c4c5ad43..d77baccbe11 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PropertyCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PropertyCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public PropertyCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public PropertyCreateCommandCLN(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 PropertyCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new PropertyCreateCommandCLN(req, eObject);
+ public static PropertyCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyCreateCommandCLN(CreateElementRequest req) {
+ public PropertyCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PropertyCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PropertyCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3101(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyPartCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyPartCreateCommandCN.java index a369a6c3c5c..0f4bcab9faf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyPartCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/PropertyPartCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PropertyPartCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PropertyPartCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PropertyPartCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PropertyPartCreateCommandCN(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 PropertyPartCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PropertyPartCreateCommandCN(req, eObject);
+ public static PropertyPartCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PropertyPartCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PropertyPartCreateCommandCN(CreateElementRequest req) {
+ public PropertyPartCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PropertyPartCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PropertyPartCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3070(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommand.java index 72fcef5ed39..2e103079c3e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.ProtocolStateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ProtocolStateMachineCompositeCreateCommand extends EditElementComma /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ProtocolStateMachineCompositeCreateCommand extends EditElementComma /**
* @generated
*/
- public ProtocolStateMachineCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ProtocolStateMachineCompositeCreateCommand(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 ProtocolStateMachineCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ProtocolStateMachineCompositeCreateCommand(req, eObject);
+ public static ProtocolStateMachineCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ProtocolStateMachineCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ProtocolStateMachineCompositeCreateCommand(CreateElementRequest req) {
+ public ProtocolStateMachineCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class ProtocolStateMachineCompositeCreateCommand extends EditElementComma * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProtocolStateMachine());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class ProtocolStateMachineCompositeCreateCommand extends EditElementComma */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ProtocolStateMachine newElement = UMLFactory.eINSTANCE.createProtocolStateMachine();
- 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_ProtocolStateMachine_2062(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommandCN.java index a174d2a0da7..d92a7605bfc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.ProtocolStateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ProtocolStateMachineCompositeCreateCommandCN extends EditElementCom /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ProtocolStateMachineCompositeCreateCommandCN extends EditElementCom /**
* @generated
*/
- public ProtocolStateMachineCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ProtocolStateMachineCompositeCreateCommandCN(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 ProtocolStateMachineCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ProtocolStateMachineCompositeCreateCommandCN(req, eObject);
+ public static ProtocolStateMachineCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ProtocolStateMachineCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ProtocolStateMachineCompositeCreateCommandCN(CreateElementRequest req) {
+ public ProtocolStateMachineCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ProtocolStateMachineCompositeCreateCommandCN extends EditElementCom * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProtocolStateMachine());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ProtocolStateMachineCompositeCreateCommandCN extends EditElementCom */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ProtocolStateMachine newElement = UMLFactory.eINSTANCE.createProtocolStateMachine();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ProtocolStateMachine_3074(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCreateCommandCLN.java index d2a12b15622..af80ab39dbd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ProtocolStateMachineCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.ProtocolStateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ProtocolStateMachineCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ProtocolStateMachineCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public ProtocolStateMachineCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public ProtocolStateMachineCreateCommandCLN(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 ProtocolStateMachineCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new ProtocolStateMachineCreateCommandCLN(req, eObject);
+ public static ProtocolStateMachineCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ProtocolStateMachineCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public ProtocolStateMachineCreateCommandCLN(CreateElementRequest req) {
+ public ProtocolStateMachineCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ProtocolStateMachineCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProtocolStateMachine());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ProtocolStateMachineCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ProtocolStateMachine newElement = UMLFactory.eINSTANCE.createProtocolStateMachine();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ProtocolStateMachine_3105(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ReceptionCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ReceptionCreateCommandCLN.java index 6abbf90f7c2..8fb2ad6c263 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ReceptionCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/ReceptionCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Reception;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ReceptionCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ReceptionCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public ReceptionCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public ReceptionCreateCommandCLN(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 ReceptionCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new ReceptionCreateCommandCLN(req, eObject);
+ public static ReceptionCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ReceptionCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public ReceptionCreateCommandCLN(CreateElementRequest req) {
+ public ReceptionCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ReceptionCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getReception());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ReceptionCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Reception newElement = UMLFactory.eINSTANCE.createReception();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedReceptions().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedReceptions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Reception_3100(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommand.java index 63e6cc89477..8cb9ec7f8c9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class SignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class SignalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public SignalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SignalCreateCommand(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 SignalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SignalCreateCommand(req, eObject);
+ public static SignalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SignalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SignalCreateCommand(CreateElementRequest req) {
+ public SignalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class SignalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class SignalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- 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_Signal_2081(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommandCN.java index 67613c9e5d4..cea89662812 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class SignalCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class SignalCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public SignalCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public SignalCreateCommandCN(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 SignalCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new SignalCreateCommandCN(req, eObject);
+ public static SignalCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SignalCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public SignalCreateCommandCN(CreateElementRequest req) {
+ public SignalCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class SignalCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignal());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class SignalCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Signal newElement = UMLFactory.eINSTANCE.createSignal();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Signal_3095(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalEventCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalEventCreateCommand.java index 3aa7b8f6a35..1ba03433ffa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalEventCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/SignalEventCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.SignalEvent;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class SignalEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class SignalEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- public SignalEventCreateCommand(CreateElementRequest req, EObject eObject) {
+ public SignalEventCreateCommand(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 SignalEventCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new SignalEventCreateCommand(req, eObject);
+ public static SignalEventCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SignalEventCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public SignalEventCreateCommand(CreateElementRequest req) {
+ public SignalEventCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class SignalEventCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getSignalEvent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class SignalEventCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SignalEvent newElement = UMLFactory.eINSTANCE.createSignalEvent();
- 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_SignalEvent_2083(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommand.java index a41bedaa913..f75401252c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StateMachineCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StateMachineCompositeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public StateMachineCompositeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StateMachineCompositeCreateCommand(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 StateMachineCompositeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateMachineCompositeCreateCommand(req, eObject);
+ public static StateMachineCompositeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateMachineCompositeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StateMachineCompositeCreateCommand(CreateElementRequest req) {
+ public StateMachineCompositeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class StateMachineCompositeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateMachine());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class StateMachineCompositeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StateMachine newElement = UMLFactory.eINSTANCE.createStateMachine();
- 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_StateMachine_2063(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommandCN.java index 826e91753e3..0b11a90217f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCompositeCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StateMachineCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StateMachineCompositeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public StateMachineCompositeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public StateMachineCompositeCreateCommandCN(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 StateMachineCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new StateMachineCompositeCreateCommandCN(req, eObject);
+ public static StateMachineCompositeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateMachineCompositeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public StateMachineCompositeCreateCommandCN(CreateElementRequest req) {
+ public StateMachineCompositeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class StateMachineCompositeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateMachine());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class StateMachineCompositeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StateMachine newElement = UMLFactory.eINSTANCE.createStateMachine();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_StateMachine_3075(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCreateCommandCLN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCreateCommandCLN.java index 8e92843c3b6..c7b7609bf20 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCreateCommandCLN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StateMachineCreateCommandCLN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StateMachineCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StateMachineCreateCommandCLN extends EditElementCommand { /**
* @generated
*/
- public StateMachineCreateCommandCLN(CreateElementRequest req, EObject eObject) {
+ public StateMachineCreateCommandCLN(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 StateMachineCreateCommandCLN create(CreateElementRequest req, EObject eObject) {
- return new StateMachineCreateCommandCLN(req, eObject);
+ public static StateMachineCreateCommandCLN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateMachineCreateCommandCLN(req, eObject, diagram);
}
/**
* @generated
*/
- public StateMachineCreateCommandCLN(CreateElementRequest req) {
+ public StateMachineCreateCommandCLN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class StateMachineCreateCommandCLN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateMachine());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class StateMachineCreateCommandCLN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StateMachine newElement = UMLFactory.eINSTANCE.createStateMachine();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_StateMachine_3106(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StringExpressionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StringExpressionCreateCommand.java index 8901b2bbed9..d1d3af68ea9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StringExpressionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/StringExpressionCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StringExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StringExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public StringExpressionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StringExpressionCreateCommand(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 StringExpressionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StringExpressionCreateCommand(req, eObject);
+ public static StringExpressionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StringExpressionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StringExpressionCreateCommand(CreateElementRequest req) {
+ public StringExpressionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class StringExpressionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStringExpression());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class StringExpressionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StringExpression newElement = UMLFactory.eINSTANCE.createStringExpression();
- 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_StringExpression_2100(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommand.java index 5f060233509..d33724ea7f9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommand.java @@ -24,12 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeConstraintCreateCommand(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 TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeConstraintCreateCommand(req, eObject);
+ public static TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintCreateCommand(CreateElementRequest req) {
+ public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,11 +94,9 @@ public class TimeConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
@@ -101,8 +104,19 @@ public class TimeConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- 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_TimeConstraint_2111(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommandCN.java index cbab582a307..6e3526e11be 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeConstraintCreateCommandCN.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public TimeConstraintCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public TimeConstraintCreateCommandCN(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 TimeConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new TimeConstraintCreateCommandCN(req, eObject);
+ public static TimeConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintCreateCommandCN(CreateElementRequest req) {
+ public TimeConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class TimeConstraintCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class TimeConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- 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_TimeConstraint_3117(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeEventCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeEventCreateCommand.java index ca87f264fab..a5bb77b7944 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeEventCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeEventCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeEvent;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeEventCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeEventCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeEventCreateCommand(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 TimeEventCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeEventCreateCommand(req, eObject);
+ public static TimeEventCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeEventCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeEventCreateCommand(CreateElementRequest req) {
+ public TimeEventCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class TimeEventCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeEvent());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class TimeEventCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeEvent newElement = UMLFactory.eINSTANCE.createTimeEvent();
- 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_TimeEvent_2089(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeExpressionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeExpressionCreateCommand.java index 5769dd9380e..dad6196f95a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeExpressionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeExpressionCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeExpression;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeExpressionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeExpressionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeExpressionCreateCommand(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 TimeExpressionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeExpressionCreateCommand(req, eObject);
+ public static TimeExpressionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeExpressionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeExpressionCreateCommand(CreateElementRequest req) {
+ public TimeExpressionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class TimeExpressionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeExpression());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class TimeExpressionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeExpression newElement = UMLFactory.eINSTANCE.createTimeExpression();
- 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_TimeExpression_2102(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeIntervalCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeIntervalCreateCommand.java index 5c9bc6b6079..c5e3d803e79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeIntervalCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeIntervalCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeInterval;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeIntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeIntervalCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeIntervalCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeIntervalCreateCommand(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 TimeIntervalCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeIntervalCreateCommand(req, eObject);
+ public static TimeIntervalCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeIntervalCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeIntervalCreateCommand(CreateElementRequest req) {
+ public TimeIntervalCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class TimeIntervalCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeInterval());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class TimeIntervalCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeInterval newElement = UMLFactory.eINSTANCE.createTimeInterval();
- 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_TimeInterval_2105(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeObservationCreateCommand.java index 130a2039ba6..fe0db2dad06 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/TimeObservationCreateCommand.java @@ -24,11 +24,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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeObservationCreateCommand(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 TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeObservationCreateCommand(req, eObject);
+ public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req) {
+ public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class TimeObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class TimeObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
- 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_TimeObservation_2094(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommand.java index c4c0ee285d8..4924745731d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommand.java @@ -24,10 +24,14 @@ 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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseCreateCommand extends EditElementCommand { /**
* @generated
*/
- public UseCaseCreateCommand(CreateElementRequest req, EObject eObject) {
+ public UseCaseCreateCommand(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 UseCaseCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new UseCaseCreateCommand(req, eObject);
+ public static UseCaseCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseCreateCommand(CreateElementRequest req) {
+ public UseCaseCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,11 +93,9 @@ public class UseCaseCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -100,8 +103,19 @@ public class UseCaseCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- 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_UseCase_2082(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommandCN.java index 13f1494e8a3..dcc78a32f1d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/commands/UseCaseCreateCommandCN.java @@ -24,10 +24,14 @@ 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.composite.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public UseCaseCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public UseCaseCreateCommandCN(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 UseCaseCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new UseCaseCreateCommandCN(req, eObject);
+ public static UseCaseCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseCreateCommandCN(CreateElementRequest req) {
+ public UseCaseCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class UseCaseCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class UseCaseCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_UseCase_3096(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicy.java index 026e96f360e..be06f34c677 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class ActivityCompositeCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicyCN.java index d301e557cd3..608854ef388 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class ActivityCompositeCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicy.java index a8794276a16..2c534e76f8e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class ActivityCompositeItemSemanticEditPolicy extends UMLBaseItemSemantic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicyCN.java index 5beb8b80879..b888b8c3053 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ActivityCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class ActivityCompositeItemSemanticEditPolicyCN extends UMLBaseItemSemant if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicy.java index 83a075e0424..b89b86af4e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ClassCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicyCN.java index 8e63c223a24..9777cbaf88b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ClassCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseIt if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicy.java index 84f85257687..1e25451aefe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ClassCompositeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicyCN.java index 5264bb75844..f50a9f262ec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ClassCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ClassCompositeItemSemanticEditPolicyCN extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java index 2181a52a1e9..fd77511fd00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationRoleCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationUseCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentCreateCommandCN;
@@ -65,55 +66,55 @@ public class CollaborationCompositeCompartmentItemSemanticEditPolicy extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectableElement_3115 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationRoleCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationRoleCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicyCN.java index 1da2b1bc431..696e4bc7081 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CollaborationCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationRoleCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationUseCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentCreateCommandCN;
@@ -65,55 +66,55 @@ public class CollaborationCompositeCompartmentItemSemanticEditPolicyCN extends U if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectableElement_3115 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationRoleCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationRoleCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java index a8b1033a36f..84cf77c05ec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java index b97a51a6daf..656bd39dfb8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ComponentCompositeCompartmentItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicy.java index ced03e067ae..fc65cab037f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ComponentCompositeItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicyCN.java index 76262476a80..b06e1878cdc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ComponentCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ComponentCompositeItemSemanticEditPolicyCN extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CompositeStructureDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CompositeStructureDiagramItemSemanticEditPolicy.java index f2fa30d1d3f..29ffc138807 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CompositeStructureDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/CompositeStructureDiagramItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommand;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommand;
@@ -110,295 +111,295 @@ public class CompositeStructureDiagramItemSemanticEditPolicy extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommand(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_2061 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommand(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_2062 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommand(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_2063 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommand(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_2064 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommand(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_2065 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommand(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_2069 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommand(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_2070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommand(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_2071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommand(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_2072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommand(req));
+ return getGEFWrapper(new NodeCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_2073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommand(req));
+ return getGEFWrapper(new ClassCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_2075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommand(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_2076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommand(req));
+ return getGEFWrapper(new InterfaceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_2066 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_2067 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommand(req));
+ return getGEFWrapper(new EnumerationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_2068 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommand(req));
+ return getGEFWrapper(new DataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_2077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommand(req));
+ return getGEFWrapper(new ActorCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_2078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommand(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_2079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommand(req));
+ return getGEFWrapper(new ArtifactCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_2080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommand(req));
+ return getGEFWrapper(new InformationItemCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_2081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommand(req));
+ return getGEFWrapper(new SignalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_2082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommand(req));
+ return getGEFWrapper(new UseCaseCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.SignalEvent_2083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalEventCreateCommand(req));
+ return getGEFWrapper(new SignalEventCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CallEvent_2084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CallEventCreateCommand(req));
+ return getGEFWrapper(new CallEventCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.AnyReceiveEvent_2085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AnyReceiveEventCreateCommand(req));
+ return getGEFWrapper(new AnyReceiveEventCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ChangeEvent_2088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ChangeEventCreateCommand(req));
+ return getGEFWrapper(new ChangeEventCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeEvent_2089 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeEventCreateCommand(req));
+ return getGEFWrapper(new TimeEventCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_2093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommand(req));
+ return getGEFWrapper(new DurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_2094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.LiteralBoolean_2095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LiteralBooleanCreateCommand(req));
+ return getGEFWrapper(new LiteralBooleanCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.LiteralInteger_2096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LiteralIntegerCreateCommand(req));
+ return getGEFWrapper(new LiteralIntegerCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.LiteralNull_2097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LiteralNullCreateCommand(req));
+ return getGEFWrapper(new LiteralNullCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.LiteralString_2098 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LiteralStringCreateCommand(req));
+ return getGEFWrapper(new LiteralStringCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.LiteralUnlimitedNatural_2099 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LiteralUnlimitedNaturalCreateCommand(req));
+ return getGEFWrapper(new LiteralUnlimitedNaturalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StringExpression_2100 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StringExpressionCreateCommand(req));
+ return getGEFWrapper(new StringExpressionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueExpression_2101 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueExpressionCreateCommand(req));
+ return getGEFWrapper(new OpaqueExpressionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeExpression_2102 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeExpressionCreateCommand(req));
+ return getGEFWrapper(new TimeExpressionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Expression_2103 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExpressionCreateCommand(req));
+ return getGEFWrapper(new ExpressionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Duration_2104 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationCreateCommand(req));
+ return getGEFWrapper(new DurationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeInterval_2105 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeIntervalCreateCommand(req));
+ return getGEFWrapper(new TimeIntervalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationInterval_2106 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationIntervalCreateCommand(req));
+ return getGEFWrapper(new DurationIntervalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interval_2107 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalCreateCommand(req));
+ return getGEFWrapper(new IntervalCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InstanceValue_2108 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InstanceValueCreateCommand(req));
+ return getGEFWrapper(new InstanceValueCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_2109 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_2110 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommand(req));
+ return getGEFWrapper(new DurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_2111 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ return getGEFWrapper(new TimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_2112 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommand(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_2113 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommand(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_2114 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java index 8d63a213af1..d1f22ab370d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.PropertyCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyCreateCommandCLN(req));
+ return getGEFWrapper(new PropertyCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java index fb96bc0bd80..2759304b7f1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.PropertyCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyCreateCommandCLN(req));
+ return getGEFWrapper(new PropertyCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java index 0ce5ef1628a..244baa8a10a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.OperationCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationCreateCommandCLN(req));
+ return getGEFWrapper(new OperationCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java index 47c0e91fe4d..fd9d722e151 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.OperationCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OperationCreateCommandCLN(req));
+ return getGEFWrapper(new OperationCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java index 40a31add7ac..6091152e30c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class DeviceCompositeCompartmentItemSemanticEditPolicy extends UMLBaseIte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java index bba2d990a5d..eec9ac6fa4f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class DeviceCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicy.java index c1b28d4d482..1fdf0386131 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class DeviceCompositeItemSemanticEditPolicy extends UMLBaseItemSemanticEd if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicyCN.java index 72fb4d39b5d..7275db0d5c5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/DeviceCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class DeviceCompositeItemSemanticEditPolicyCN extends UMLBaseItemSemantic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java index ec9e254eb07..7a23d047714 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.EnumerationLiteralCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy exte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java index 6c00605d23a..0a50eeac6c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.EnumerationLiteralCreateCommandCLN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN ex if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicy.java index 42a6fac952d..4128bcd7645 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class EnumerationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicyCN.java index 323f87f7610..10c69fc493c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/EnumerationItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class EnumerationItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdit if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommandCLN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java index afe32f672d4..b8850b47de2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy exte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java index a709972685b..4dd1db469b7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN ex if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicy.java index 6c7bc4b79dc..87bddf7191d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ExecutionEnvironmentCompositeItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicyCN.java index 844caa67210..85839275289 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ExecutionEnvironmentCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class ExecutionEnvironmentCompositeItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicy.java index 28abb6567f3..2e94033eaed 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class FunctionBehaviorCompositeCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java index e889cd8057a..4290cadc41f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class FunctionBehaviorCompositeCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicy.java index 4c56c73cb5d..23b8ca62434 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class FunctionBehaviorCompositeItemSemanticEditPolicy extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicyCN.java index 27df93ef93b..580f3d8b458 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/FunctionBehaviorCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class FunctionBehaviorCompositeItemSemanticEditPolicyCN extends UMLBaseIt if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicy.java index bdc2cf8f015..a20d08b88b4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class InteractionCompositeCompartmentItemSemanticEditPolicy extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicyCN.java index dbd08a294de..2a7f4b22637 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class InteractionCompositeCompartmentItemSemanticEditPolicyCN extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicy.java index c93e5034cac..e63bfa4bd0f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class InteractionCompositeItemSemanticEditPolicy extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicyCN.java index f3a7fcaa29f..72f6991507a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/InteractionCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class InteractionCompositeItemSemanticEditPolicyCN extends UMLBaseItemSem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java index 189c8a36dc0..5abe5ac1f26 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class NodeCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemS if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java index aefb57eaab7..58a94d40471 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -86,181 +87,181 @@ public class NodeCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseIte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicy.java index cd94a926f4e..95a5a7496d5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class NodeCompositeItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicycN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicycN.java index 4569449faed..61509fb8a85 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicycN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/NodeCompositeItemSemanticEditPolicycN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -107,7 +108,7 @@ public class NodeCompositeItemSemanticEditPolicycN extends UMLBaseItemSemanticEd if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicy.java index 5c83576bfdb..822be364270 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicy extends UM if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java index b7adda70cd6..ae93fc36a55 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class OpaqueBehaviorCompositeCompartmentItemSemanticEditPolicyCN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicy.java index 97289837307..6c4c404ad38 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class OpaqueBehaviorCompositeItemSemanticEditPolicy extends UMLBaseItemSe if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicyCN.java index d447aeb534c..63300446abc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/OpaqueBehaviorCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class OpaqueBehaviorCompositeItemSemanticEditPolicyCN extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java index 1805f32551f..45b66a7d1de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.PropertyPartCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes;
@@ -58,13 +59,13 @@ public class PropertyPartCompartmentItemSemanticEditPolicyCN extends UMLBaseItem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartItemSemanticEditPolicyCN.java index 450fb8fa4bf..a390e2f274b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/PropertyPartItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -102,7 +103,7 @@ public class PropertyPartItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicy.java index 9473841fc0b..04457da8851 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicy exte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicyCN.java index f0e34d8fc38..2730d40536b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class ProtocolStateMachineCompositeCompartmentItemSemanticEditPolicyCN ex if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicy.java index cf08fa580ef..4eba53d1ef6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class ProtocolStateMachineCompositeItemSemanticEditPolicy extends UMLBase if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicyCN.java index dd02b7965c5..76d2a316913 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/ProtocolStateMachineCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class ProtocolStateMachineCompositeItemSemanticEditPolicyCN extends UMLBa if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicy.java index 52c4488a248..2147cd75288 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class StateMachineCompositeCompartmentItemSemanticEditPolicy extends UMLB if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicyCN.java index 73d08fd509e..37e487683da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActivityCompositeCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ActorCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ArtifactCreateCommandCN;
@@ -87,187 +88,187 @@ public class StateMachineCompositeCompartmentItemSemanticEditPolicyCN extends UM if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Property_3070 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PropertyPartCreateCommandCN(req));
+ return getGEFWrapper(new PropertyPartCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CollaborationUse_3071 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationUseCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationUseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Activity_3072 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActivityCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ActivityCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interaction_3073 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCompositeCreateCommandCN(req));
+ return getGEFWrapper(new InteractionCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ProtocolStateMachine_3074 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ProtocolStateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateMachine_3075 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req));
+ return getGEFWrapper(new StateMachineCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FunctionBehavior_3076 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new FunctionBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OpaqueBehavior_3077 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req));
+ return getGEFWrapper(new OpaqueBehaviorCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3081 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ComponentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_3082 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCompositeCreateCommandCN(req));
+ return getGEFWrapper(new DeviceCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_3083 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ExecutionEnvironmentCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_3084 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCompositeCreateCommandCN(req));
+ return getGEFWrapper(new NodeCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3085 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassCompositeCreateCommandCN(req));
+ return getGEFWrapper(new ClassCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Collaboration_3086 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req));
+ return getGEFWrapper(new CollaborationCompositeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Interface_3087 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InterfaceCreateCommandCN(req));
+ return getGEFWrapper(new InterfaceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3078 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3079 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3080 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3091 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandCN(req));
+ return getGEFWrapper(new ActorCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DeploymentSpecification_3092 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DeploymentSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_3093 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InformationItem_3094 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InformationItemCreateCommandCN(req));
+ return getGEFWrapper(new InformationItemCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Signal_3095 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SignalCreateCommandCN(req));
+ return getGEFWrapper(new SignalCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3096 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandCN(req));
+ return getGEFWrapper(new UseCaseCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3097 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3116 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3117 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommandCN(req));
+ return getGEFWrapper(new TimeConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.IntervalConstraint_3118 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new IntervalConstraintCreateCommandCN(req));
+ return getGEFWrapper(new IntervalConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionConstraint_3119 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionConstraintCreateCommandCN(req));
+ return getGEFWrapper(new InteractionConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3120 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicy.java index 7ae0a4704a2..94b3101ff5d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class StateMachineCompositeItemSemanticEditPolicy extends UMLBaseItemSema if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicyCN.java index fe73e2f371c..09b94280e14 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/StateMachineCompositeItemSemanticEditPolicyCN.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.AbstractionCreateCommand;
@@ -108,13 +109,13 @@ public class StateMachineCompositeItemSemanticEditPolicyCN extends UMLBaseItemSe if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PortCreateCommand(req));
+ return getGEFWrapper(new PortCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Parameter_3088 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ParameterCreateCommand(req));
+ return getGEFWrapper(new ParameterCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/UMLBaseItemSemanticEditPolicy.java index 34b84403d33..601d58a8752 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -139,15 +139,12 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
@SuppressWarnings("unchecked")
public Command getCommand(Request request) {
- if (request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest) request).getConnectionEditPart()
- .getModel();
- if (view instanceof View) {
- Integer id = new Integer(
- UMLVisualIDRegistry.getVisualID((View) view));
+ if(request instanceof ReconnectRequest) {
+ Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
+ if(view instanceof View) {
+ Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View)view));
request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE,
- (View) view);
+ request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, (View)view);
}
}
return super.getCommand(request);
@@ -160,7 +157,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
protected int getVisualID(IEditCommandRequest request) {
Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ return id instanceof Integer ? ((Integer)id).intValue() : -1;
}
/**
@@ -169,12 +166,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { protected Command getSemanticCommand(IEditCommandRequest request) {
IEditCommandRequest completedRequest = completeRequest(request);
Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest,
- semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(
- semanticCommand, destroyRequest) : null;
+ semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
+ if(completedRequest instanceof DestroyRequest) {
+ DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
+ return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
}
return semanticCommand;
}
@@ -182,35 +177,27 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command addDeleteViewCommand(Command mainCommand,
- DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(
- getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand
- .chain(deleteViewCommand);
+ protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
+ Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
+ return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
}
/**
* @generated
*/
- private Command getEditHelperCommand(IEditCommandRequest request,
- Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand)
- .getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND,
- command);
+ private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
+ if(editPolicyCommand != null) {
+ ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
}
IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE,
- requestContextElementType);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
ICommand command = requestContextElementType.getEditCommand(request);
request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(),
- command.getLabel()).compose(command);
+ if(command != null) {
+ if(!(command instanceof CompositeTransactionalCommand)) {
+ command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
}
return new ICommandProxy(command);
}
@@ -221,38 +208,36 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes
- .getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType
- : myElementType;
+ IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
}
/**
* @generated
*/
protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
+ if(req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest)req);
+ } else if(req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest)req);
+ } else if(req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest)req);
+ } else if(req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest)req);
+ } else if(req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest)req);
+ } else if(req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest)req);
+ } else if(req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest)req);
+ } else if(req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest)req);
+ } else if(req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest)req);
+ } else if(req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest)req);
+ } else if(req instanceof SetRequest) {
+ return getSetCommand((SetRequest)req);
}
return null;
}
@@ -275,32 +260,16 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof IExtendedHintedElementType) {
- IExtendedHintedElementType extendedElementType = (IExtendedHintedElementType) requestElementType;
-
- // try to get a semantic create command from the extended type
- IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandProvider != null) {
- ICommand command = commandProvider.getEditCommand(req);
- if (command != null && command.canExecute()) {
- return new ICommandProxy(command);
- }
- }
- }
-
+ // no more usage of the extended types here.
return null;
}
/**
* @generated
*/
- protected Command getExtendedTypeCreationCommand(
- CreateElementRequest request,
- IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils
- .getCommandProvider(request.getContainer());
- if (provider == null) {
+ protected Command getExtendedTypeCreationCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -311,12 +280,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getExtendedStartCreateRelationshipCommand(
- CreateElementRequest request,
- IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils
- .getCommandProvider(requestElementType);
- if (provider == null) {
+ protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -327,12 +293,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getExtendedCompleteCreateRelationshipCommand(
- CreateElementRequest request,
- IExtendedHintedElementType requestElementType) {
- IElementEditService provider = ElementEditServiceUtils
- .getCommandProvider(requestElementType);
- if (provider == null) {
+ protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
@@ -380,12 +343,11 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
protected Command getMoveCommand(MoveRequest req) {
EObject targetCEObject = req.getTargetContainer();
- if (targetCEObject != null) {
- IElementEditService provider = ElementEditServiceUtils
- .getCommandProvider(targetCEObject);
- if (provider != null) {
+ if(targetCEObject != null) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
+ if(provider != null) {
ICommand moveCommand = provider.getEditCommand(req);
- if (moveCommand != null) {
+ if(moveCommand != null) {
return new ICommandProxy(moveCommand);
}
}
@@ -398,16 +360,14 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getReorientReferenceRelationshipCommand(
- ReorientReferenceRelationshipRequest req) {
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
return UnexecutableCommand.INSTANCE;
}
/**
* @generated
*/
- protected Command getReorientRelationshipCommand(
- ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
return UnexecutableCommand.INSTANCE;
}
@@ -424,7 +384,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ return ((IGraphicalEditPart)getHost()).getEditingDomain();
}
/**
@@ -434,10 +394,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (Iterator it = view.getDiagram().getChildren().iterator(); it
- .hasNext();) {
- View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ for(Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ View nextView = (View)it.next();
+ if(nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
continue;
}
cmd.add(new DeleteCommand(getEditingDomain(), nextView));
@@ -448,11 +407,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
public static LinkConstraints getLinkConstraints() {
- LinkConstraints cached = UMLDiagramEditorPlugin.getInstance()
- .getLinkConstraints();
- if (cached == null) {
- UMLDiagramEditorPlugin.getInstance().setLinkConstraints(
- cached = new LinkConstraints());
+ LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
+ if(cached == null) {
+ UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
}
return cached;
}
@@ -486,10 +443,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateCommentAnnotatedElement_4002(Comment source,
- Element target) {
- if (source != null) {
- if (source.getAnnotatedElements().contains(target)) {
+ public boolean canCreateCommentAnnotatedElement_4002(Comment source, Element target) {
+ if(source != null) {
+ if(source.getAnnotatedElements().contains(target)) {
return false;
}
}
@@ -499,10 +455,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateConstraintConstrainedElement_4003(
- Constraint source, Element target) {
- if (source != null) {
- if (source.getConstrainedElements().contains(target)) {
+ public boolean canCreateConstraintConstrainedElement_4003(Constraint source, Element target) {
+ if(source != null) {
+ if(source.getConstrainedElements().contains(target)) {
return false;
}
}
@@ -512,108 +467,93 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateComponentRealization_4004(Package container,
- NamedElement source, NamedElement target) {
- return canExistComponentRealization_4004(container, null, source,
- target);
+ public boolean canCreateComponentRealization_4004(Package container, NamedElement source, NamedElement target) {
+ return canExistComponentRealization_4004(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateInterfaceRealization_4005(Package container,
- NamedElement source, NamedElement target) {
- return canExistInterfaceRealization_4005(container, null, source,
- target);
+ public boolean canCreateInterfaceRealization_4005(Package container, NamedElement source, NamedElement target) {
+ return canExistInterfaceRealization_4005(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateSubstitution_4011(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateSubstitution_4011(Package container, NamedElement source, NamedElement target) {
return canExistSubstitution_4011(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateRealization_4006(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateRealization_4006(Package container, NamedElement source, NamedElement target) {
return canExistRealization_4006(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateManifestation_4012(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateManifestation_4012(Package container, NamedElement source, NamedElement target) {
return canExistManifestation_4012(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateAbstraction_4007(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateAbstraction_4007(Package container, NamedElement source, NamedElement target) {
return canExistAbstraction_4007(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateUsage_4008(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateUsage_4008(Package container, NamedElement source, NamedElement target) {
return canExistUsage_4008(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateDeployment_4009(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateDeployment_4009(Package container, NamedElement source, NamedElement target) {
return canExistDeployment_4009(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateDependency_4017(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateDependency_4017(Package container, NamedElement source, NamedElement target) {
return canExistDependency_4017(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateDependency_4010(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateDependency_4010(Package container, NamedElement source, NamedElement target) {
return canExistDependency_4010(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateConnector_4013(StructuredClassifier container,
- ConnectorEnd source, ConnectorEnd target) {
+ public boolean canCreateConnector_4013(StructuredClassifier container, ConnectorEnd source, ConnectorEnd target) {
return canExistConnector_4013(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateGeneralization_4015(Classifier container,
- Classifier source, Classifier target) {
+ public boolean canCreateGeneralization_4015(Classifier container, Classifier source, Classifier target) {
return canExistGeneralization_4015(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateTimeObservationEvent_4018(
- TimeObservation source, NamedElement target) {
- if (source != null) {
- if (source.getEvent() != null) {
+ public boolean canCreateTimeObservationEvent_4018(TimeObservation source, NamedElement target) {
+ if(source != null) {
+ if(source.getEvent() != null) {
return false;
}
}
@@ -623,11 +563,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateDurationObservationEvent_4019(
- DurationObservation source, NamedElement target) {
- if (source != null) {
- if (source.getEvents().size() >= 2
- || source.getEvents().contains(target)) {
+ public boolean canCreateDurationObservationEvent_4019(DurationObservation source, NamedElement target) {
+ if(source != null) {
+ if(source.getEvents().size() >= 2 || source.getEvents().contains(target)) {
return false;
}
}
@@ -637,10 +575,9 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateInformationItemRepresented_4020(
- InformationItem source, Classifier target) {
- if (source != null) {
- if (source.getRepresenteds().contains(target)) {
+ public boolean canCreateInformationItemRepresented_4020(InformationItem source, Classifier target) {
+ if(source != null) {
+ if(source.getRepresenteds().contains(target)) {
return false;
}
}
@@ -650,8 +587,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateInformationFlow_4021(Package container,
- NamedElement source, NamedElement target) {
+ public boolean canCreateInformationFlow_4021(Package container, NamedElement source, NamedElement target) {
return canExistInformationFlow_4021(container, null, source, target);
}
@@ -672,119 +608,97 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canExistCommentAnnotatedElement_4002(Comment source,
- Element target) {
+ public boolean canExistCommentAnnotatedElement_4002(Comment source, Element target) {
return true;
}
/**
* @generated
*/
- public boolean canExistConstraintConstrainedElement_4003(
- Constraint source, Element target) {
+ public boolean canExistConstraintConstrainedElement_4003(Constraint source, Element target) {
return true;
}
/**
* @generated
*/
- public boolean canExistComponentRealization_4004(Package container,
- ComponentRealization linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistComponentRealization_4004(Package container, ComponentRealization linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistInterfaceRealization_4005(Package container,
- InterfaceRealization linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistInterfaceRealization_4005(Package container, InterfaceRealization linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistSubstitution_4011(Package container,
- Substitution linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistSubstitution_4011(Package container, Substitution linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistRealization_4006(Package container,
- Realization linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistRealization_4006(Package container, Realization linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistManifestation_4012(Package container,
- Manifestation linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistManifestation_4012(Package container, Manifestation linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistAbstraction_4007(Package container,
- Abstraction linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistAbstraction_4007(Package container, Abstraction linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistUsage_4008(Package container,
- Usage linkInstance, NamedElement source, NamedElement target) {
+ public boolean canExistUsage_4008(Package container, Usage linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistDeployment_4009(Package container,
- Deployment linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistDeployment_4009(Package container, Deployment linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistDependency_4017(Package container,
- Dependency linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistDependency_4017(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
try {
// RoleBinding source constraint
- if ((source != null) && !(source instanceof CollaborationUse)) {
+ if((source != null) && !(source instanceof CollaborationUse)) {
return false;
}
// RoleBinding source has a type
- if ((source != null)
- && (((CollaborationUse) source).getType() == null)) {
+ if((source != null) && (((CollaborationUse)source).getType() == null)) {
return false;
}
// RoleBinding target constraint
- if ((target != null) && !(target instanceof ConnectableElement)) {
+ if((target != null) && !(target instanceof ConnectableElement)) {
return false;
}
// RoleBinding source and target have the same semantic parent
- if ((source != null) && (target != null)
- && (source.getOwner() != target.getOwner())) {
+ if((source != null) && (target != null) && (source.getOwner() != target.getOwner())) {
return false;
}
return true;
} catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Link constraint evaluation error", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
return false;
}
}
@@ -792,64 +706,52 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canExistDependency_4010(Package container,
- Dependency linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistDependency_4010(Package container, Dependency linkInstance, NamedElement source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistConnector_4013(StructuredClassifier container,
- Connector linkInstance, ConnectorEnd source, ConnectorEnd target) {
+ public boolean canExistConnector_4013(StructuredClassifier container, Connector linkInstance, ConnectorEnd source, ConnectorEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistGeneralization_4015(Classifier container,
- Generalization linkInstance, Classifier source,
- Classifier target) {
+ public boolean canExistGeneralization_4015(Classifier container, Generalization linkInstance, Classifier source, Classifier target) {
return true;
}
/**
* @generated
*/
- public boolean canExistTimeObservationEvent_4018(
- TimeObservation source, NamedElement target) {
+ public boolean canExistTimeObservationEvent_4018(TimeObservation source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistDurationObservationEvent_4019(
- DurationObservation source, NamedElement target) {
+ public boolean canExistDurationObservationEvent_4019(DurationObservation source, NamedElement target) {
return true;
}
/**
* @generated
*/
- public boolean canExistInformationItemRepresented_4020(
- InformationItem source, Classifier target) {
+ public boolean canExistInformationItemRepresented_4020(InformationItem source, Classifier target) {
try {
// Represented InformationItem Target
- if (target != null) {
- if (!((target instanceof Class)
- || (target instanceof Interface)
- || (target instanceof InformationItem)
- || (target instanceof Signal) || (target instanceof Component))) {
+ if(target != null) {
+ if(!((target instanceof Class) || (target instanceof Interface) || (target instanceof InformationItem) || (target instanceof Signal) || (target instanceof Component))) {
return false;
}
}
return true;
} catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Link constraint evaluation error", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
return false;
}
}
@@ -857,55 +759,31 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canExistInformationFlow_4021(Package container,
- InformationFlow linkInstance, NamedElement source,
- NamedElement target) {
+ public boolean canExistInformationFlow_4021(Package container, InformationFlow linkInstance, NamedElement source, NamedElement target) {
try {
- // Information Flow source constraint
- if (source != null) {
- if (!((source instanceof Actor) || (source instanceof Node)
- || (source instanceof UseCase)
- || (source instanceof Artifact)
- || (source instanceof Class)
- || (source instanceof Component)
- || (source instanceof Port)
- || (source instanceof Property)
- || (source instanceof Interface)
- || (source instanceof Package)
- || (source instanceof ActivityNode)
- || (source instanceof ActivityPartition) || (source instanceof InstanceSpecification))) {
+ //Information Flow source constraint
+ if(source != null) {
+ if(!((source instanceof Actor) || (source instanceof Node) || (source instanceof UseCase) || (source instanceof Artifact) || (source instanceof Class) || (source instanceof Component) || (source instanceof Port) || (source instanceof Property) || (source instanceof Interface) || (source instanceof Package) || (source instanceof ActivityNode) || (source instanceof ActivityPartition) || (source instanceof InstanceSpecification))) {
return false;
}
- if (source instanceof InstanceSpecification) {
- EList<Classifier> classes = ((InstanceSpecification) source)
- .getClassifiers();
- for (int i = 0; i < classes.size(); i++) {
- if (classes.get(i) instanceof Relationship) {
+ if(source instanceof InstanceSpecification) {
+ EList<Classifier> classes = ((InstanceSpecification)source).getClassifiers();
+ for(int i = 0; i < classes.size(); i++) {
+ if(classes.get(i) instanceof Relationship) {
return false;
}
}
}
}
- // Information Flow target constraint
- if (target != null) {
- if (!((target instanceof Actor) || (target instanceof Node)
- || (target instanceof UseCase)
- || (target instanceof Artifact)
- || (target instanceof Class)
- || (target instanceof Component)
- || (target instanceof Port)
- || (target instanceof Property)
- || (target instanceof Interface)
- || (target instanceof Package)
- || (target instanceof ActivityNode)
- || (target instanceof ActivityPartition) || (target instanceof InstanceSpecification))) {
+ //Information Flow target constraint
+ if(target != null) {
+ if(!((target instanceof Actor) || (target instanceof Node) || (target instanceof UseCase) || (target instanceof Artifact) || (target instanceof Class) || (target instanceof Component) || (target instanceof Port) || (target instanceof Property) || (target instanceof Interface) || (target instanceof Package) || (target instanceof ActivityNode) || (target instanceof ActivityPartition) || (target instanceof InstanceSpecification))) {
return false;
}
- if (target instanceof InstanceSpecification) {
- EList<Classifier> classes = ((InstanceSpecification) target)
- .getClassifiers();
- for (int i = 0; i < classes.size(); i++) {
- if (classes.get(i) instanceof Relationship) {
+ if(target instanceof InstanceSpecification) {
+ EList<Classifier> classes = ((InstanceSpecification)target).getClassifiers();
+ for(int i = 0; i < classes.size(); i++) {
+ if(classes.get(i) instanceof Relationship) {
return false;
}
}
@@ -913,8 +791,7 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { }
return true;
} catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Link constraint evaluation error", e); //$NON-NLS-1$
+ UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLVisualIDRegistry.java index 1a043a81098..8606a98d06b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLVisualIDRegistry.java @@ -95,13 +95,7 @@ public class UMLVisualIDRegistry { * @generated
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return CompositeStructureDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return CompositeStructureDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF index 75ab6bef941..ed78735c02d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF @@ -64,13 +64,12 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties, org.eclipse.emf.ecore.edit,
org.eclipse.emf.validation,
org.eclipse.gef,
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLD
- iagramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment;single
- ton:=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/CreateDeploymentDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/CreateDeploymentDiagramWithNavigationHandler.java deleted file mode 100644 index edce61764ef..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/CreateDeploymentDiagramWithNavigationHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateDeploymentDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateDeploymentDiagramWithNavigationHandler() {
- super(new CreateDeploymentDiagramCommand(), new DeploymentDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/DeploymentDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/DeploymentDiagramCreationCondition.java index f7487318013..2262cb88583 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/DeploymentDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/DeploymentDiagramCreationCondition.java @@ -23,9 +23,6 @@ public class DeploymentDiagramCreationCondition extends PerspectiveContextDepend * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml index 7c65f327469..d029f565858 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml @@ -75,79 +75,6 @@ </command>
</extension>
<extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramCommand">
- <activeWhen>
- <or>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </or>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramCommand"
- icon="icons/obj16/DeploymentDiagram.gif"
- label="Create a new Deployment Diagram"
- style="push"
- tooltip="Create a new Deployment Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramCommand"
- icon="icons/obj16/DeploymentDiagram.gif"
- label="Create a new Deployment Diagram"
- style="push"
- tooltip="Create a new Deployment Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramCommand"
- icon="icons/obj16/DeploymentDiagram.gif"
- label="Create a new Deployment Diagram"
- style="push"
- tooltip="Create a new Deployment Diagram">
- <visibleWhen>
- <reference
- definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
<editorDiagram
actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java index 363e38ddf1b..9221c47b08a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommand.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class ArtifactCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class ArtifactCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ArtifactCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ArtifactCreateCommand(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 ArtifactCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ArtifactCreateCommand(req, eObject);
+ public static ArtifactCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ArtifactCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ArtifactCreateCommand(CreateElementRequest req) {
+ public ArtifactCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class ArtifactCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,30 +83,31 @@ public class ArtifactCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- 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_Artifact_2006(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -120,5 +125,4 @@ public class ArtifactCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java index ddd5abcbb76..f3608f9825b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandACN.java @@ -14,10 +14,14 @@ 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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -27,7 +31,7 @@ public class ArtifactCreateCommandACN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -37,24 +41,25 @@ public class ArtifactCreateCommandACN extends EditElementCommand { /**
* @generated
*/
- public ArtifactCreateCommandACN(CreateElementRequest req, EObject eObject) {
+ public ArtifactCreateCommandACN(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 ArtifactCreateCommandACN create(CreateElementRequest req, EObject eObject) {
- return new ArtifactCreateCommandACN(req, eObject);
+ public static ArtifactCreateCommandACN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ArtifactCreateCommandACN(req, eObject, diagram);
}
/**
* @generated
*/
- public ArtifactCreateCommandACN(CreateElementRequest req) {
+ public ArtifactCreateCommandACN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -63,7 +68,6 @@ public class ArtifactCreateCommandACN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -78,25 +82,31 @@ public class ArtifactCreateCommandACN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- Artifact owner = (Artifact)getElementToEdit();
- owner.getNestedArtifacts().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 {
+ Artifact qualifiedTarget = (Artifact)target;
+ qualifiedTarget.getNestedArtifacts().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Artifact_28(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -114,5 +124,4 @@ public class ArtifactCreateCommandACN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java index 11f3c020e92..07e381f8afc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ArtifactCreateCommandCN.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class ArtifactCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class ArtifactCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ArtifactCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ArtifactCreateCommandCN(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 ArtifactCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ArtifactCreateCommandCN(req, eObject);
+ public static ArtifactCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ArtifactCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ArtifactCreateCommandCN(CreateElementRequest req) {
+ public ArtifactCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class ArtifactCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,25 +83,31 @@ public class ArtifactCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Artifact_25(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -115,5 +125,4 @@ public class ArtifactCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java index c746c50a0bb..43a4898330f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentAnnotatedElementCreateCommand.java @@ -65,12 +65,10 @@ public class CommentAnnotatedElementCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
if(getSource() != null && getTarget() != null) {
getSource().getAnnotatedElements().add(getTarget());
}
return CommandResult.newOKCommandResult();
-
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java index d5e5aad23fb..c242e35bd0d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommand.java @@ -14,12 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -29,7 +33,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -39,24 +43,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;
}
/**
@@ -65,7 +70,6 @@ public class CommentCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -80,30 +84,31 @@ public class CommentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
+ return data.isPermitted();
}
/**
* @generated
*/
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_2001(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -121,5 +126,4 @@ public class CommentCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java index 08cc5a20c06..4709a83bf85 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/CommentCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class CommentCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class CommentCreateCommandCN 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();
}
/**
* @generated
*/
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_54(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class CommentCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java index 3bcc6c5dcaa..f6da5fa7b41 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintConstrainedElementCreateCommand.java @@ -65,12 +65,10 @@ public class ConstraintConstrainedElementCreateCommand extends EditElementComman if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
if(getSource() != null && getTarget() != null) {
getSource().getConstrainedElements().add(getTarget());
}
return CommandResult.newOKCommandResult();
-
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java index 377ed3c42e4..c741d1f670f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommand.java @@ -14,12 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -29,7 +33,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -39,24 +43,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -65,7 +70,6 @@ public class ConstraintCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -80,32 +84,33 @@ public class ConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
-
- 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");
+ }
Namespace childHolder = (Namespace)getElementToEdit();
childHolder.getOwnedRules().add(newElement);
-
ElementInitializers.getInstance().init_Constraint_2005(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -123,5 +128,4 @@ public class ConstraintCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java index 03103cb70f3..0c1dffe607e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ConstraintCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
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
@@ -37,7 +41,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,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;
}
/**
@@ -73,7 +78,6 @@ public class ConstraintCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ 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();
}
/**
* @generated
*/
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_56(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class ConstraintCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java index 8b7176c2472..46c69bc95e0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DefaultNamedElementCreateCommand.java @@ -23,8 +23,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
@@ -34,7 +38,7 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DefaultNamedElementCreateCommand(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 DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DefaultNamedElementCreateCommand(req, eObject);
+ public static DefaultNamedElementCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DefaultNamedElementCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DefaultNamedElementCreateCommand(CreateElementRequest req) {
+ public DefaultNamedElementCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -70,7 +75,6 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -85,16 +89,15 @@ public class DefaultNamedElementCreateCommand 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();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
throw new UnsupportedOperationException("Unimplemented operation (abstract domain element).");
}
@@ -111,5 +114,4 @@ public class DefaultNamedElementCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java index 8397d7f43be..1144b3529e2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyBranchCreateCommand.java @@ -90,7 +90,6 @@ public class DependencyBranchCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
getContainer().getPackagedElements().add(newElement);
newElement.getClients().add(getSource());
@@ -99,7 +98,6 @@ public class DependencyBranchCreateCommand extends EditElementCommand { doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
@@ -163,5 +161,4 @@ public class DependencyBranchCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java index 7e24b33274b..f45a9b2d0e6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyCreateCommand.java @@ -81,7 +81,6 @@ public class DependencyCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
getContainer().getPackagedElements().add(newElement);
newElement.getClients().add(getSource());
@@ -90,7 +89,6 @@ public class DependencyCreateCommand extends EditElementCommand { doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
@@ -154,5 +152,4 @@ public class DependencyCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java index 33273e12592..c7c67c6334f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DependencyNodeCreateCommand.java @@ -23,10 +23,14 @@ 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.Dependency;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DependencyNodeCreateCommand(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 DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DependencyNodeCreateCommand(req, eObject);
+ public static DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DependencyNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req) {
+ public DependencyNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -72,7 +77,6 @@ public class DependencyNodeCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -87,23 +91,30 @@ public class DependencyNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
-
- 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -121,5 +132,4 @@ public class DependencyNodeCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java index 3f7fce14dc7..5470a05c9b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeploymentCreateCommand.java @@ -81,7 +81,6 @@ public class DeploymentCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
Deployment newElement = UMLFactory.eINSTANCE.createDeployment();
getContainer().getDeployments().add(newElement);
newElement.getClients().add(getSource());
@@ -90,7 +89,6 @@ public class DeploymentCreateCommand extends EditElementCommand { doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
@@ -154,5 +152,4 @@ public class DeploymentCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java index 10a66b54d09..daddda9922a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommand.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Device;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class DeviceCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class DeviceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DeviceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DeviceCreateCommand(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 DeviceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DeviceCreateCommand(req, eObject);
+ public static DeviceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeviceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DeviceCreateCommand(CreateElementRequest req) {
+ public DeviceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class DeviceCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,30 +83,31 @@ public class DeviceCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- 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_Device_2003(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -120,5 +125,4 @@ public class DeviceCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java index bc450bb1af0..9d3d053bf98 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/DeviceCreateCommandCN.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Device;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class DeviceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class DeviceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DeviceCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DeviceCreateCommandCN(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 DeviceCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DeviceCreateCommandCN(req, eObject);
+ public static DeviceCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DeviceCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DeviceCreateCommandCN(CreateElementRequest req) {
+ public DeviceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class DeviceCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,25 +83,31 @@ public class DeviceCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- Node owner = (Node)getElementToEdit();
- owner.getNestedNodes().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 {
+ Node qualifiedTarget = (Node)target;
+ qualifiedTarget.getNestedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Device_16(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -115,5 +125,4 @@ public class DeviceCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java index 49996afe0dc..ddce7ec9f61 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommand.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExecutionEnvironment;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class ExecutionEnvironmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class ExecutionEnvironmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ExecutionEnvironmentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExecutionEnvironmentCreateCommand(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 ExecutionEnvironmentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExecutionEnvironmentCreateCommand(req, eObject);
+ public static ExecutionEnvironmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExecutionEnvironmentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExecutionEnvironmentCreateCommand(CreateElementRequest req) {
+ public ExecutionEnvironmentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class ExecutionEnvironmentCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,30 +83,31 @@ public class ExecutionEnvironmentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- 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_ExecutionEnvironment_2002(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -120,5 +125,4 @@ public class ExecutionEnvironmentCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java index 2ea1a2b764f..8758c3ecd18 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ExecutionEnvironmentCreateCommandCN.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExecutionEnvironment;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ExecutionEnvironmentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ExecutionEnvironmentCreateCommandCN(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 ExecutionEnvironmentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ExecutionEnvironmentCreateCommandCN(req, eObject);
+ public static ExecutionEnvironmentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExecutionEnvironmentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ExecutionEnvironmentCreateCommandCN(CreateElementRequest req) {
+ public ExecutionEnvironmentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,25 +83,31 @@ public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- Node owner = (Node)getElementToEdit();
- owner.getNestedNodes().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 {
+ Node qualifiedTarget = (Node)target;
+ qualifiedTarget.getNestedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ExecutionEnvironment_21(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -115,5 +125,4 @@ public class ExecutionEnvironmentCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java index 0e56bee9f85..8596ce26c44 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/GeneralizationCreateCommand.java @@ -79,7 +79,6 @@ public class GeneralizationCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
Generalization newElement = UMLFactory.eINSTANCE.createGeneralization();
getContainer().getGeneralizations().add(newElement);
newElement.setSpecific(getSource());
@@ -87,7 +86,6 @@ public class GeneralizationCreateCommand extends EditElementCommand { doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
@@ -151,5 +149,4 @@ public class GeneralizationCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java index fac32b701e6..023dd9cd103 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ManifestationCreateCommand.java @@ -81,7 +81,6 @@ public class ManifestationCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
Manifestation newElement = UMLFactory.eINSTANCE.createManifestation();
getContainer().getManifestations().add(newElement);
newElement.getClients().add(getSource());
@@ -90,7 +89,6 @@ public class ManifestationCreateCommand extends EditElementCommand { doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
@@ -154,5 +152,4 @@ public class ManifestationCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java index d460d46b64f..d6c77a4f9fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommand.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommand(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 ModelCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommand(req, eObject);
+ public static ModelCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommand(CreateElementRequest req) {
+ public ModelCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class ModelCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class ModelCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Model newElement = UMLFactory.eINSTANCE.createModel();
-
- 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_Model_2010(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class ModelCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java index bd678a8710b..b20cec0ddb5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/ModelCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandCN(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 ModelCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandCN(req, eObject);
+ public static ModelCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req) {
+ public ModelCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class ModelCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class ModelCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Model newElement = UMLFactory.eINSTANCE.createModel();
-
- 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_Model_49(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class ModelCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java index fa9e9852fd0..67b4acfd2ef 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedArtifactNodeCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Artifact;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedArtifactNodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedArtifactNodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public NestedArtifactNodeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NestedArtifactNodeCreateCommandCN(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 NestedArtifactNodeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NestedArtifactNodeCreateCommandCN(req, eObject);
+ public static NestedArtifactNodeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedArtifactNodeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedArtifactNodeCreateCommandCN(CreateElementRequest req) {
+ public NestedArtifactNodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class NestedArtifactNodeCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class NestedArtifactNodeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getArtifact());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Artifact newElement = UMLFactory.eINSTANCE.createArtifact();
-
- 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_Artifact_40(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class NestedArtifactNodeCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java index 0168401cb7a..1a95cc92d00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedDeviceCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Device;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedDeviceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedDeviceCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public NestedDeviceCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NestedDeviceCreateCommandCN(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 NestedDeviceCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NestedDeviceCreateCommandCN(req, eObject);
+ public static NestedDeviceCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedDeviceCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedDeviceCreateCommandCN(CreateElementRequest req) {
+ public NestedDeviceCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class NestedDeviceCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class NestedDeviceCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDevice());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Device newElement = UMLFactory.eINSTANCE.createDevice();
-
- 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_Device_44(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class NestedDeviceCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java index ffd2d20f3e3..19c2af5034e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedExecutionEnvironmentCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExecutionEnvironment;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedExecutionEnvironmentCreateCommandCN extends EditElementComman /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedExecutionEnvironmentCreateCommandCN extends EditElementComman /**
* @generated
*/
- public NestedExecutionEnvironmentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NestedExecutionEnvironmentCreateCommandCN(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 NestedExecutionEnvironmentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NestedExecutionEnvironmentCreateCommandCN(req, eObject);
+ public static NestedExecutionEnvironmentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedExecutionEnvironmentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedExecutionEnvironmentCreateCommandCN(CreateElementRequest req) {
+ public NestedExecutionEnvironmentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class NestedExecutionEnvironmentCreateCommandCN extends EditElementComman * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class NestedExecutionEnvironmentCreateCommandCN extends EditElementComman * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExecutionEnvironment());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
ExecutionEnvironment newElement = UMLFactory.eINSTANCE.createExecutionEnvironment();
-
- 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_ExecutionEnvironment_46(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class NestedExecutionEnvironmentCreateCommandCN extends EditElementComman configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java index 6423449b2ff..dc49870ad2a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NestedNodeCreateCommandCN.java @@ -23,11 +23,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class NestedNodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class NestedNodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public NestedNodeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NestedNodeCreateCommandCN(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 NestedNodeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NestedNodeCreateCommandCN(req, eObject);
+ public static NestedNodeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NestedNodeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NestedNodeCreateCommandCN(CreateElementRequest req) {
+ public NestedNodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -73,7 +78,6 @@ public class NestedNodeCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -88,25 +92,31 @@ public class NestedNodeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Node newElement = UMLFactory.eINSTANCE.createNode();
-
- 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_Node_42(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -124,5 +134,4 @@ public class NestedNodeCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java index 7d2729caa09..eb8104fd829 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommand.java @@ -14,11 +14,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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -28,7 +32,7 @@ public class NodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -38,24 +42,25 @@ public class NodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public NodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public NodeCreateCommand(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 NodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new NodeCreateCommand(req, eObject);
+ public static NodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public NodeCreateCommand(CreateElementRequest req) {
+ public NodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -64,7 +69,6 @@ public class NodeCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,30 +83,31 @@ public class NodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Node newElement = UMLFactory.eINSTANCE.createNode();
-
- 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_Node_2008(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -120,5 +125,4 @@ public class NodeCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java index d96fcda1a6b..a3b1ec14ddf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/NodeCreateCommandCN.java @@ -14,10 +14,14 @@ 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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Node;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -27,7 +31,7 @@ public class NodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -37,24 +41,25 @@ public class NodeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public NodeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public NodeCreateCommandCN(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 NodeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new NodeCreateCommandCN(req, eObject);
+ public static NodeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new NodeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public NodeCreateCommandCN(CreateElementRequest req) {
+ public NodeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -63,7 +68,6 @@ public class NodeCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -78,25 +82,31 @@ public class NodeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getNode());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Node newElement = UMLFactory.eINSTANCE.createNode();
-
- Node owner = (Node)getElementToEdit();
- owner.getNestedNodes().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 {
+ Node qualifiedTarget = (Node)target;
+ qualifiedTarget.getNestedNodes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Node_23(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -114,5 +124,4 @@ public class NodeCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java index 03acf3c9664..417814a5359 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommand.java @@ -23,10 +23,14 @@ 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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommand(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 PackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommand(req, eObject);
+ public static PackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req) {
+ public PackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -72,7 +77,6 @@ public class PackageCreateCommand extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -87,30 +91,31 @@ public class PackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- // Creation constraint for TopLevelNodes
- if(!(getElementToEdit() instanceof Package)) {
- return false;
- }
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Package newElement = UMLFactory.eINSTANCE.createPackage();
-
- 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_Package_2009(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -128,5 +133,4 @@ public class PackageCreateCommand extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java index 50621e5dfc6..55c3c45537b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/commands/PackageCreateCommandCN.java @@ -23,10 +23,14 @@ 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.deployment.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -36,7 +40,7 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -46,24 +50,25 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandCN(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 PackageCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandCN(req, eObject);
+ public static PackageCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req) {
+ public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -72,7 +77,6 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -87,25 +91,31 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
Package newElement = UMLFactory.eINSTANCE.createPackage();
-
- 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_Package_36(newElement);
-
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -123,5 +133,4 @@ public class PackageCreateCommandCN extends EditElementCommand { configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java index 7e4b52766da..d2ae309baa4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicy.java @@ -135,7 +135,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicy extends CanonicalEd CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -155,7 +154,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicy extends CanonicalEd DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java index 9611e2322b0..c5fb4f0e77e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyACN.java @@ -135,7 +135,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicyACN extends Canonica CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -155,7 +154,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicyACN extends Canonica DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java index 6d80ac78864..3883321c369 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentCanonicalEditPolicyCN.java @@ -135,7 +135,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicyCN extends Canonical CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -155,7 +154,6 @@ public class ArtifactCompositeCompartmentCanonicalEditPolicyCN extends Canonical DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java index b9ddf1d947d..18c08c1976e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicy.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -44,14 +45,11 @@ public class ArtifactCompositeCompartmentItemSemanticEditPolicy extends UMLBaseI }
}
if(UMLElementTypes.Artifact_28 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandACN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java index e0d26ac520f..1f37d7eee65 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyACN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -44,14 +45,11 @@ public class ArtifactCompositeCompartmentItemSemanticEditPolicyACN extends UMLBa }
}
if(UMLElementTypes.Artifact_28 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandACN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java index 7b0cb696110..961e097ffc1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactCompositeCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandACN;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -44,14 +45,11 @@ public class ArtifactCompositeCompartmentItemSemanticEditPolicyCN extends UMLBas }
}
if(UMLElementTypes.Artifact_28 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandACN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandACN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java index 3021588aedf..154eadb7331 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicy.java @@ -56,7 +56,6 @@ public class ArtifactItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -238,5 +237,4 @@ public class ArtifactItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java index 8f8d2c6c894..4f6733e29f7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyACN.java @@ -71,7 +71,6 @@ public class ArtifactItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPo View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -101,7 +100,6 @@ public class ArtifactItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPo Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ArtifactEditPartACN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -122,7 +120,6 @@ public class ArtifactItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPo break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -322,5 +319,4 @@ public class ArtifactItemSemanticEditPolicyACN extends UMLBaseItemSemanticEditPo }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java index d00b477068e..c579663f8a9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ArtifactItemSemanticEditPolicyCN.java @@ -61,7 +61,6 @@ public class ArtifactItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPol View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -251,5 +250,4 @@ public class ArtifactItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPol }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java index 4f847e63895..721feedd842 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentAnnotatedElementItemSemanticEditPolicy.java @@ -26,5 +26,4 @@ public class CommentAnnotatedElementItemSemanticEditPolicy extends UMLBaseItemSe protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return getGEFWrapper(new DestroyReferenceCommand(req));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java index cc9c4be7105..8e14bed974f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicy.java @@ -45,7 +45,6 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -143,5 +142,4 @@ public class CommentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java index bec229b1b69..7d3320c9e28 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/CommentItemSemanticEditPolicyCN.java @@ -55,7 +55,6 @@ public class CommentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -161,5 +160,4 @@ public class CommentItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java index 75610be4a83..6f540abedd1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintConstrainedElementItemSemanticEditPolicy.java @@ -26,5 +26,4 @@ public class ConstraintConstrainedElementItemSemanticEditPolicy extends UMLBaseI protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return getGEFWrapper(new DestroyReferenceCommand(req));
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java index dc757703254..1933cefebdb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicy.java @@ -54,7 +54,6 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -226,5 +225,4 @@ public class ConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java index 6f5ed3fc625..a7aa60f82d7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ConstraintItemSemanticEditPolicyCN.java @@ -68,7 +68,6 @@ public class ConstraintItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -248,5 +247,4 @@ public class ConstraintItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java index 26c06f7261e..aafca2c11b4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DefaultNamedElementItemSemanticEditPolicy.java @@ -68,7 +68,6 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -245,5 +244,4 @@ public class DefaultNamedElementItemSemanticEditPolicy extends UMLBaseItemSemant }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java index d2a59972c48..7dd48f16cc0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyBranchItemSemanticEditPolicy.java @@ -63,7 +63,6 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -232,5 +231,4 @@ public class DependencyBranchItemSemanticEditPolicy extends UMLBaseItemSemanticE }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java index 2f5d0545ddf..b0d11609a01 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyItemSemanticEditPolicy.java @@ -54,7 +54,6 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -223,5 +222,4 @@ public class DependencyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java index 105a73be8bb..791f5d8d210 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DependencyNodeItemSemanticEditPolicy.java @@ -63,7 +63,6 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -232,5 +231,4 @@ public class DependencyNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEdi }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java index 5ccb6d809cf..480aad80635 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentDiagramItemSemanticEditPolicy.java @@ -12,6 +12,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommand;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommand;
@@ -58,84 +59,64 @@ public class DeploymentDiagramItemSemanticEditPolicy extends UMLBaseItemSemantic }
}
if(UMLElementTypes.Dependency_2011 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DependencyNodeCreateCommand(req));
-
+ return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_2010 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommand(req));
-
+ return getGEFWrapper(new ModelCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_2009 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommand(req));
-
+ return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_2005 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
-
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_2001 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
-
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_2002 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommand(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_2003 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCreateCommand(req));
-
+ return getGEFWrapper(new DeviceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_2006 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommand(req));
-
+ return getGEFWrapper(new ArtifactCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_2008 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCreateCommand(req));
-
+ return getGEFWrapper(new NodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2012 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DefaultNamedElementCreateCommand(req));
-
+ return getGEFWrapper(new DefaultNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
@@ -170,5 +151,4 @@ public class DeploymentDiagramItemSemanticEditPolicy extends UMLBaseItemSemantic this.diagram = currentDiagram;
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java index 519d04faeeb..8278554789c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeploymentItemSemanticEditPolicy.java @@ -54,7 +54,6 @@ public class DeploymentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -223,5 +222,4 @@ public class DeploymentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPol }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java index af4e4845694..e99fcd0f953 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicy.java @@ -138,7 +138,6 @@ public class DeviceCompositeCompartmentCanonicalEditPolicy extends CanonicalEdit CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -158,7 +157,6 @@ public class DeviceCompositeCompartmentCanonicalEditPolicy extends CanonicalEdit DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java index 07f38824228..b172da68a30 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentCanonicalEditPolicyCN.java @@ -138,7 +138,6 @@ public class DeviceCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEd CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -158,7 +157,6 @@ public class DeviceCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEd DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java index 8ef56524e57..84934f500b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicy.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
@@ -46,30 +47,23 @@ public class DeviceCompositeCompartmentItemSemanticEditPolicy extends UMLBaseIte }
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_16 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_23 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java index 9d71b5e6797..7714f0434e5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceCompositeCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NodeCreateCommandCN;
@@ -46,30 +47,23 @@ public class DeviceCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseI }
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_16 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_23 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java index 4eb4d8b0fb3..5d8f95d3f50 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicy.java @@ -56,7 +56,6 @@ public class DeviceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -238,5 +237,4 @@ public class DeviceItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java index 3648563fb84..dc65b5e31d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/DeviceItemSemanticEditPolicyCN.java @@ -61,7 +61,6 @@ public class DeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolic View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -251,5 +250,4 @@ public class DeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolic }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java index 2d357eb5714..d6b6cedf043 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy.java @@ -149,7 +149,6 @@ public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy extends CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -169,7 +168,6 @@ public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy extends DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java index cbb798753e5..4116795bb67 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN.java @@ -149,7 +149,6 @@ public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN exten CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -169,7 +168,6 @@ public class ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN exten DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java index bfd5ed25b2e..b106d1ba25c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -45,22 +46,17 @@ public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy exte }
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_25 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java index 0c7276bfd1b..c50610835cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
@@ -45,22 +46,17 @@ public class ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN ex }
}
if(UMLElementTypes.Artifact_25 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java index c9f4e556188..7d6cd8f2362 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicy.java @@ -56,7 +56,6 @@ public class ExecutionEnvironmentItemSemanticEditPolicy extends UMLBaseItemSeman if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -238,5 +237,4 @@ public class ExecutionEnvironmentItemSemanticEditPolicy extends UMLBaseItemSeman }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java index aa9206e986a..4f74cf43830 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ExecutionEnvironmentItemSemanticEditPolicyCN.java @@ -61,7 +61,6 @@ public class ExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseItemSem View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -251,5 +250,4 @@ public class ExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseItemSem }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java index 51cd950e164..acc5457995a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/GeneralizationItemSemanticEditPolicy.java @@ -45,7 +45,6 @@ public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -140,5 +139,4 @@ public class GeneralizationItemSemanticEditPolicy extends UMLBaseItemSemanticEdi }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java index 0df033b4cb0..f7162b60d84 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ManifestationItemSemanticEditPolicy.java @@ -54,7 +54,6 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -223,5 +222,4 @@ public class ManifestationItemSemanticEditPolicy extends UMLBaseItemSemanticEdit }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java index 78d63c1419f..61a409eb341 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelCanonicalEditPolicy.java @@ -199,7 +199,6 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -214,17 +213,13 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { if(changed || createdViews.size() > 0) {
postProcessRefreshSemantic(createdViews);
}
-
Collection<IAdaptable> createdConnectionViews = refreshConnections();
-
if(createdViews.size() > 1) {
// perform a layout of the container
DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
createdViews.addAll(createdConnectionViews);
-
makeViewsImmutable(createdViews);
}
@@ -612,6 +607,5 @@ public class ModelCanonicalEditPolicy extends CanonicalEditPolicy { this.put(domainElement, view);
}
}
-
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java index 1fef49c95de..d492965233f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicy.java @@ -86,7 +86,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -116,7 +115,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ModelEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -136,7 +134,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -155,7 +152,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case PackageEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -175,7 +171,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -194,7 +189,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedDeviceEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -215,7 +209,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -235,7 +228,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -256,7 +248,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -276,7 +267,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedNodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -297,7 +287,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -317,7 +306,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedArtifactNodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -338,7 +326,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -358,7 +345,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case CommentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -370,7 +356,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -386,7 +371,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ConstraintEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -406,7 +390,6 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -597,5 +580,4 @@ public class ModelItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java index 13749ed4200..ce2b2507915 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelItemSemanticEditPolicyCN.java @@ -86,7 +86,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -116,7 +115,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ModelEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -136,7 +134,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -155,7 +152,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case PackageEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -175,7 +171,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -194,7 +189,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedDeviceEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -215,7 +209,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -235,7 +228,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedExecutionEnvironmentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -256,7 +248,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -276,7 +267,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedNodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -297,7 +287,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -317,7 +306,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NestedArtifactNodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -338,7 +326,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -358,7 +345,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case CommentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -370,7 +356,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -386,7 +371,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ConstraintEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -406,7 +390,6 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -597,5 +580,4 @@ public class ModelItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java index 6ac66714db1..b4517a47cf1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicy.java @@ -176,7 +176,6 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -196,7 +195,6 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicy extends Canon DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java index d00261427be..49b42eddd9b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentCanonicalEditPolicyCN.java @@ -176,7 +176,6 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -196,7 +195,6 @@ public class ModelPackageableElementCompartmentCanonicalEditPolicyCN extends Can DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java index fccba8927f5..dee5581dd9b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
@@ -60,70 +61,53 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicy extends UM }
}
if(UMLElementTypes.Model_49 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
-
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_36 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
-
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_44 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_46 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_42 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_40 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_54 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
-
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_56 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
-
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java index ac2e1303b3b..a390e1a99a2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
@@ -60,70 +61,53 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends }
}
if(UMLElementTypes.Model_49 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
-
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_36 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
-
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_44 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_46 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_42 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_40 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_54 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
-
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_56 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
-
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java index 8d61e43fd5f..cbc6c6c8483 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedArtifactNodeItemSemanticEditPolicyCN.java @@ -80,7 +80,6 @@ public class NestedArtifactNodeItemSemanticEditPolicyCN extends UMLBaseItemSeman View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -110,7 +109,6 @@ public class NestedArtifactNodeItemSemanticEditPolicyCN extends UMLBaseItemSeman Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ArtifactEditPartACN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -131,7 +129,6 @@ public class NestedArtifactNodeItemSemanticEditPolicyCN extends UMLBaseItemSeman break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -331,5 +328,4 @@ public class NestedArtifactNodeItemSemanticEditPolicyCN extends UMLBaseItemSeman }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java index 1027359b392..d817feab906 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedDeviceItemSemanticEditPolicyCN.java @@ -82,7 +82,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -112,7 +111,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -133,7 +131,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -153,7 +150,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case DeviceEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -174,7 +170,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -194,7 +189,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -215,7 +209,6 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -415,5 +408,4 @@ public class NestedDeviceItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java index 7973af0304d..a4dd32e8314 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedExecutionEnvironmentItemSemanticEditPolicyCN.java @@ -81,7 +81,6 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -111,7 +110,6 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case ArtifactEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -132,7 +130,6 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -152,7 +149,6 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -173,7 +169,6 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -373,5 +368,4 @@ public class NestedExecutionEnvironmentItemSemanticEditPolicyCN extends UMLBaseI }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java index 2258a034168..12b58a32082 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NestedNodeItemSemanticEditPolicyCN.java @@ -83,7 +83,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -113,7 +112,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP Node cnode = (Node)cit.next();
switch(UMLVisualIDRegistry.getVisualID(cnode)) {
case DeviceEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -134,7 +132,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -154,7 +151,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ExecutionEnvironmentEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -175,7 +171,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -195,7 +190,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case NodeEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -216,7 +210,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -236,7 +229,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
break;
case ArtifactEditPartCN.VISUAL_ID:
-
for(Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext();) {
Edge incomingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(incomingLink)) {
@@ -257,7 +249,6 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP break;
}
}
-
for(Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext();) {
Edge outgoingLink = (Edge)it.next();
switch(UMLVisualIDRegistry.getVisualID(outgoingLink)) {
@@ -457,5 +448,4 @@ public class NestedNodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditP }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java index ba01e428e03..779c0d2ee15 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicy.java @@ -158,7 +158,6 @@ public class NodeCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPo CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -178,7 +177,6 @@ public class NodeCompositeCompartmentCanonicalEditPolicy extends CanonicalEditPo DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java index 926e90bc1ce..8b2275a3a00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentCanonicalEditPolicyCN.java @@ -158,7 +158,6 @@ public class NodeCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEdit CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -178,7 +177,6 @@ public class NodeCompositeCompartmentCanonicalEditPolicyCN extends CanonicalEdit DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java index 2a6acdedddb..516a6513659 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicy.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
@@ -47,38 +48,29 @@ public class NodeCompositeCompartmentItemSemanticEditPolicy extends UMLBaseItemS }
}
if(UMLElementTypes.Device_16 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_25 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_23 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java index 89169279fe2..a39f11df3fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeCompositeCompartmentItemSemanticEditPolicyCN.java @@ -8,6 +8,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ArtifactCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.DeviceCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ExecutionEnvironmentCreateCommandCN;
@@ -47,38 +48,29 @@ public class NodeCompositeCompartmentItemSemanticEditPolicyCN extends UMLBaseIte }
}
if(UMLElementTypes.Device_16 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new DeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_21 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new ExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_23 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_25 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ArtifactCreateCommandCN(req));
-
+ return getGEFWrapper(new ArtifactCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java index 849eba0a449..a38377167cd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicy.java @@ -56,7 +56,6 @@ public class NodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -238,5 +237,4 @@ public class NodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java index 3eb09875c06..42b7171a8be 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/NodeItemSemanticEditPolicyCN.java @@ -61,7 +61,6 @@ public class NodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy View view = (View)getHost().getModel();
CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
cmd.setTransactionNestingEnabled(true);
-
EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
if(annotation == null) {
// there are indirectly referenced children, need extra commands: false
@@ -251,5 +250,4 @@ public class NodeItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPolicy }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java index b1f25cefaad..5bdc116cfde 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicy.java @@ -63,7 +63,6 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -232,5 +231,4 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java index bf53705977d..2fca56de831 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackageItemSemanticEditPolicyCN.java @@ -63,7 +63,6 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli if(provider != null) {
// Retrieve delete command from the Element Edit service
ICommand deleteCommand = provider.getEditCommand(req);
-
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -232,5 +231,4 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli }
return super.getReorientReferenceRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java index 475ee1ff2ab..74194f9c8f0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicy.java @@ -176,7 +176,6 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -196,7 +195,6 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicy extends Can DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java index d7134df0e90..a5254c11c2e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentCanonicalEditPolicyCN.java @@ -174,7 +174,6 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
viewDescriptors.add(descriptor);
}
-
boolean changed = deleteViews(orphaned.iterator());
//
CreateViewRequest request = getCreateViewRequest(viewDescriptors);
@@ -194,7 +193,6 @@ public class PackagePackageableElementCompartmentCanonicalEditPolicyCN extends C DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
executeCommand(new ICommandProxy(layoutCmd));
}
-
makeViewsImmutable(createdViews);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java index b4f9928616b..e8d1600f87d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ModelCreateCommandCN;
@@ -60,70 +61,53 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends }
}
if(UMLElementTypes.Model_49 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
-
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_36 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
-
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_40 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_44 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_46 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_42 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_54 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
-
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_56 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
-
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java index 486a22252c7..e96e91148d8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.deployment.edit.commands.NestedArtifactNodeCreateCommandCN;
@@ -59,62 +60,47 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extend }
}
if(UMLElementTypes.Package_36 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
-
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Artifact_40 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedArtifactNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Device_44 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedDeviceCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedDeviceCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ExecutionEnvironment_46 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedExecutionEnvironmentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Node_42 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new NestedNodeCreateCommandCN(req));
-
+ return getGEFWrapper(new NestedNodeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_54 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
-
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_56 == baseElementType) {
-
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
-
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java index fff856b1b66..fc62e739330 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -301,7 +301,6 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
protected Command getMoveCommand(MoveRequest req) {
-
EObject targetCEObject = req.getTargetContainer();
if(targetCEObject != null) {
IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
@@ -315,7 +314,6 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { } else {
return getGEFWrapper(new MoveElementsCommand(req));
}
-
}
/**
@@ -399,13 +397,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
public boolean canCreateCommentAnnotatedElement_4008(Comment source, Element target) {
if(source != null) {
- if(source.getAnnotatedElements().contains(target)
-
- ) {
+ if(source.getAnnotatedElements().contains(target)) {
return false;
}
}
-
return canExistCommentAnnotatedElement_4008(source, target);
}
@@ -414,13 +409,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
public boolean canCreateConstraintConstrainedElement_4009(Constraint source, Element target) {
if(source != null) {
- if(source.getConstrainedElements().contains(target)
-
- ) {
+ if(source.getConstrainedElements().contains(target)) {
return false;
}
}
-
return canExistConstraintConstrainedElement_4009(source, target);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java index 7949a7dabdc..b6c7c42c732 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java @@ -153,13 +153,7 @@ public class UMLVisualIDRegistry { * @generated
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return DeploymentDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return DeploymentDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF index f5cade54750..9b1bf302821 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF @@ -39,7 +39,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.hyperlink;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.0.0",
org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.diagram.interactionoverview,
org.eclipse.papyrus.uml.diagram.interactionoverview.edit.advices,
org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml index 0a86de89142..02dd78ac26b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml @@ -39,70 +39,8 @@ categoryId="org.eclipse.papyrus.editor.category"/>
</extension>
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateInteractionOverviewDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand">
- <activeWhen>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
- </with>
- </activeWhen>
- </handler>
- </extension>
<!-- Diagram creation command registration in menu and toolbar -->
- <extension point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand"
- icon="icons/obj16/interactionOverviewDiagram.gif"
- label="Create a new Interaction Overview Diagram"
- style="push"
- tooltip="Create a new Interaction Overview Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
-
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand"
- icon="icons/obj16/interactionOverviewDiagram.gif"
- label="Create a new Interaction Overview Diagram"
- style="push"
- tooltip="Create a new Interaction Overview Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
-
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand"
- icon="icons/obj16/interactionOverviewDiagram.gif"
- label="Create a new Interaction Overview Diagram"
- style="push"
- tooltip="Create a new Interaction Overview Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
-
- </command>
- </menuContribution>
-
- </extension>
<!-- Palette tool declaration (declares the real palette containment) -->
<extension
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreateCommand.java index 2363c9481f8..4e63467794f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreateCommand.java @@ -1,19 +1,19 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * + * Contributors: + * Laurent Wouters laurent.wouters@cea.fr - Refactoring for viewpoints + * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.interactionoverview; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes; @@ -21,7 +21,7 @@ import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes // End of user code public class InteractionOverviewDiagramCreateCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - + /** * {@inheritDoc} */ @@ -45,18 +45,4 @@ public class InteractionOverviewDiagramCreateCommand extends AbstractPapyrusGmfC protected PreferencesHint getPreferenceHint() { return Activator.DIAGRAM_PREFERENCES_HINT; } - - /** - * {@inheritDoc} - */ - @Override - protected Diagram createDiagram(final Resource diagramResource, final EObject owner, final String name) { - // Start of user code Custom diagram creation - return super.createDiagram(diagramResource, owner, name); - // End of user code - } - - // Start of user code Custom creation command - - // End of user code } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/CreateInteractionOverviewDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/CreateInteractionOverviewDiagramWithNavigationHandler.java deleted file mode 100644 index 3019c616ffb..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/CreateInteractionOverviewDiagramWithNavigationHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateInteractionOverviewDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateInteractionOverviewDiagramWithNavigationHandler() {
- super(new InteractionOverviewDiagramCreateCommand(), new InteractionOverviewDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreationCondition.java index e4c56fa5e8e..594dc96bda4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/InteractionOverviewDiagramCreationCondition.java @@ -24,9 +24,6 @@ public class InteractionOverviewDiagramCreationCondition extends PerspectiveCont */
@Override
public boolean create(final EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.classpath deleted file mode 100644 index ed2585fb3f4..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.project b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.project deleted file mode 100644 index 72d7ebfc1fb..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.uml.diagram.pkg</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/net.sf.jautodoc.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/net.sf.jautodoc.prefs deleted file mode 100644 index 20a9f2e4cd0..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/net.sf.jautodoc.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Wed Apr 20 16:59:51 CEST 2011
-add_header=true
-eclipse.preferences.version=1
-header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n *\t\t\r\n *\t\tCEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/
-project_specific_settings=true
-replace_header=true
-replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f98abccaf58..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Jun 23 10:57:27 CEST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.MF deleted file mode 100644 index 01361137724..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.MF +++ /dev/null @@ -1,35 +0,0 @@ -Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.diagram.ui.providers,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.uml2.uml;bundle-version="4.0.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.emf.common.ui;bundle-version="2.7.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0"
-Export-Package: org.eclipse.papyrus.uml.diagram.pkg,
- org.eclipse.papyrus.uml.diagram.pkg.provider
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.0.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.pkg.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.pkg;singleton:=tr
- ue
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.gen.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.gen.MF deleted file mode 100644 index ed2f1ac8f4b..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/META-INF/MANIFEST.gen.MF +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.pkg;singleton:=true -Bundle-Version: 0.9.0.qualifier -Bundle-Activator: org.eclipse.papyrus.uml.diagram.pkg.Activator -Bundle-Vendor: %providerName -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.papyrus.uml.diagram.common, - org.eclipse.papyrus.infra.gmfdiag.common, - org.eclipse.gmf.runtime.diagram.ui.providers, - org.eclipse.gmf.runtime.diagram.ui.resources.editor, - org.eclipse.papyrus.uml.diagram.clazz, - org.eclipse.papyrus.preferences -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Bundle-ActivationPolicy: lazy diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/about.html b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/about.html deleted file mode 100644 index d35d5aed64c..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2007</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> - -</body> -</html> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.gen.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.gen.properties deleted file mode 100644 index ca6d14e16f2..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.gen.properties +++ /dev/null @@ -1,10 +0,0 @@ -source.. = src/,\ - src-gen/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - palettes/,\ - icons/,\ - about.html,\ - plugin.properties diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.properties deleted file mode 100644 index 2673bb6e850..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -#
-#Mon Sep 12 09:30:21 CEST 2011
-bin.includes=META-INF/,.,plugin.xml,icons/,palettes/,about.html,plugin.properties
-output..=bin/
-src.includes = about.html
-source..=src/,src-gen/
-bin..=bin/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/icons/obj16/Diagram_Package.gif b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/icons/obj16/Diagram_Package.gif Binary files differdeleted file mode 100644 index be6068ee3d5..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/icons/obj16/Diagram_Package.gif +++ /dev/null diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/model/UML.Package.idgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/model/UML.Package.idgen deleted file mode 100644 index 2afde6a8147..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/model/UML.Package.idgen +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="Package" type="Package" icon="icons/obj16/Diagram_Package.gif" label="UML Package Diagram" language="uml" javaPackagePrefix="org.eclipse.papyrus.uml.diagram.pkg" javaClassPrefix="PackageDiagram" createCommandLabel="Create a new Package Diagram">
- <diagramEditPart name="PackageDiagramEditPart">
- <behaviors javaClassQualifiedName="org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy" key="DuplicatePasteEditPolicy.PASTE_ROLE"/>
- <behaviors javaClassQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.edit.policies.ModelItemSemanticEditPolicy" key="EditPolicyRoles.SEMANTIC_ROLE"/>
- <behaviors name="" javaClassQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.policies.RemoveOrphanViewPolicy" key=""RemoveOrphanView""/>
- <behaviors javaClassQualifiedName="org.eclipse.papyrus.uml.diagram.pkg.edit.policy.CustomDragDropEditPolicy" key="EditPolicyRoles.DRAG_DROP_ROLE"/>
- </diagramEditPart>
- <inheritedDiagrams name="ClassDiagram" viewProviderClassQualifiedName="" editPartProviderClassQualifiedName="" dndEditPolicyClassQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.custom.policies.ClassDiagramDragDropEditPolicy">
- <genInheritedEditor href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#PapyrusUMLClassDiagram"/>
- <genNodes customPreferencePage="org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage">
- <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@topLevelNodes.9"/>
- </genNodes>
- <genNodes customPreferencePage="org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage" generatePreferencePage="false" generateTool="false">
- <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@childNodes.31"/>
- </genNodes>
- <genNodes name="">
- <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@topLevelNodes.15"/>
- </genNodes>
- <genNodes generatePreferencePage="false" generateTool="false">
- <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@childNodes.36"/>
- </genNodes>
- <genNodes>
- <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@topLevelNodes.14"/>
- </genNodes>
- <genNodes generatePreferencePage="false" generateTool="false">
- <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@childNodes.37"/>
- </genNodes>
- <genNodes customPreferencePage="org.eclipse.papyrus.uml.diagram.pkg.CustomModelPreferencePage">
- <genNode xsi:type="gmfgen:GenTopLevelNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@topLevelNodes.7"/>
- </genNodes>
- <genNodes generatePreferencePage="false" generateTool="false">
- <genNode xsi:type="gmfgen:GenChildNode" href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@childNodes.29"/>
- </genNodes>
- <genLinks>
- <genLink href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@links.10"/>
- </genLinks>
- <genLinks>
- <genLink href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@links.13"/>
- </genLinks>
- <genLinks name="CommentLink" customPreferencePage="" generatePreferencePage="false" generateTool="false">
- <genLink href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@links.16"/>
- </genLinks>
- <genLinks>
- <genLink href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@links.8"/>
- </genLinks>
- <genLinks generatePreferencePage="false" generateTool="false">
- <genLink href="../../org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen#/0/@diagram/@links.17"/>
- </genLinks>
- </inheritedDiagrams>
- <customJavaClasses customEditPolicyProvider="org.eclipse.papyrus.uml.diagram.pkg.provider.CustomEditPolicyProvider"/>
-</idgen:Diagram>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.gen.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.gen.xml deleted file mode 100644 index 85732802b51..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.gen.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<paletteDefinition> - <content> - <drawer - iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" - id="org.eclipse.papyrus.uml.diagram.pkg.UML_Package__Tools" name="Tools"> - <aspectTool description="Create a new Comment" id="package.tool.comment" - name="Comment" refToolId="clazz.tool.comment"> - </aspectTool> - <aspectTool description="Create a new Constraint" id="package.tool.constraint" - name="Constraint" refToolId="clazz.tool.constraint"> - </aspectTool> - <aspectTool description="Create a new Model" id="package.tool.model" - name="Model" refToolId="clazz.tool.model"> - </aspectTool> - <aspectTool description="Create a new Package" id="package.tool.package" - name="Package" refToolId="clazz.tool.package"> - </aspectTool> - <aspectTool description="Create a new Abstraction" id="package.tool.abstraction" - name="Abstraction" refToolId="clazz.tool.abstraction"> - </aspectTool> - <aspectTool description="Create a new Dependency" id="package.tool.dependency" - name="Dependency" refToolId="clazz.tool.dependency"> - </aspectTool> - <aspectTool description="Create a new PackageImport" id="package.tool.packageimport" - name="PackageImport" refToolId="clazz.tool.packageimport"> - </aspectTool> - - </drawer> - </content> -</paletteDefinition> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.xml deleted file mode 100644 index 0337d15f363..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/palettes/package.palette.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<paletteDefinition> - <content> - <drawer - iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" - id="org.eclipse.papyrus.uml.diagram.pkg.UML_Package__Tools" name="Tools"> - <aspectTool description="Create a new Comment" id="package.tool.comment" - name="Comment" refToolId="clazz.tool.comment"> - </aspectTool> - <aspectTool description="Create a new Constraint" id="package.tool.constraint" - name="Constraint" refToolId="clazz.tool.constraint"> - </aspectTool> - <aspectTool description="Create a new Model" id="package.tool.model" - name="Model" refToolId="clazz.tool.model"> - </aspectTool> - <aspectTool description="Create a new Package" id="package.tool.package" - name="Package" refToolId="clazz.tool.package"> - </aspectTool> - <aspectTool description="Create a new Abstraction" id="package.tool.abstraction" - name="Abstraction" refToolId="clazz.tool.abstraction"> - </aspectTool> - <aspectTool description="Create a new Dependency" id="package.tool.dependency" - name="Dependency" refToolId="clazz.tool.dependency"> - </aspectTool> - <aspectTool description="Create a new PackageImport" id="package.tool.packageimport" - name="PackageImport" refToolId="clazz.tool.packageimport"> - </aspectTool> - <aspectTool description="Create a new Context link" id="package.tool.contextLink" - name="ContextLink" refToolId="createContextLink22CreationTool"> - </aspectTool> - - <!-- Attention : The element is added manually, can combine the two links comment and constraint, and therefore is not deleted --> - <aspectTool description="Create a new Link" id="package.tool.link" - name="Link" refToolId="clazz.tool.link"> - </aspectTool> - - </drawer> - - </content> -</paletteDefinition> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.gen.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.gen.xml deleted file mode 100644 index 068231f66e6..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.gen.xml +++ /dev/null @@ -1,423 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - -<!-- Diagram declaration --> -<extension point="org.eclipse.papyrus.infra.core.papyrusDiagram"> - <creationCommand - creationCommandClass="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramCreateCommand" - icon="icons/obj16/Diagram_Package.gif" - id="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - language="uml" - label="UML Package Diagram"/> - <editorDiagram - actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor" - factoryClass="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramEditorFactory" - icon="icons/obj16/Diagram_Package.gif" /> -</extension> - -<!-- Diagram creation command and handler --> -<extension point="org.eclipse.ui.commands"> - <command id="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - name="Create a new Package Diagram" - description="Create a new Package Diagram" - categoryId="org.eclipse.papyrus.editor.category"/> -</extension> - -<extension point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramCreateCommand" - commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand"> - <activeWhen> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor" /> - </with> - </activeWhen> - </handler> -</extension> - -<!-- Diagram creation command registration in menu and toolbar --> -<extension point="org.eclipse.ui.menus"> - - <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu"> - <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" label="Diagrams"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" label="Create a new Package Diagram" - style="push" tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </menu> - </menuContribution> - - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> - <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" label="Create a new Package Diagram" - style="push" tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </toolbar> - </menuContribution> - - <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" - label="Create a new Package Diagram" - style="push" - tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </menuContribution> - -</extension> - -<!-- Palette tool declaration (declares the real palette containment) --> -<extension point="org.eclipse.papyrus.uml.diagram.common.paletteDefinition" - name="UML_Package"> - - <paletteDefinition ID="UML_Package" - class="org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider" - name="UML_Package" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" - path="palettes/package.palette.xml" - provider="CEA LIST"> - <Priority name="Low"/> - - <!-- Specify diagram this palette tools relate to --> - <editor id="org.eclipse.papyrus.uml.diagram.pkg"/> - </paletteDefinition> -</extension> - -<!-- Diagram view providers declaration --> -<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders"> - <!-- Diagram view provider --> - <viewProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.PackageDiagramViewProvider"> - <Priority name="Low"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="Package"/> - </viewProvider> - - <!-- ViewProvider for inherited elements (from ClassDiagram ViewProvider) --> - <viewProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.InheritedClassDiagramViewProvider"> - <Priority name="Low"/> - - <!-- - "2007" = PACKAGE - "3009" = PACKAGE_CN - "2012" = COMMENT - "3028" = COMMENT_CN - "2011" = CONSTRAINT - "3029" = CONSTRAINT_CN - "2005" = MODEL - "3024" = MODEL_CN - --> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2007, 3009, 2012, 3028, 2011, 3029, 2005, 3024"/> - - <!-- - "4008" = DEPENDENCY - "4010" = PACKAGE_IMPORT - "4013" = COMMENT_ANNOTATED_ELEMENT - "4006" = ABSTRACTION - "4014" = CONSTRAINT_CONSTRAINED_ELEMENT - --> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4008, 4010, 4013, 4006, 4014"/> - - <object id="elementtype.node" - class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> - - <method - name="getSemanticHint()" - value="2007, 3009, 2012, 3028, 2011, 3029, 2005, 3024"> - </method> - </object> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" elements="elementtype.node"/> - - <object id="elementtype.edge" - class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> - - <method - name="getSemanticHint()" - value="4008, 4010, 4013, 4006, 4014"> - </method> - </object> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" elements="elementtype.edge"/> - - - <!-- Additional descriptors provided in case the semantic hint is is not provided --> - - <!-- "uml.Package" --> - <object id="uml.Package" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Package"/> - </object> - - <!-- "uml.Comment" --> - <object id="uml.Comment" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Comment"/> - </object> - - <!-- "uml.Constraint" --> - <object id="uml.Constraint" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Constraint"/> - </object> - - <!-- "uml.Model" --> - <object id="uml.Model" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Model"/> - </object> - - <!-- "uml.Dependency" --> - <object id="uml.Dependency" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Dependency"/> - </object> - - <!-- "uml.PackageImport" --> - <object id="uml.PackageImport" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.PackageImport"/> - </object> - - <!-- "uml.Abstraction" --> - <object id="uml.Abstraction" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Abstraction"/> - </object> - - <!-- Additional activation contexts for nodes semantic objects --> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" - elements="uml.Package, uml.Comment, uml.Constraint, uml.Model"/> - - <!-- Additional activation contexts for edges semantic objects --> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" - elements="uml.Dependency, uml.PackageImport, uml.Abstraction"/> - - </viewProvider> -</extension> - -<!-- Diagram edit part providers declaration --> -<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders"> - - <!-- Diagram edit part provider --> - <editpartProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.PackageDiagramEditPartProvider"> - <Priority name="Low"/> - <object - id="org.eclipse.papyrus.uml.diagram.pkg.Diagram" - class="org.eclipse.gmf.runtime.notation.Diagram"> - <method name="getType()" value="Package"/> - </object> - <context views="org.eclipse.papyrus.uml.diagram.pkg.Diagram"/> - </editpartProvider> - - <!-- EditPartProvider for inherited elements (from ClassDiagram) --> - <editpartProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.InheritedClassDiagramEditPartProvider"> - <Priority name="Low"/> - <!-- - The semantic hints given here are used in case the provider is not already loaded. - As soon as the provider is loaded its provides method is used. - "2007" = PACKAGE - "5026" = PACKAGE_LABEL_NAME_HINT - "7016" = PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "3009" = PACKAGE_CN - "5017" = PACKAGE_CN_LABEL_NAME_HINT - "7010" = PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "2012" = COMMENT - "5038" = COMMENT_LABEL_BODY_HINT - "3028" = COMMENT_CN - "5063" = COMMENT_CN_LABEL_BODY_HINT - "2011" = CONSTRAINT - "5037" = CONSTRAINT_LABEL_NAME_HINT - "5159" = CONSTRAINT_LABEL_BODY_HINT - "3029" = CONSTRAINT_CN - "5064" = CONSTRAINT_CN_LABEL_NAME_HINT - "5160" = CONSTRAINT_CN_LABEL_BODY_HINT - "2005" = MODEL - "5020" = MODEL_LABEL_NAME_TN_HINT - "7009" = MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "3024" = MODEL_CN - "5052" = MODEL_CN_LABEL_NAME_HINT - "7030" = MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - --> - <object - id="PACKAGE" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2007, 5026, 7016"/> - </object> - <object - id="PACKAGE_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3009, 5017, 7010"/> - </object> - <object - id="COMMENT" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2012, 5038"/> - </object> - <object - id="COMMENT_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3028, 5063"/> - </object> - <object - id="CONSTRAINT" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2011, 5037, 5159"/> - </object> - <object - id="CONSTRAINT_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3029, 5064, 5160"/> - </object> - <object - id="MODEL" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2005, 5020, 7009"/> - </object> - <object - id="MODEL_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3024, 5052, 7030"/> - </object> - - - <!-- - "4008" = DEPENDENCY - "6026" = DEPENDENCY_LABEL_NAME_HINT - "6027" = DEPENDENCY_LABEL_APPLIED_STEREOTYPE_HINT - "4010" = PACKAGE_IMPORT - "6022" = PACKAGE_IMPORT_LABEL_APPLIED_STEREOTYPE_HINT - "4013" = COMMENT_ANNOTATED_ELEMENT - "4006" = ABSTRACTION - "6014" = ABSTRACTION_LABEL_NAME_HINT - "6015" = ABSTRACTION_LABEL_APPLIED_STEREOTYPE_HINT - "4014" = CONSTRAINT_CONSTRAINED_ELEMENT - --> - <object - id="DEPENDENCY" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4008, 6026, 6027"/> - </object> - <object - id="PACKAGE_IMPORT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4010, 6022"/> - </object> - <object - id="COMMENT_ANNOTATED_ELEMENT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4013"/> - </object> - <object - id="ABSTRACTION" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4006, 6014, 6015"/> - </object> - <object - id="CONSTRAINT_CONSTRAINED_ELEMENT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4014"/> - </object> - - <context views="PACKAGE, PACKAGE_CN, COMMENT, COMMENT_CN, CONSTRAINT, CONSTRAINT_CN, MODEL, MODEL_CN"/> - <context views="DEPENDENCY, PACKAGE_IMPORT, COMMENT_ANNOTATED_ELEMENT, ABSTRACTION, CONSTRAINT_CONSTRAINED_ELEMENT"/> - - </editpartProvider> -</extension> - -<!-- Diagram edit policy provider --> -<extension - point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders"> - <editpolicyProvider - class="org.eclipse.papyrus.uml.diagram.pkg.provider.CustomEditPolicyProvider"> - <Priority name="Low"/> - </editpolicyProvider> -</extension> - -<!-- Preference pages declaration --> -<extension point="org.eclipse.ui.preferencePages" id="prefpages"> - - <!-- Diagram Preference pages declaration --> - <page - id="org.eclipse.papyrus.uml.diagram.pkg.preferences" - name="Package Diagram" - category="org.eclipse.papyrus.preferences.diagrams" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageDiagramGeneralPreferencePage"> - </page> - - <!-- Element Preference pages declaration --> - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackagePreferencePage" - name="Package"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.CommentPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.CommentPreferencePage" - name="Comment"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.ConstraintPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.ConstraintPreferencePage" - name="Constraint"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.CustomModelPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.ModelPreferencePage" - name="Model"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.DependencyPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.DependencyPreferencePage" - name="Dependency"> - </page> - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageImportPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageImportPreferencePage" - name="PackageImport"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.AbstractionPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.AbstractionPreferencePage" - name="Abstraction"> - </page> - - - - - -</extension> - -<!-- // Start of user code custom extensions
- -->
-
-<!-- Insert custom extensions here. -->
-
-<!-- // End of user code - --> - -</plugin>
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.properties deleted file mode 100644 index 1b97f4f3266..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -################################################################################# -# Copyright (c) 2010 CEA LIST. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - initial API and implementation -################################################################################## -pluginName=UML Package Diagram (Incubation) -providerName=Eclipse Modeling Project diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml deleted file mode 100644 index c7d6758a721..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml +++ /dev/null @@ -1,688 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - -<!-- Diagram declaration --> -<extension point="org.eclipse.papyrus.infra.core.papyrusDiagram"> - <creationCommand - creationCommandClass="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramCreateCommand" - creationCondition="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramCreationCondition"
- icon="icons/obj16/Diagram_Package.gif" - id="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - language="uml" - label="UML Package Diagram"/> - <editorDiagram - actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor" - factoryClass="org.eclipse.papyrus.uml.diagram.pkg.PackageDiagramEditorFactory" - icon="icons/obj16/Diagram_Package.gif" /> -</extension> - -<!-- Diagram creation command and handler --> -<extension point="org.eclipse.ui.commands"> - <command id="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - name="Create a new Package Diagram" - description="Create a new Package Diagram" - categoryId="org.eclipse.papyrus.editor.category"/> -</extension> - -<extension point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.papyrus.uml.diagram.pkg.CreatePackageDiagramWithNavigationHandler" - commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand"> - <activeWhen> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor" /> - </with> - </activeWhen> - </handler> -</extension> - -<!-- Diagram creation command registration in menu and toolbar --> -<extension point="org.eclipse.ui.menus"> - - <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu"> - <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" label="Diagrams"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" label="Create a new Package Diagram" - style="push" tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </menu> - </menuContribution> - - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> - <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" label="Create a new Package Diagram" - style="push" tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </toolbar> - </menuContribution> - - <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram"> - <command commandId="org.eclipse.papyrus.uml.diagram.pkg.CreateCommand" - icon="icons/obj16/Diagram_Package.gif" - label="Create a new Package Diagram" - style="push" - tooltip="Create a new Package Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - - </command> - </menuContribution> - -</extension> - -<!-- Palette tool declaration (declares the real palette containment) --> -<extension point="org.eclipse.papyrus.uml.diagram.common.paletteDefinition" - name="UML_Package"> - - <paletteDefinition ID="UML_Package" - class="org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider" - name="UML_Package" icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" - path="palettes/package.palette.xml" - provider="CEA LIST"> - <Priority name="Low"/> - - <!-- Specify diagram this palette tools relate to --> - <editor id="org.eclipse.papyrus.uml.diagram.pkg"/> - </paletteDefinition> -</extension> - -<!-- Diagram view providers declaration --> -<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders"> - <!-- Diagram view provider --> - <viewProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.PackageDiagramViewProvider"> - <Priority name="Low"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="Package"/> - </viewProvider> - - <!-- ViewProvider for inherited elements (from ClassDiagram ViewProvider) --> - <viewProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.InheritedClassDiagramViewProvider"> - <Priority name="Low"/> - - <!-- - "2007" = PACKAGE - "3009" = PACKAGE_CN - "2012" = COMMENT - "3028" = COMMENT_CN - "2011" = CONSTRAINT - "3029" = CONSTRAINT_CN - "2005" = MODEL - "3024" = MODEL_CN - --> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2007, 3009, 2012, 3028, 2011, 3029, 2005, 3024"/> - - <!-- - "4008" = DEPENDENCY - "4010" = PACKAGE_IMPORT - "4013" = COMMENT_ANNOTATED_ELEMENT - "4006" = ABSTRACTION - "4014" = CONSTRAINT_CONSTRAINED_ELEMENT - --> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4008, 4010, 4013, 4006, 4014"/> - - <object id="elementtype.node" - class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> - - <method - name="getSemanticHint()" - value="2007, 3009, 2012, 3028, 2011, 3029, 2005, 3024"> - </method> - </object> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" elements="elementtype.node"/> - - <object id="elementtype.edge" - class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> - - <method - name="getSemanticHint()" - value="4008, 4010, 4013, 4006, 4014"> - </method> - </object> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" elements="elementtype.edge"/> - - - <!-- Additional descriptors provided in case the semantic hint is is not provided --> - - <!-- "uml.Package" --> - <object id="uml.Package" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Package"/> - </object> - - <!-- "uml.Comment" --> - <object id="uml.Comment" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Comment"/> - </object> - - <!-- "uml.Constraint" --> - <object id="uml.Constraint" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Constraint"/> - </object> - - <!-- "uml.Model" --> - <object id="uml.Model" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Model"/> - </object> - - <!-- "uml.Dependency" --> - <object id="uml.Dependency" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Dependency"/> - </object> - - <!-- "uml.PackageImport" --> - <object id="uml.PackageImport" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.PackageImport"/> - </object> - - <!-- "uml.Abstraction" --> - <object id="uml.Abstraction" class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> - <method name="getProxyClassID()" value="uml.Abstraction"/> - </object> - - <!-- Additional activation contexts for nodes semantic objects --> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" - elements="uml.Package, uml.Comment, uml.Constraint, uml.Model"/> - - <!-- Additional activation contexts for edges semantic objects --> - <context viewClass="org.eclipse.gmf.runtime.notation.Edge" - elements="uml.Dependency, uml.PackageImport, uml.Abstraction"/> - - </viewProvider> -</extension> - -<!-- Diagram edit part providers declaration --> -<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders"> - - <!-- Diagram edit part provider --> - <editpartProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.PackageDiagramEditPartProvider"> - <Priority name="Low"/> - <object - id="org.eclipse.papyrus.uml.diagram.pkg.Diagram" - class="org.eclipse.gmf.runtime.notation.Diagram"> - <method name="getType()" value="Package"/> - </object> - <context views="org.eclipse.papyrus.uml.diagram.pkg.Diagram"/> - </editpartProvider> - - <!-- EditPartProvider for inherited elements (from ClassDiagram) --> - <editpartProvider class="org.eclipse.papyrus.uml.diagram.pkg.provider.InheritedClassDiagramEditPartProvider"> - <Priority name="Low"/> - <!-- - The semantic hints given here are used in case the provider is not already loaded. - As soon as the provider is loaded its provides method is used. - "2007" = PACKAGE - "5026" = PACKAGE_LABEL_NAME_HINT - "7016" = PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "3009" = PACKAGE_CN - "5017" = PACKAGE_CN_LABEL_NAME_HINT - "7010" = PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "2012" = COMMENT - "5038" = COMMENT_LABEL_BODY_HINT - "3028" = COMMENT_CN - "5063" = COMMENT_CN_LABEL_BODY_HINT - "2011" = CONSTRAINT - "5037" = CONSTRAINT_LABEL_NAME_HINT - "5159" = CONSTRAINT_LABEL_BODY_HINT - "3029" = CONSTRAINT_CN - "5064" = CONSTRAINT_CN_LABEL_NAME_HINT - "5160" = CONSTRAINT_CN_LABEL_BODY_HINT - "2005" = MODEL - "5020" = MODEL_LABEL_NAME_TN_HINT - "7009" = MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - "3024" = MODEL_CN - "5052" = MODEL_CN_LABEL_NAME_HINT - "7030" = MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT - --> - <object - id="PACKAGE" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2007, 5026, 7016"/> - </object> - <object - id="PACKAGE_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3009, 5017, 7010"/> - </object> - <object - id="COMMENT" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2012, 5038"/> - </object> - <object - id="COMMENT_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3028, 5063"/> - </object> - <object - id="CONSTRAINT" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2011, 5037, 5159"/> - </object> - <object - id="CONSTRAINT_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3029, 5064, 5160"/> - </object> - <object - id="MODEL" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="2005, 5020, 7009"/> - </object> - <object - id="MODEL_CN" - class="org.eclipse.gmf.runtime.notation.Node"> - <method name="getType()" value="3024, 5052, 7030"/> - </object> - - - <!-- - "4008" = DEPENDENCY - "6026" = DEPENDENCY_LABEL_NAME_HINT - "6027" = DEPENDENCY_LABEL_APPLIED_STEREOTYPE_HINT - "4010" = PACKAGE_IMPORT - "6022" = PACKAGE_IMPORT_LABEL_APPLIED_STEREOTYPE_HINT - "4013" = COMMENT_ANNOTATED_ELEMENT - "4006" = ABSTRACTION - "6014" = ABSTRACTION_LABEL_NAME_HINT - "6015" = ABSTRACTION_LABEL_APPLIED_STEREOTYPE_HINT - "4014" = CONSTRAINT_CONSTRAINED_ELEMENT - --> - <object - id="DEPENDENCY" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4008, 6026, 6027"/> - </object> - <object - id="PACKAGE_IMPORT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4010, 6022"/> - </object> - <object - id="COMMENT_ANNOTATED_ELEMENT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4013"/> - </object> - <object - id="ABSTRACTION" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4006, 6014, 6015"/> - </object> - <object - id="CONSTRAINT_CONSTRAINED_ELEMENT" - class="org.eclipse.gmf.runtime.notation.Edge"> - <method name="getType()" value="4014"/> - </object> - - <context views="PACKAGE, PACKAGE_CN, COMMENT, COMMENT_CN, CONSTRAINT, CONSTRAINT_CN, MODEL, MODEL_CN"/> - <context views="DEPENDENCY, PACKAGE_IMPORT, COMMENT_ANNOTATED_ELEMENT, ABSTRACTION, CONSTRAINT_CONSTRAINED_ELEMENT"/> - - </editpartProvider> -</extension> - -<!-- Diagram edit policy provider --> -<extension - point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders"> - <editpolicyProvider - class="org.eclipse.papyrus.uml.diagram.pkg.provider.CustomEditPolicyProvider"> - <Priority name="Low"/> - </editpolicyProvider> -</extension> - -<!-- Preference pages declaration --> -<extension point="org.eclipse.ui.preferencePages" id="prefpages"> - - <!-- Diagram Preference pages declaration --> - <page - id="org.eclipse.papyrus.uml.diagram.pkg.preferences" - name="Package Diagram" - category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageDiagramGeneralPreferencePage"> - </page> - - <!-- Element Preference pages declaration --> - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackagePreferencePage" - name="Package"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.CommentPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.CommentPreferencePage" - name="Comment"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.ConstraintPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.ConstraintPreferencePage" - name="Constraint"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.CustomModelPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.ModelPreferencePage" - name="Model"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.DependencyPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.DependencyPreferencePage" - name="Dependency"> - </page> - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageImportPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageImportPreferencePage" - name="PackageImport"> - </page> - - - - - <page category="org.eclipse.papyrus.uml.diagram.pkg.preferences" - class="org.eclipse.papyrus.uml.diagram.pkg.preferences.AbstractionPreferencePage" - id="org.eclipse.papyrus.uml.diagram.pkg.preferences.AbstractionPreferencePage" - name="Abstraction"> - </page> - - - - - -</extension> - -<!-- // Start of user code custom extensions - --> - -<!-- Insert custom extensions here. --> - - <extension - id="ep-provider" - point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders"> - <editpartProvider - class="org.eclipse.papyrus.uml.diagram.pkg.provider.CPackageEditPartProvider"> - <Priority - name="High"> - </Priority> - <object - class="org.eclipse.gmf.runtime.notation.Diagram" - id="generated-diagram"> - <method - name="getType()" - value="Package"> - </method> - </object> - <object - class="org.eclipse.gmf.runtime.notation.Node" - id="generated-nodes"> - <method - name="getType()" - value="2014,2013,2015,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2016,3002,3003,3004,3015,3031,3016,3005,3006,3007,3008,3020,3021,3022,3023,3024,3025,3017,3009,3010,3011,3012,3013,3014,3026,3027,3018,3019,3028,3029,3030"> - </method> - </object> - <object - class="org.eclipse.gmf.runtime.notation.Edge" - id="generated-links"> - <method - name="getType()" - value="4016,4017,4001,4019,4002,4003,4004,4005,4006,4007,4008,4018,4009,4010,4011,4012,4013,4014,4015,4020,4021"> - </method> - </object> - <object - class="org.eclipse.gmf.runtime.notation.Node" - id="generated-labels"> - <method - name="getType()" - value="5066,5002,5005,5008,5011,5020,5023,5026,5029,5032,5035,5037,5038,0,5040,5043,5046,5049,5052,5055,5017,5014,5058,5061,5063,5064"> - </method> - </object> - <object - class="org.eclipse.gmf.runtime.notation.Node" - id="generated-compartments"> - <method - name="getType()" - value="7034,7001,7002,7003,7004,7014,7005,7006,7007,7008,7009,7023,7024,7025,7026,7027,7028,7029,7030,7031,7010,7011,7012,7013,7032,7033,7015,7016,7017,7018,7019,7020,7021,7035"> - </method> - </object> - <object - id="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"> - </object> - </editpartProvider> -</extension> - -<!-- // End of user code - --> -<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> - <diagramMappings diagramID="Package"> - <mapping type="Package" humanReadableType="PackageDiagram"/> - <!-- Compartments --> - <mapping - humanReadableType="attributes" - type="7011"> - </mapping> - - <mapping - humanReadableType="operations" - type="7012"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7013"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7023"> - </mapping> - - <mapping - humanReadableType="operations" - type="7024"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7025"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7026"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7027"> - </mapping> - - <mapping - humanReadableType="operations" - type="7028"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7029"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7041"> - </mapping> - - <mapping - humanReadableType="operations" - type="7042"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7032"> - </mapping> - - <mapping - humanReadableType="operations" - type="7033"> - </mapping> - - <mapping - humanReadableType="packaged elements" - type="7030"> - </mapping> - - <mapping - humanReadableType="packaged elements" - type="7010"> - </mapping> - - <mapping - humanReadableType="literals" - type="7031"> - </mapping> - - <mapping - humanReadableType="slots" - type="7035"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7017"> - </mapping> - - <mapping - humanReadableType="operations" - type="7018"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7019"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7002"> - </mapping> - - <mapping - humanReadableType="operations" - type="7003"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7004"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7006"> - </mapping> - - <mapping - humanReadableType="operations" - type="7007"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7008"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7039"> - </mapping> - - <mapping - humanReadableType="operations" - type="7040"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7020"> - </mapping> - - <mapping - humanReadableType="operations" - type="7021"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7034"> - </mapping> - - <mapping - humanReadableType="slots" - type="7001"> - </mapping> - - <mapping - humanReadableType="attributes" - type="7005"> - </mapping> - - <mapping - humanReadableType="packaged elements" - type="7009"> - </mapping> - - <mapping - humanReadableType="packaged elements" - type="7016"> - </mapping> - - <mapping - humanReadableType="literals" - type="7015"> - </mapping> - - <mapping - humanReadableType="operations" - type="7036"> - </mapping> - - <mapping - humanReadableType="nested classifiers" - type="7037"> - </mapping> - - <mapping - humanReadableType="TemplateParameter" - type="7014"> - </mapping> - - <mapping - humanReadableType="TemplateParameter" - type="7038"> - </mapping> - <!-- Link labels --> - </diagramMappings> -</extension> -</plugin>
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/Activator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/Activator.java deleted file mode 100644 index 210fa8227af..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/Activator.java +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg; - -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageDiagramPreferenceInitializer; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** The activator class controls the plug-in life cycle */ -public class Activator extends AbstractUIPlugin { - - /** The plug-in ID */ - public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.diagram.pkg"; - - /** The plug-in shared instance */ - private static Activator plugin; - - /** The logging helper */ - public static LogHelper log; - - /** The plug-in Preference store */ - public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(PLUGIN_ID); - - /** Default constructor */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - - // register the login helper - log = new LogHelper(plugin); - - // register the preference store - PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); - - // Preferences initialization - PackageDiagramPreferenceInitializer diagramPreferenceInitializer = new PackageDiagramPreferenceInitializer(); - diagramPreferenceInitializer.initializeDefaultPreferences(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getInstance() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path. - * - * @generated - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getBundledImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - /** - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() - * - * @return Shared Preference Store. - */ - @Override - public IPreferenceStore getPreferenceStore() { - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - return store; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreateCommand.java deleted file mode 100644 index f74b8c2a58e..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreateCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class PackageDiagramCreateCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { - - /** - * {@inheritDoc} - */ - @Override - protected String getDefaultDiagramName() { - return "PackageDiagram"; // //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDiagramNotationID() { - return ElementTypes.DIAGRAM_ID; - } - - /** - * {@inheritDoc} - */ - @Override - protected PreferencesHint getPreferenceHint() { - return Activator.DIAGRAM_PREFERENCES_HINT; - } - - /** - * {@inheritDoc} - */ - @Override - protected Diagram createDiagram(Resource diagramResource, EObject owner, String name) { - // Start of user code Custom diagram creation - Diagram diagram = null; - - if(owner instanceof org.eclipse.uml2.uml.Package) { - diagram = super.createDiagram(diagramResource, owner, name); - } - - return diagram; - // End of user code - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramEditorFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramEditorFactory.java deleted file mode 100644 index dca02fba5f5..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramEditorFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg; - -import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class PackageDiagramEditorFactory extends GmfEditorFactory { - - public PackageDiagramEditorFactory() { - super(PackageDiagramForMultiEditor.class, ElementTypes.DIAGRAM_ID); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramForMultiEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramForMultiEditor.java deleted file mode 100644 index 30e0cf68d9a..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramForMultiEditor.java +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.core.editor.BackboneException; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.uml.diagram.pkg.part.PackageDiagramEditor; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; - -/** - * An editor to be used in multitabs editor. This editor extends the original UML Diagram. - * - */ -public class PackageDiagramForMultiEditor extends PackageDiagramEditor { - - /** - * The location of diagram icon in the plug-in - */ - private static final String DIAG_IMG_PATH = "icons/obj16/Diagram_Package.gif"; - - /** - * The image descriptor of the diagram icon - */ - private static final ImageDescriptor DIAG_IMG_DESC = Activator.getBundledImageDescriptor(PackageDiagramForMultiEditor.DIAG_IMG_PATH); - - /** The editor splitter. */ - private Composite splitter; - - /** - * Constructor for SashSystem v2. Context and required objects are retrieved from the - * ServiceRegistry. - * - * @throws BackboneException - * @throws ServiceException - * - */ - public PackageDiagramForMultiEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws BackboneException, ServiceException { - super(servicesRegistry, diagram); - } - - /** - * {@inheritDoc} - */ - @Override - public void init(IEditorSite site, IEditorInput input) throws PartInitException { - super.init(site, input); - setPartName(getDiagram().getName()); - setTitleImage(DIAG_IMG_DESC.createImage()); - } - - /** - * {@inheritDoc} - */ - @Override - public void setInput(IEditorInput input) { - try { - // Provide an URI with fragment in order to reuse the same Resource - // and set the diagram to the fragment. - URIEditorInput uriInput = new URIEditorInput(EcoreUtil.getURI(getDiagram())); - doSetInput(uriInput, true); - } catch (CoreException x) { - String title = "Problem opening"; - String msg = "Cannot open input element:"; - Shell shell = getSite().getShell(); - ErrorDialog.openError(shell, title, msg, x.getStatus()); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void createGraphicalViewer(Composite parent) { - splitter = parent; - super.createGraphicalViewer(parent); - } - - /** - * {@inheritDoc} - */ - @Override - public void setFocus() { - splitter.setFocus(); - super.setFocus(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getEditingDomainID() { - return "org.eclipse.papyrus.uml.diagram.pkg.EditingDomain"; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/part/PackageDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/part/PackageDiagramEditPart.java deleted file mode 100644 index ea133b10904..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/part/PackageDiagramEditPart.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.RemoveOrphanViewPolicy; -import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.ModelItemSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.DuplicatePasteEditPolicy; -import org.eclipse.papyrus.uml.diagram.pkg.edit.policy.CustomDragDropEditPolicy; - -public class PackageDiagramEditPart extends DiagramEditPart { - - public PackageDiagramEditPart(View view) { - super(view); - } - - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(DuplicatePasteEditPolicy.PASTE_ROLE, new DuplicatePasteEditPolicy()); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ModelItemSemanticEditPolicy()); - installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); - installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/PackageDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/PackageDiagramDragDropEditPolicy.java deleted file mode 100644 index 4f9e6412103..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/PackageDiagramDragDropEditPolicy.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.edit.policy; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.ClassDiagramDragDropEditPolicy; -import org.eclipse.papyrus.uml.diagram.pkg.provider.GraphicalTypeRegistry; -import org.eclipse.papyrus.uml.diagram.pkg.provider.IGraphicalTypeRegistry; - -/** Customization of the DND edit policy for the Package Diagram */ -public class PackageDiagramDragDropEditPolicy extends ClassDiagramDragDropEditPolicy { - - /** Local graphical type registry */ - protected IGraphicalTypeRegistry registry = new GraphicalTypeRegistry(); - - /** - * {@inheritDoc} - */ - @Override - public int getNodeVisualID(View containerView, EObject domainElement) { - String domainType = registry.getNodeGraphicalType(domainElement, containerView.getType()); - if(IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { - return -1; // undefined - } - return new Integer(domainType); - } - - /** - * {@inheritDoc} - */ - @Override - public int getLinkWithClassVisualID(EObject domainElement) { - String domainType = registry.getEdgeGraphicalType(domainElement); - if(IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainType)) { - return -1; // undefined - } - return new Integer(domainType); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/factory/PackageDiagramViewFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/factory/PackageDiagramViewFactory.java deleted file mode 100644 index cd8f8e74cd7..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/factory/PackageDiagramViewFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.factory; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory; -import org.eclipse.gmf.runtime.notation.MeasurementUnit; - -public class PackageDiagramViewFactory extends DiagramViewFactory { - - protected MeasurementUnit getMeasurementUnit() { - return MeasurementUnit.PIXEL_LITERAL; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/part/PackageDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/part/PackageDiagramEditor.java deleted file mode 100644 index adfa5c3cffd..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/part/PackageDiagramEditor.java +++ /dev/null @@ -1,486 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.part; - -import java.util.EventObject; -import java.util.Set; - -import org.eclipse.core.commands.operations.IUndoableOperation; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.KeyHandler; -import org.eclipse.gef.Tool; -import org.eclipse.gef.commands.CommandStackListener; -import org.eclipse.gef.palette.PaletteRoot; -import org.eclipse.gef.ui.palette.PaletteViewer; -import org.eclipse.gef.ui.palette.PaletteViewerProvider; -import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener; -import org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent; -import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds; -import org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener; -import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.core.services.ServicesRegistry; -import org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider; -import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener; -import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteContextMenuProvider; -import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPaletteViewer; -import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor; -import org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.ide.IGotoMarker; -import org.eclipse.ui.part.ShowInContext; - -/** - * @generated - */ -public class PackageDiagramEditor extends UmlGmfDiagramEditor implements IProviderChangeListener, IGotoMarker { - - /** - * @generated - */ - public static final String ID = "org.eclipse.papyrus.uml.diagram.pkg.part.PackageDiagramEditorID"; //$NON-NLS-1$ - - /** - * @generated - */ - private KeyHandler paletteKeyHandler = null; - - /** - * @generated - */ - private MouseListener paletteMouseListener = null; - - /** - * @generated - */ - private IUndoableOperation savedOperation = null; - - /** - * @generated - */ - private TransactionalEditingDomain editingDomain; - - /** - * @generated - */ - private IDocumentProvider documentProvider; - - /** - * @generated - */ - public PackageDiagramEditor(ServicesRegistry servicesRegistry, Diagram diagram) throws ServiceException { - super(servicesRegistry, diagram); - - // adds a listener to the palette service, which reacts to palette customizations - PapyrusPaletteService.getInstance().addProviderChangeListener(this); - - // Share the same editing provider - editingDomain = servicesRegistry.getService(TransactionalEditingDomain.class); - documentProvider = new GmfMultiDiagramDocumentProvider(editingDomain); - - // overrides editing domain created by super constructor - setDocumentProvider(documentProvider); - } - - /** - * @generated - */ - protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) { - PaletteRoot paletteRoot; - if(existingPaletteRoot == null) { - paletteRoot = PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent()); - } else { - PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent()); - paletteRoot = existingPaletteRoot; - } - applyCustomizationsToPalette(paletteRoot); - return paletteRoot; - } - - /** - * @generated - */ - protected PreferencesHint getPreferencesHint() { - return Activator.DIAGRAM_PREFERENCES_HINT; - } - - /** - * @generated - */ - public String getContributorId() { - return Activator.PLUGIN_ID; - } - - /** - * @generated - */ - protected final IDocumentProvider getDocumentProvider(IEditorInput input) { - return documentProvider; - } - - /** - * @generated - */ - public TransactionalEditingDomain getEditingDomain() { - return editingDomain; - } - - /** - * @generated - */ - protected final void setDocumentProvider(IEditorInput input) { - // Already set in the constructor - } - - /** - * @generated - */ - public void gotoMarker(IMarker marker) { - MarkerNavigationService.getInstance().gotoMarker(this, marker); - } - - /** - * @generated - */ - public boolean isSaveAsAllowed() { - return true; - } - - /** - * @generated - */ - public void doSaveAs() { - performSaveAs(new NullProgressMonitor()); - } - - /** - * @generated - */ - protected void performSaveAs(IProgressMonitor progressMonitor) { - // Nothing - } - - /** - * @generated - */ - public ShowInContext getShowInContext() { - return new ShowInContext(getEditorInput(), getGraphicalViewer().getSelection()); - } - - /** - * @generated - */ - protected void configureGraphicalViewer() { - super.configureGraphicalViewer(); - - // Replace diagram contextual menu removing default - // delete from model action. - DiagramContextMenuProvider provider = (DiagramContextMenuProvider)getDiagramGraphicalViewer().getContextMenu(); - Set<String> menuExclusions = provider.getExclusionSet(); - menuExclusions.add(ActionIds.ACTION_DELETE_FROM_MODEL); - provider.setExclusionSet(menuExclusions); - } - - /** - * @generated - */ - protected TransactionalEditingDomain createEditingDomain() { - // Already configured - return editingDomain; - } - - /** - * @generated - */ - protected void configureDiagramEditDomain() { - super.configureDiagramEditDomain(); - getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new CommandStackListener() { - - public void commandStackChanged(EventObject event) { - firePropertyChange(IEditorPart.PROP_DIRTY); - } - }); - } - - /** - * @generated - */ - public void doSave(IProgressMonitor progressMonitor) { - // The saving of the resource is done by the CoreMultiDiagramEditor - savedOperation = getOperationHistory().getUndoOperation(getUndoContext()); - } - - /** - * @generated - */ - public boolean isDirty() { - IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext()); - return savedOperation != op; - } - - /** - * @generated - */ - public void providerChanged(ProviderChangeEvent event) { - // update the palette if the palette service has changed - if(PapyrusPaletteService.getInstance().equals(event.getSource())) { - PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, getDefaultPaletteContent()); - } - } - - /** - * @generated - */ - public void dispose() { - // remove palette service listener - // remove preference listener - PapyrusPaletteService.getInstance().removeProviderChangeListener(this); - - super.dispose(); - } - - /** - * @generated - */ - protected PaletteViewer getPaletteViewer() { - return getEditDomain().getPaletteViewer(); - } - - /** - * @generated - */ - protected PaletteViewer constructPaletteViewer() { - return new PapyrusPaletteViewer(); - } - - /** - * @generated - */ - protected PaletteViewerProvider createPaletteViewerProvider() { - getEditDomain().setPaletteRoot(createPaletteRoot(null)); - return new PaletteViewerProvider(getEditDomain()) { - - /** - * Override to provide the additional behavior for the tools. Will intialize with a - * PaletteEditPartFactory that has a TrackDragger that understand how to handle the - * mouseDoubleClick event for shape creation tools. Also will initialize the palette - * with a defaultTool that is the SelectToolEx that undestands how to handle the enter - * key which will result in the creation of the shape also. - */ - protected void configurePaletteViewer(PaletteViewer viewer) { - super.configurePaletteViewer(viewer); - - // customize menu... - viewer.setContextMenu(new PapyrusPaletteContextMenuProvider(viewer)); - - viewer.getKeyHandler().setParent(getPaletteKeyHandler()); - viewer.getControl().addMouseListener(getPaletteMouseListener()); - - // Add a transfer drag target listener that is supported on - // palette template entries whose template is a creation tool. - // This will enable drag and drop of the palette shape creation - // tools. - viewer.addDragSourceListener(new PaletteToolTransferDragSourceListener(viewer)); - viewer.setCustomizer(createPaletteCustomizer()); - } - - public PaletteViewer createPaletteViewer(Composite parent) { - PaletteViewer pViewer = constructPaletteViewer(); - pViewer.createControl(parent); - configurePaletteViewer(pViewer); - hookPaletteViewer(pViewer); - return pViewer; - } - - /** - * @return Palette Key Handler for the palette - */ - private KeyHandler getPaletteKeyHandler() { - - if(paletteKeyHandler == null) { - - paletteKeyHandler = new KeyHandler() { - - /** - * Processes a <i>key released </i> event. This method is called by the Tool - * whenever a key is released, and the Tool is in the proper state. Override - * to support pressing the enter key to create a shape or connection - * (between two selected shapes) - * - * @param event - * the KeyEvent - * @return <code>true</code> if KeyEvent was handled in some way - */ - public boolean keyReleased(KeyEvent event) { - - if(event.keyCode == SWT.Selection) { - - Tool tool = getPaletteViewer().getActiveTool().createTool(); - - if(toolSupportsAccessibility(tool)) { - - tool.keyUp(event, getDiagramGraphicalViewer()); - - // deactivate current selection - getPaletteViewer().setActiveTool(null); - - return true; - } - - } - return super.keyReleased(event); - } - - }; - - } - return paletteKeyHandler; - } - - /** - * @return Palette Mouse listener for the palette - */ - private MouseListener getPaletteMouseListener() { - - if(paletteMouseListener == null) { - - paletteMouseListener = new MouseListener() { - - /** - * Flag to indicate that the current active tool should be cleared after a - * mouse double-click event. - */ - private boolean clearActiveTool = false; - - /** - * Override to support double-clicking a palette tool entry to create a - * shape or connection (between two selected shapes). - * - * @see MouseListener#mouseDoubleClick(MouseEvent) - */ - public void mouseDoubleClick(MouseEvent e) { - Tool tool = getPaletteViewer().getActiveTool().createTool(); - - if(toolSupportsAccessibility(tool)) { - - tool.setViewer(getDiagramGraphicalViewer()); - tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain()); - tool.mouseDoubleClick(e, getDiagramGraphicalViewer()); - - // Current active tool should be deactivated, - // but if it is down here it will get - // reactivated deep in GEF palette code after - // receiving mouse up events. - clearActiveTool = true; - } - } - - public void mouseDown(MouseEvent e) { - // do nothing - } - - public void mouseUp(MouseEvent e) { - // Deactivate current active tool here if a - // double-click was handled. - if(clearActiveTool) { - getPaletteViewer().setActiveTool(null); - clearActiveTool = false; - } - - } - }; - - } - return paletteMouseListener; - } - - }; - } - - /** - * @generated - */ - @Override - public GraphicalViewer getGraphicalViewer() { - return super.getGraphicalViewer(); - } - - /** - * @generated - */ - @Override - protected void initializeGraphicalViewer() { - super.initializeGraphicalViewer(); - - // Enable Drop - getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) { - - @Override - protected Object getJavaObject(TransferData data) { - return LocalSelectionTransfer.getTransfer().nativeToJava(data); - } - - @Override - protected TransactionalEditingDomain getTransactionalEditingDomain() { - return getEditingDomain(); - } - }); - - } - - /** - * @generated - */ - @Override - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if(getSite().getPage().getActiveEditor() instanceof IMultiDiagramEditor) { - IMultiDiagramEditor editor = (IMultiDiagramEditor)getSite().getPage().getActiveEditor(); - // If not the active editor, ignore selection changed. - if(this.equals(editor.getActiveEditor())) { - updateActions(getSelectionActions()); - super.selectionChanged(part, selection); - } else { - super.selectionChanged(part, selection); - } - } else { - super.selectionChanged(part, selection); - } - // from - // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart, - // ISelection) - if(part == this) { - rebuildStatusLine(); - } - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/AbstractionPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/AbstractionPreferencePage.java deleted file mode 100644 index d77d4b0be61..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/AbstractionPreferencePage.java +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class AbstractionPreferencePage extends PackageDiagramLinkPreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Abstraction"; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> labelDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - labelDefaultVisibilityMap.put("Name", Boolean.TRUE); //$NON-NLS-1$ - labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(labelDefaultVisibilityMap); - } - - /** Default constructor */ - public AbstractionPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Abstraction"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - for(String labelName : labelDefaultVisibilityMap.keySet()) { - String showLabelKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, labelName, PreferencesConstantsHelper.LABEL_VISIBILITY); - store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeLabelsList() { - for(String name : labelDefaultVisibilityMap.keySet()) { - this.labelsList.add(name); - } - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentLinkPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentLinkPreferencePage.java deleted file mode 100644 index 883bfd70c17..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentLinkPreferencePage.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class CommentLinkPreferencePage extends PackageDiagramLinkPreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"; //$NON-NLS-1$ - - /** Default constructor */ - public CommentLinkPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_CommentAnnotatedElement"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentPreferencePage.java deleted file mode 100644 index 8fc02ecbfcf..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/CommentPreferencePage.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class CommentPreferencePage extends PackageDiagramNodePreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Comment"; //$NON-NLS-1$ - - /** Default constructor */ - public CommentPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Comment"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintConstrainedElementPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintConstrainedElementPreferencePage.java deleted file mode 100644 index f6e44eaa183..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintConstrainedElementPreferencePage.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class ConstraintConstrainedElementPreferencePage extends PackageDiagramLinkPreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"; //$NON-NLS-1$ - - /** Default constructor */ - public ConstraintConstrainedElementPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_ConstraintConstrainedElement"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintPreferencePage.java deleted file mode 100644 index 7bc5e245b38..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ConstraintPreferencePage.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class ConstraintPreferencePage extends PackageDiagramNodePreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Constraint"; //$NON-NLS-1$ - - /** Default constructor */ - public ConstraintPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Constraint"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/DependencyPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/DependencyPreferencePage.java deleted file mode 100644 index bf34433f72e..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/DependencyPreferencePage.java +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class DependencyPreferencePage extends PackageDiagramLinkPreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_DependencyLink"; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> labelDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - labelDefaultVisibilityMap.put("Name", Boolean.TRUE); //$NON-NLS-1$ - labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(labelDefaultVisibilityMap); - } - - /** Default constructor */ - public DependencyPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_DependencyLink"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - for(String labelName : labelDefaultVisibilityMap.keySet()) { - String showLabelKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, labelName, PreferencesConstantsHelper.LABEL_VISIBILITY); - store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeLabelsList() { - for(String name : labelDefaultVisibilityMap.keySet()) { - this.labelsList.add(name); - } - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java deleted file mode 100644 index e5684450c39..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java +++ /dev/null @@ -1,101 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class ModelPreferencePage extends PackageDiagramNodePreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Model"; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> compartmentDefaultVisibilityMap; - - /** The compartment titles default visibility for preferences */ - public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ - - compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(compartmentDefaultVisibilityMap); - Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); - } - - /** Default constructor */ - public ModelPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Model"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100); - // Initialize default visibility for compartments in preference page. - for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { - String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); - store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); - } - - // Initialize default title visibility for compartments in preference page. - for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { - String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); - store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentNamesList() { - for(String name : compartmentDefaultVisibilityMap.keySet()) { - this.compartmentNamesList.add(name); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentTitlesList() { - for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { - this.compartmentTitlesList.add(name); - } - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramGeneralPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramGeneralPreferencePage.java deleted file mode 100644 index 386452fee6a..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramGeneralPreferencePage.java +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class PackageDiagramGeneralPreferencePage extends DiagramPreferencePage { - - public PackageDiagramGeneralPreferencePage() { - setPreferenceStore(Activator.getInstance().getPreferenceStore()); - setPreferenceKey(ElementTypes.DIAGRAM_ID); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramLinkPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramLinkPreferencePage.java deleted file mode 100644 index 25dda03ef50..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramLinkPreferencePage.java +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.TreeMap; - -import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusLinkPreferencePage; -import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedLabelGroup; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.swt.widgets.Composite; - -public class PackageDiagramLinkPreferencePage extends AbstractPapyrusLinkPreferencePage { - - /** The list of label names for this link */ - protected List<String> labelsList; - - /** Constructor */ - public PackageDiagramLinkPreferencePage() { - labelsList = new ArrayList<String>(); - initializeLabelsList(); - Collections.unmodifiableList(labelsList); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // Add label visibility group - if(!labelsList.isEmpty()) { - OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList); - addAbstractGroup(compartmentGroup); - } - - } - - /** - * {@inheritDoc} - */ - @Override - protected String getBundleId() { - return Activator.PLUGIN_ID; - } - - /** Initialize the list containing names of labels. */ - protected void initializeLabelsList() { - // Implemented by subclasses. - } - - /** - * {@inheritDoc} - */ - @Override - protected final TreeMap<String, String> getLabelRole() { - return new TreeMap<String, String>(); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramNodePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramNodePreferencePage.java deleted file mode 100644 index ce450bade06..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramNodePreferencePage.java +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.TreeMap; - -import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage; -import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedCompartmentGroup; -import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.OrderedLabelGroup; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.swt.widgets.Composite; - -public class PackageDiagramNodePreferencePage extends AbstractPapyrusNodePreferencePage { - - /** The list owning the names of compartments */ - protected List<String> compartmentNamesList; - - /** The list owning the names of compartment that have a title */ - protected List<String> compartmentTitlesList; - - /** The list of label names for this node */ - protected List<String> labelsList; - - /** Constructor */ - public PackageDiagramNodePreferencePage() { - this.labelsList = new ArrayList<String>(); - this.compartmentNamesList = new ArrayList<String>(); - this.compartmentTitlesList = new ArrayList<String>(); - - initializeLabelsList(); - initializeCompartmentNamesList(); - initializeCompartmentTitlesList(); - - Collections.unmodifiableList(labelsList); - Collections.unmodifiableList(compartmentNamesList); - Collections.unmodifiableList(compartmentTitlesList); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createPageContents(Composite parent) { - super.createPageContents(parent); - - // Add compartments visibility group - if(!compartmentNamesList.isEmpty()) { - OrderedCompartmentGroup compartmentGroup = new OrderedCompartmentGroup(parent, getPreferenceKey(), this, compartmentNamesList, compartmentTitlesList, getPreferenceStore()); - addAbstractGroup(compartmentGroup); - } - - // Add label visibility group - if(!labelsList.isEmpty()) { - OrderedLabelGroup compartmentGroup = new OrderedLabelGroup(parent, getPreferenceKey(), this, labelsList); - addAbstractGroup(compartmentGroup); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected String getBundleId() { - return Activator.PLUGIN_ID; - } - - /** Initialize the list containing names of labels. */ - protected void initializeLabelsList() { - // Implemented by subclasses. - } - - /** Initialize the list containing the names of compartments. */ - protected void initializeCompartmentNamesList() { - // Implemented by subclasses. - } - - /** Initialize the list containing the names of compartment that have titles. */ - protected void initializeCompartmentTitlesList() { - // Implemented by subclasses. - } - - /** - * {@inheritDoc} - */ - @Override - protected final TreeMap<String, String> getLabelRole() { - return new TreeMap<String, String>(); - } - - /** - * {@inheritDoc} - */ - @Override - protected final TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() { - return new TreeMap<String, Boolean>(); - } - - /** - * {@inheritDoc} - */ - @Override - protected final void initializeCompartmentsList() { - compartmentsList = Collections.emptyList(); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramPreferenceInitializer.java deleted file mode 100644 index 02ad2ce4c34..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageDiagramPreferenceInitializer.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; - -public class PackageDiagramPreferenceInitializer extends AbstractPreferenceInitializer { - - protected IPreferenceStore getPreferenceStore() { - return Activator.getInstance().getPreferenceStore(); - } - - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = getPreferenceStore(); - - org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.preferences.CommentPreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.preferences.ConstraintPreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.CustomModelPreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.preferences.DependencyPreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.preferences.PackageImportPreferencePage.initDefaults(store); - org.eclipse.papyrus.uml.diagram.pkg.preferences.AbstractionPreferencePage.initDefaults(store); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageImportPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageImportPreferencePage.java deleted file mode 100644 index ba5011319d9..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackageImportPreferencePage.java +++ /dev/null @@ -1,74 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class PackageImportPreferencePage extends PackageDiagramLinkPreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_PackageImport"; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> labelDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - labelDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - labelDefaultVisibilityMap.put("Stereotype", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(labelDefaultVisibilityMap); - } - - /** Default constructor */ - public PackageImportPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_PackageImport"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - for(String labelName : labelDefaultVisibilityMap.keySet()) { - String showLabelKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, labelName, PreferencesConstantsHelper.LABEL_VISIBILITY); - store.setDefault(showLabelKey, labelDefaultVisibilityMap.get(labelName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeLabelsList() { - for(String name : labelDefaultVisibilityMap.keySet()) { - this.labelsList.add(name); - } - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java deleted file mode 100644 index b765504af9f..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java +++ /dev/null @@ -1,101 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.uml.diagram.pkg.provider.ElementTypes; - -public class PackagePreferencePage extends PackageDiagramNodePreferencePage { - - /** Constant key to access preferences */ - protected static String prefKey = ElementTypes.DIAGRAM_ID + "_Package"; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> compartmentDefaultVisibilityMap; - - /** The compartment titles default visibility for preferences */ - public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ - - compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - // End of user code - - Collections.unmodifiableMap(compartmentDefaultVisibilityMap); - Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); - } - - /** Default constructor */ - public PackagePreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_Package"); //$NON-NLS-1$ - } - - /** - * Initialize defaults using a specified {@link IPreferenceStore} - * - * @param store - * the preference store. - */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100); - // Initialize default visibility for compartments in preference page. - for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) { - String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); - store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); - } - - // Initialize default title visibility for compartments in preference page. - for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { - String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); - store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentNamesList() { - for(String name : compartmentDefaultVisibilityMap.keySet()) { - this.compartmentNamesList.add(name); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentTitlesList() { - for(String name : compartmentTitleDefaultVisibilityMap.keySet()) { - this.compartmentTitlesList.add(name); - } - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/ElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/ElementTypes.java deleted file mode 100644 index d3880f2d50d..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/ElementTypes.java +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.gmf.runtime.emf.type.core.AbstractElementTypeEnumerator; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; - -public class ElementTypes extends AbstractElementTypeEnumerator { - - /** ********************************************************* */ - /** UML Package Diagram specific elements **************** */ - /** ********************************************************* */ - - /** UML Package Diagram :: Diagram */ - public static final String DIAGRAM_ID = "Package"; //$NON-NLS-1$ - - /** ********************************************************* */ - /** UML Package Diagram - ClassDiagram related elements */ - /** ********************************************************* */ - - /** ClassDiagram :: PACKAGE */ - public static final IHintedType PACKAGE = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Package_2007"); //$NON-NLS-1$ - - public static final String PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT = "7016"; //$NON-NLS-1$ - - public static final String PACKAGE_LABEL_NAME_HINT = "5026"; //$NON-NLS-1$ - - /** ClassDiagram :: PACKAGE_CN */ - public static final IHintedType PACKAGE_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Package_3009"); //$NON-NLS-1$ - - public static final String PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT = "7010"; //$NON-NLS-1$ - - public static final String PACKAGE_CN_LABEL_NAME_HINT = "5017"; //$NON-NLS-1$ - - /** ClassDiagram :: COMMENT */ - public static final IHintedType COMMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Comment_2012"); //$NON-NLS-1$ - - public static final String COMMENT_LABEL_BODY_HINT = "5038"; //$NON-NLS-1$ - - /** ClassDiagram :: COMMENT_CN */ - public static final IHintedType COMMENT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Comment_3028"); //$NON-NLS-1$ - - public static final String COMMENT_CN_LABEL_BODY_HINT = "5063"; //$NON-NLS-1$ - - /** ClassDiagram :: CONSTRAINT */ - public static final IHintedType CONSTRAINT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Constraint_2011"); //$NON-NLS-1$ - - public static final String CONSTRAINT_LABEL_NAME_HINT = "5037"; //$NON-NLS-1$ - - public static final String CONSTRAINT_LABEL_BODY_HINT = "5159"; //$NON-NLS-1$ - - /** ClassDiagram :: CONSTRAINT_CN */ - public static final IHintedType CONSTRAINT_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Constraint_3029"); //$NON-NLS-1$ - - public static final String CONSTRAINT_CN_LABEL_NAME_HINT = "5064"; //$NON-NLS-1$ - - public static final String CONSTRAINT_CN_LABEL_BODY_HINT = "5160"; //$NON-NLS-1$ - - /** ClassDiagram :: MODEL */ - public static final IHintedType MODEL = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Model_2005"); //$NON-NLS-1$ - - public static final String MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT = "7009"; //$NON-NLS-1$ - - public static final String MODEL_LABEL_NAME_TN_HINT = "5020"; //$NON-NLS-1$ - - /** ClassDiagram :: MODEL_CN */ - public static final IHintedType MODEL_CN = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Model_3024"); //$NON-NLS-1$ - - public static final String MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT = "7030"; //$NON-NLS-1$ - - public static final String MODEL_CN_LABEL_NAME_HINT = "5052"; //$NON-NLS-1$ - - /** ClassDiagram :: DEPENDENCY */ - public static final IHintedType DEPENDENCY = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Dependency_4008"); //$NON-NLS-1$ - - public static final String DEPENDENCY_LABEL_NAME_HINT = "6026"; //$NON-NLS-1$ - - public static final String DEPENDENCY_LABEL_APPLIED_STEREOTYPE_HINT = "6027"; //$NON-NLS-1$ - - /** ClassDiagram :: PACKAGE_IMPORT */ - public static final IHintedType PACKAGE_IMPORT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.PackageImport_4010"); //$NON-NLS-1$ - - public static final String PACKAGE_IMPORT_LABEL_APPLIED_STEREOTYPE_HINT = "6022"; //$NON-NLS-1$ - - /** ClassDiagram :: COMMENT_ANNOTATED_ELEMENT */ - public static final IHintedType COMMENT_ANNOTATED_ELEMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.CommentAnnotatedElement_4013"); //$NON-NLS-1$ - - /** ClassDiagram :: ABSTRACTION */ - public static final IHintedType ABSTRACTION = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.Abstraction_4006"); //$NON-NLS-1$ - - public static final String ABSTRACTION_LABEL_NAME_HINT = "6014"; //$NON-NLS-1$ - - public static final String ABSTRACTION_LABEL_APPLIED_STEREOTYPE_HINT = "6015"; //$NON-NLS-1$ - - /** ClassDiagram :: CONSTRAINT_CONSTRAINED_ELEMENT */ - public static final IHintedType CONSTRAINT_CONSTRAINED_ELEMENT = (IHintedType)getElementType("org.eclipse.papyrus.uml.diagram.clazz.ConstraintConstrainedElement_4014"); //$NON-NLS-1$ - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/GraphicalTypeRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/GraphicalTypeRegistry.java deleted file mode 100644 index 9b24611fd70..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/GraphicalTypeRegistry.java +++ /dev/null @@ -1,230 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; - -/** - * <pre> - * This class provides graphical type id (used as View type) for - * domain element according to their actual or expected graphical - * container type. - * </pre> - */ -public class GraphicalTypeRegistry implements IGraphicalTypeRegistry { - - /** A Set containing all known node graphical types */ - protected Set<String> knownNodes = new HashSet<String>(); - - /** A Set containing all known edge graphical types */ - protected Set<String> knownEdges = new HashSet<String>(); - - /** Default constructor */ - public GraphicalTypeRegistry() { - - // Fill known edges set - knownEdges.add(ElementTypes.DEPENDENCY.getSemanticHint()); - knownEdges.add(ElementTypes.PACKAGE_IMPORT.getSemanticHint()); - knownEdges.add(ElementTypes.ABSTRACTION.getSemanticHint()); - knownEdges.add(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint()); - knownEdges.add(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint()); - - // Fill known nodes set (primary nodes) - knownNodes.add(ElementTypes.PACKAGE.getSemanticHint()); - knownNodes.add(ElementTypes.PACKAGE_CN.getSemanticHint()); - knownNodes.add(ElementTypes.COMMENT.getSemanticHint()); - knownNodes.add(ElementTypes.COMMENT_CN.getSemanticHint()); - knownNodes.add(ElementTypes.CONSTRAINT.getSemanticHint()); - knownNodes.add(ElementTypes.CONSTRAINT_CN.getSemanticHint()); - knownNodes.add(ElementTypes.MODEL.getSemanticHint()); - knownNodes.add(ElementTypes.MODEL_CN.getSemanticHint()); - - // Fill known nodes set (child label nodes) - } - - /** - * {@inheritDoc} - */ - public String getEdgeGraphicalType(EObject domainElement) { - - String graphicalType = UNDEFINED_TYPE; - if(domainElement == null) { - return UNDEFINED_TYPE; - } - if(domainElement instanceof org.eclipse.uml2.uml.Dependency) { - graphicalType = ElementTypes.DEPENDENCY.getSemanticHint(); - } - if(domainElement instanceof org.eclipse.uml2.uml.PackageImport) { - graphicalType = ElementTypes.PACKAGE_IMPORT.getSemanticHint(); - } - if(domainElement instanceof org.eclipse.uml2.uml.Abstraction) { - graphicalType = ElementTypes.ABSTRACTION.getSemanticHint(); - } - return graphicalType; - } - - /** - * {@inheritDoc} - */ - public String getEdgeGraphicalType(IElementType elementType) { - if(elementType instanceof IHintedType) { - String semanticHint = ((IHintedType)elementType).getSemanticHint(); - return getEdgeGraphicalType(semanticHint); - } - - return UNDEFINED_TYPE; - } - - /** - * {@inheritDoc} - */ - public String getEdgeGraphicalType(String proposedType) { - if(isKnownEdgeType(proposedType)) { - return proposedType; - } - - return UNDEFINED_TYPE; - } - - /** - * {@inheritDoc} - */ - public String getNodeGraphicalType(EObject domainElement, String containerType) { - - String graphicalType = UNDEFINED_TYPE; - if((containerType == null) || (domainElement == null)) { - return UNDEFINED_TYPE; - } - - if(domainElement instanceof org.eclipse.uml2.uml.Package) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Package TopNode - graphicalType = ElementTypes.PACKAGE.getSemanticHint(); - } - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Package ChildNode - graphicalType = ElementTypes.PACKAGE_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Package ChildNode - graphicalType = ElementTypes.PACKAGE_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Package ChildNode - graphicalType = ElementTypes.PACKAGE_CN.getSemanticHint(); - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Package ChildNode - graphicalType = ElementTypes.PACKAGE_CN.getSemanticHint(); - } - - } - - if(domainElement instanceof org.eclipse.uml2.uml.Comment) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Comment TopNode - graphicalType = ElementTypes.COMMENT.getSemanticHint(); - } - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Comment ChildNode - graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Comment ChildNode - graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Comment ChildNode - graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Comment ChildNode - graphicalType = ElementTypes.COMMENT_CN.getSemanticHint(); - } - - } - - if(domainElement instanceof org.eclipse.uml2.uml.Constraint) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Constraint TopNode - graphicalType = ElementTypes.CONSTRAINT.getSemanticHint(); - } - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Constraint ChildNode - graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Constraint ChildNode - graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Constraint ChildNode - graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint(); - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Constraint ChildNode - graphicalType = ElementTypes.CONSTRAINT_CN.getSemanticHint(); - } - - } - - if(domainElement instanceof org.eclipse.uml2.uml.Model) { - if(ElementTypes.DIAGRAM_ID.equals(containerType)) { // Model TopNode - graphicalType = ElementTypes.MODEL.getSemanticHint(); - } - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Model ChildNode - graphicalType = ElementTypes.MODEL_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Model ChildNode - graphicalType = ElementTypes.MODEL_CN.getSemanticHint(); - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Model ChildNode - graphicalType = ElementTypes.MODEL_CN.getSemanticHint(); - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerType)) { // Model ChildNode - graphicalType = ElementTypes.MODEL_CN.getSemanticHint(); - } - - } - - return graphicalType; - } - - /** - * {@inheritDoc} - */ - public String getNodeGraphicalType(IElementType elementType, String containerType) { - if(elementType instanceof IHintedType) { - String semanticHint = ((IHintedType)elementType).getSemanticHint(); - return getNodeGraphicalType(semanticHint, containerType); - } - - return UNDEFINED_TYPE; - } - - /** - * {@inheritDoc} - */ - public String getNodeGraphicalType(String proposedType, String containerType) { - if(isKnownNodeType(proposedType)) { - return proposedType; - } - - return UNDEFINED_TYPE; - } - - /** - * {@inheritDoc} - */ - public boolean isKnownEdgeType(String type) { - return knownEdges.contains(type); - } - - /** - * {@inheritDoc} - */ - public boolean isKnownNodeType(String type) { - return knownNodes.contains(type); - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/IGraphicalTypeRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/IGraphicalTypeRegistry.java deleted file mode 100644 index 54705c755f9..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/IGraphicalTypeRegistry.java +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; - -/** - * This interface provides an API for accessing the local graphical type registry. - * This registry provides a graphical type for existing model elements. - */ -public interface IGraphicalTypeRegistry { - - /** Constant for undefined graphical type */ - public static final String UNDEFINED_TYPE = "undefined_type"; - - /** - * Get a valid edge graphical type for the domain element. - * - * @param domainElement - * the domain element. - * @return the domain element graphical type. - */ - public String getEdgeGraphicalType(EObject domainElement); - - /** - * Get a valid edge graphical type for the element type. - * - * @param elementType - * the element type. - * @param containerType - * the type of the graphical owner of the domain element. - * @return the domain element graphical type. - */ - public String getEdgeGraphicalType(IElementType elementType); - - /** - * Get a valid edge graphical type for the proposed type. - * - * @param proposedType - * the proposed type. - * @param containerType - * the type of the graphical owner of the domain element. - * @return the domain element graphical type. - */ - public String getEdgeGraphicalType(String proposedType); - - /** - * Get a valid node graphical type for the domain element. - * - * @param domainElement - * the domain element. - * @param containerType - * the type of the graphical owner of the domain element. - * @return the domain element graphical type. - */ - public String getNodeGraphicalType(EObject domainElement, String containerType); - - /** - * Get a valid node graphical type for the element type. - * - * @param elementType - * the element type. - * @param containerType - * the type of the graphical owner of the domain element. - * @return the domain element graphical type. - */ - public String getNodeGraphicalType(IElementType elementType, String containerType); - - /** - * Get a valid node graphical type for the proposed type. - * - * @param proposedType - * the proposed type. - * @param containerType - * the type of the graphical owner of the domain element. - * @return the domain element graphical type. - */ - public String getNodeGraphicalType(String proposedType, String containerType); - - /** - * Test if the type is a known edge graphical type in this diagram - * - * @param type - * the type to test - * @return true if the type is known - */ - public boolean isKnownEdgeType(String type); - - /** - * Test if the type is a known node graphical type in this diagram - * - * @param type - * the type to test - * @return true if the type is known - */ - public boolean isKnownNodeType(String type); - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramEditPartProvider.java deleted file mode 100644 index 94072422c12..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramEditPartProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLEditPartProvider; - -public class InheritedClassDiagramEditPartProvider extends UMLEditPartProvider { - - @Override - public synchronized boolean provides(IOperation operation) { - if(operation instanceof CreateGraphicEditPartOperation) { - View view = ((IEditPartOperation)operation).getView(); - - // Ensure current diagram is a Package Diagram - if(!ElementTypes.DIAGRAM_ID.equals(view.getDiagram().getType())) { - return false; - } - - // Test supported inherited types - EObject eobject = view.getElement(); - - /** Nodes (and ChildLabelNodes) *********** */ - if(eobject instanceof org.eclipse.uml2.uml.Package) { - return true; - } - if(eobject instanceof org.eclipse.uml2.uml.Comment) { - return true; - } - if(eobject instanceof org.eclipse.uml2.uml.Constraint) { - return true; - } - if(eobject instanceof org.eclipse.uml2.uml.Model) { - return true; - } - - /** Edges *********** */ - if(eobject instanceof org.eclipse.uml2.uml.Dependency) { - return true; - } - if(eobject instanceof org.eclipse.uml2.uml.PackageImport) { - return true; - } - if(eobject instanceof org.eclipse.uml2.uml.Abstraction) { - return true; - } - - // Additional test needed here to decide whether to support Feature type links. - // As feature type link are not related to a MetaClass from the domain model - // they are not already handled by previous tests. - // Also concerns NotationType. - String hint = view.getType(); - - /** Edges (Feature) : COMMENT_ANNOTATED_ELEMENT *********** */ - if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(hint)) { - return true; - } - /** Edges (Feature) : CONSTRAINT_CONSTRAINED_ELEMENT *********** */ - if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(hint)) { - return true; - } - - } - return false; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramViewProvider.java deleted file mode 100644 index 7f4af02e7dc..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/InheritedClassDiagramViewProvider.java +++ /dev/null @@ -1,308 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLViewProvider; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; - -public class InheritedClassDiagramViewProvider extends UMLViewProvider { - - /** Local graphical type registry */ - protected IGraphicalTypeRegistry registry = new GraphicalTypeRegistry(); - - @Override - public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - Edge createdEdge = null; - - IElementType elementType = (IElementType)semanticAdapter.getAdapter(IElementType.class); - if(elementType != null) { - createdEdge = super.createEdge(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); - } else { - - EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class); - - String domainElementGraphicalType = semanticHint; - if(domainElementGraphicalType == null) { - domainElementGraphicalType = registry.getEdgeGraphicalType(domainElement); - } - - if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) { - // Cannot use createEdge from super class as it never take the graphical type (semanticHint) into account. - // createdEdge = super.createEdge(semanticAdapter, containerView, domainElementGraphicalType, index, persisted, preferencesHint); - - if(ElementTypes.DEPENDENCY.getSemanticHint().equals(domainElementGraphicalType)) { - createdEdge = createDependency_4008(domainElement, containerView, index, persisted, preferencesHint); - } - if(ElementTypes.PACKAGE_IMPORT.getSemanticHint().equals(domainElementGraphicalType)) { - createdEdge = createPackageImport_4010(domainElement, containerView, index, persisted, preferencesHint); - } - if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(domainElementGraphicalType)) { - createdEdge = createCommentAnnotatedElement_4013(containerView, index, persisted, preferencesHint); - } - if(ElementTypes.ABSTRACTION.getSemanticHint().equals(domainElementGraphicalType)) { - createdEdge = createAbstraction_4006(domainElement, containerView, index, persisted, preferencesHint); - } - if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(domainElementGraphicalType)) { - createdEdge = createConstraintConstrainedElement_4014(containerView, index, persisted, preferencesHint); - } - } - } - - if(createdEdge == null) { - Activator.log.error(new Exception("Could not create Edge.")); - } - - return createdEdge; - } - - @Override - protected boolean provides(CreateViewForKindOperation op) { - - // This provider is registered for Package Diagram only - String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { - return false; - } - - return true; - } - - @Override - protected boolean provides(CreateEdgeViewOperation op) { - - // Must have a container - if(op.getContainerView() == null) { - return false; - } - - // This provider is registered for Package Diagram only - String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { - return false; - } - - IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); - if(elementType == ElementTypes.DEPENDENCY) { - return true; - } - if(elementType == ElementTypes.PACKAGE_IMPORT) { - return true; - } - if(elementType == ElementTypes.COMMENT_ANNOTATED_ELEMENT) { - return true; - } - if(elementType == ElementTypes.ABSTRACTION) { - return true; - } - if(elementType == ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT) { - return true; - } - - // ///////////////////////////////////////////////////////////////////// - // Test possibility to provide a view based on the semantic nature and its expected container. - // ///////////////////////////////////////////////////////////////////// - - // IElementType may be null (especially when drop from ModelExplorer). - // In such a case, test the semantic EObject instead. - if(elementType == null) { - EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class); - String domainElementGraphicalType = op.getSemanticHint(); - if(domainElementGraphicalType == null) { - domainElementGraphicalType = registry.getEdgeGraphicalType(domainElement); - } - - if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownEdgeType(domainElementGraphicalType))) { - return true; - } - } - - return false; - } - - @Override - protected boolean provides(CreateNodeViewOperation op) { - // Must have a container - if(op.getContainerView() == null) { - return false; - } - // Get the type of the container - String containerGraphicalType = op.getContainerView().getType(); - - // This provider is registered for Package Diagram only - String diagramType = op.getContainerView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { - return false; - } - - // ///////////////////////////////////////////////////////////////////// - // Test possibility to provide a view based on the ElementType and its expected container. - // ///////////////////////////////////////////////////////////////////// - - IElementType elementType = (IElementType)op.getSemanticAdapter().getAdapter(IElementType.class); - if(elementType == ElementTypes.PACKAGE) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.PACKAGE_CN) { - // node: org.eclipse.gmf.codegen.gmfgen.impl.GenChildNodeImpl@5c82e51b (visualID: 3009, editPartClassName: PackageEditPartCN, itemSemanticEditPolicyClassName: PackageItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackageCanonicalEditPolicyCN) (primaryDragEditPolicyQualifiedClassName: null, graphicalNodeEditPolicyClassName: PackageGraphicalNodeEditPolicyCN, createCommandClassName: PackageCreateCommandCN) - // containers: org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@7fdefe7e (visualID: 7010, editPartClassName: PackagePackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@25dfae35 (visualID: 7009, editPartClassName: ModelPackageableElementCompartmentEditPartTN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyTN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyTN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@68276284 (visualID: 7030, editPartClassName: ModelPackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@45c4105b (visualID: 7016, editPartClassName: PackagePackageableElementCompartmentEditPart, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicy, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicy) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false) - // nodeRef: org.eclipse.papyrus.generation.diagram.idgen.impl.GenNodeRefImpl@668ade35 (name: null) (customPreferencePage: org.eclipse.papyrus.uml.diagram.pkg.CustomPackagePreferencePage, generatePreferencePage: false, generateTool: false) - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.COMMENT) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.COMMENT_CN) { - // node: org.eclipse.gmf.codegen.gmfgen.impl.GenChildNodeImpl@243f9178 (visualID: 3028, editPartClassName: CommentEditPartCN, itemSemanticEditPolicyClassName: CommentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: CommentCanonicalEditPolicyCN) (primaryDragEditPolicyQualifiedClassName: null, graphicalNodeEditPolicyClassName: CommentGraphicalNodeEditPolicyCN, createCommandClassName: CommentCreateCommandCN) - // containers: org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@7fdefe7e (visualID: 7010, editPartClassName: PackagePackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@25dfae35 (visualID: 7009, editPartClassName: ModelPackageableElementCompartmentEditPartTN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyTN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyTN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@68276284 (visualID: 7030, editPartClassName: ModelPackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@45c4105b (visualID: 7016, editPartClassName: PackagePackageableElementCompartmentEditPart, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicy, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicy) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false) - // nodeRef: org.eclipse.papyrus.generation.diagram.idgen.impl.GenNodeRefImpl@1cde2d0f (name: null) (customPreferencePage: null, generatePreferencePage: false, generateTool: false) - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.CONSTRAINT) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.CONSTRAINT_CN) { - // node: org.eclipse.gmf.codegen.gmfgen.impl.GenChildNodeImpl@248c8085 (visualID: 3029, editPartClassName: ConstraintEditPartCN, itemSemanticEditPolicyClassName: ConstraintItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ConstraintCanonicalEditPolicyCN) (primaryDragEditPolicyQualifiedClassName: null, graphicalNodeEditPolicyClassName: ConstraintGraphicalNodeEditPolicyCN, createCommandClassName: ConstraintCreateCommandCN) - // containers: org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@7fdefe7e (visualID: 7010, editPartClassName: PackagePackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@25dfae35 (visualID: 7009, editPartClassName: ModelPackageableElementCompartmentEditPartTN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyTN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyTN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@68276284 (visualID: 7030, editPartClassName: ModelPackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@45c4105b (visualID: 7016, editPartClassName: PackagePackageableElementCompartmentEditPart, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicy, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicy) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false) - // nodeRef: org.eclipse.papyrus.generation.diagram.idgen.impl.GenNodeRefImpl@21b3e77f (name: null) (customPreferencePage: null, generatePreferencePage: false, generateTool: false) - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.MODEL) { - if(ElementTypes.DIAGRAM_ID.equals(containerGraphicalType)) { - return true; - } - } - if(elementType == ElementTypes.MODEL_CN) { - // node: org.eclipse.gmf.codegen.gmfgen.impl.GenChildNodeImpl@4a545b13 (visualID: 3024, editPartClassName: ModelEditPartCN, itemSemanticEditPolicyClassName: ModelItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelCanonicalEditPolicyCN) (primaryDragEditPolicyQualifiedClassName: null, graphicalNodeEditPolicyClassName: ModelGraphicalNodeEditPolicyCN, createCommandClassName: ModelCreateCommandCN) - // containers: org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@7fdefe7e (visualID: 7010, editPartClassName: PackagePackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@25dfae35 (visualID: 7009, editPartClassName: ModelPackageableElementCompartmentEditPartTN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyTN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyTN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@68276284 (visualID: 7030, editPartClassName: ModelPackageableElementCompartmentEditPartCN, itemSemanticEditPolicyClassName: ModelPackageableElementCompartmentItemSemanticEditPolicyCN, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: ModelPackageableElementCompartmentCanonicalEditPolicyCN) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false)org.eclipse.gmf.codegen.gmfgen.impl.GenCompartmentImpl@45c4105b (visualID: 7016, editPartClassName: PackagePackageableElementCompartmentEditPart, itemSemanticEditPolicyClassName: PackagePackageableElementCompartmentItemSemanticEditPolicy, notationViewFactoryClassName: null) (canonicalEditPolicyClassName: PackagePackageableElementCompartmentCanonicalEditPolicy) (title: PackageableElementCompartment, canCollapse: false, hideIfEmpty: true, needsTitle: true, listLayout: false) - // nodeRef: org.eclipse.papyrus.generation.diagram.idgen.impl.GenNodeRefImpl@756899ca (name: null) (customPreferencePage: null, generatePreferencePage: false, generateTool: false) - if(ElementTypes.PACKAGE_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.MODEL_CN_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - if(ElementTypes.PACKAGE_COMPARTMENT_PACKAGEABLE_ELEMENT_HINT.equals(containerGraphicalType)) { - return true; - } - } - - // ///////////////////////////////////////////////////////////////////// - // Test possibility to provide a view based on the semantic nature and its expected container. - // ///////////////////////////////////////////////////////////////////// - - // IElementType may be null (especially when drop from ModelExplorer). - // In such a case, test the semantic EObject instead. - if(elementType == null) { - EObject domainElement = (EObject)op.getSemanticAdapter().getAdapter(EObject.class); - String domainElementGraphicalType = op.getSemanticHint(); - if(domainElementGraphicalType == null) { - domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType); - } else { - domainElementGraphicalType = registry.getNodeGraphicalType(domainElementGraphicalType, containerGraphicalType); - } - - if((!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) && (registry.isKnownNodeType(domainElementGraphicalType))) { - return true; - } - } - return false; - } - - @Override - public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - - if(semanticHint != null) { - return super.createNode(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); - } - - // Use the GraphicalTypeRegistry to find the expected type for a domain element - // Get the type of the container - String containerGraphicalType = containerView.getType(); - // Get the type of the domain element - EObject domainElement = (EObject)semanticAdapter.getAdapter(EObject.class); - String domainElementGraphicalType = registry.getNodeGraphicalType(domainElement, containerGraphicalType); - - // Create the expected node - if(!IGraphicalTypeRegistry.UNDEFINED_TYPE.equals(domainElementGraphicalType)) { - return super.createNode(semanticAdapter, containerView, domainElementGraphicalType, index, persisted, preferencesHint); - } - - Activator.log.error(new Exception("Could not create Node.")); - return null; - } - - @Override - protected void stampShortcut(View containerView, Node target) { - if(!ElementTypes.DIAGRAM_ID.equals(containerView.getDiagram().getType())) { - EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); - shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ - shortcutAnnotation.getDetails().put("modelID", ElementTypes.DIAGRAM_ID); //$NON-NLS-1$ - target.getEAnnotations().add(shortcutAnnotation); - } - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPartProvider.java deleted file mode 100644 index 54f36345406..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPartProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.papyrus.uml.diagram.pkg.edit.part.PackageDiagramEditPart; - -public class PackageDiagramEditPartProvider extends AbstractEditPartProvider { - - @Override - public boolean provides(IOperation operation) { - if(operation instanceof CreateGraphicEditPartOperation) { - View view = ((IEditPartOperation)operation).getView(); - - // Ensure current diagram is Package Diagram - if(ElementTypes.DIAGRAM_ID.equals(view.getType())) { - return true; - } - } - - return false; - } - - @Override - protected Class<?> getDiagramEditPartClass(View view) { - if(ElementTypes.DIAGRAM_ID.equals(view.getType())) { - return PackageDiagramEditPart.class; - } - - Activator.log.error(new Exception("Could not create EditPart.")); - return null; - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPolicyProvider.java deleted file mode 100644 index 2c49c9179df..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramEditPolicyProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider; -import org.eclipse.papyrus.uml.diagram.pkg.edit.policy.CustomDragDropEditPolicy; - -public class PackageDiagramEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider { - - public boolean provides(IOperation operation) { - - CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation; - if(!(epOperation.getEditPart() instanceof GraphicalEditPart)) { - return false; - } - GraphicalEditPart gep = (GraphicalEditPart)epOperation.getEditPart(); - String diagramType = gep.getNotationView().getDiagram().getType(); - if(!ElementTypes.DIAGRAM_ID.equals(diagramType)) { - return false; - } - - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackageEditPart) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPart) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackageEditPartCN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PackagePackageableElementCompartmentEditPartCN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.CommentEditPart) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.CommentEditPartCN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPart) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPartCN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartTN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPartTN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartCN) { - return true; - } - if(gep instanceof org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelPackageableElementCompartmentEditPartCN) { - return true; - } - - return false; - } - - public void createEditPolicies(EditPart editPart) { - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramViewProvider.java deleted file mode 100644 index 9046fe91dd3..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/provider/PackageDiagramViewProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation; -import org.eclipse.papyrus.uml.diagram.pkg.Activator; -import org.eclipse.papyrus.uml.diagram.pkg.factory.PackageDiagramViewFactory; - -public class PackageDiagramViewProvider extends AbstractViewProvider { - - @Override - protected boolean provides(CreateDiagramViewOperation operation) { - - if(ElementTypes.DIAGRAM_ID.equals(operation.getSemanticHint())) { - return true; - } - - return false; - } - - @Override - protected Class<?> getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) { - if(ElementTypes.DIAGRAM_ID.equals(diagramKind)) { - return PackageDiagramViewFactory.class; - } - - Activator.log.error(new Exception("Could not create View.")); - return null; - } -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CreatePackageDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CreatePackageDiagramWithNavigationHandler.java deleted file mode 100644 index e0b3d3b2897..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CreatePackageDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreatePackageDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreatePackageDiagramWithNavigationHandler() {
- super(new PackageDiagramCreateCommand(), new PackageDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java deleted file mode 100644 index 9f2c29565fd..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java +++ /dev/null @@ -1,51 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Nizar GUEDIDI CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.uml.diagram.pkg.preferences.ModelPreferencePage;
-
-public class CustomModelPreferencePage extends ModelPreferencePage {
-
- static {
- compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.FALSE); //$NON-NLS-1$
- }
-
- /**
- * Initialize defaults using a specified {@link IPreferenceStore}
- *
- * @param store
- * the preference store.
- */
- public static void initDefaults(IPreferenceStore store) {
- // Start of user code custom default initializations
- // End of user code
-
- store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200);
- store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100);
- // Initialize default visibility for compartments in preference page.
- for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) {
- String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName));
- }
-
- // Initialize default title visibility for compartments in preference page.
- for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) {
- String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
- store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName));
- }
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java deleted file mode 100644 index 7332b08f5b9..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java +++ /dev/null @@ -1,51 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *
- * Nizar GUEDIDI CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.uml.diagram.pkg.preferences.PackagePreferencePage;
-
-public class CustomPackagePreferencePage extends PackagePreferencePage {
-
- static {
- compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.FALSE); //$NON-NLS-1$
- }
-
- /**
- * Initialize defaults using a specified {@link IPreferenceStore}
- *
- * @param store
- * the preference store.
- */
- public static void initDefaults(IPreferenceStore store) {
- // Start of user code custom default initializations
- // End of user code
-
- store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200);
- store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100);
- // Initialize default visibility for compartments in preference page.
- for(String compartmentName : compartmentDefaultVisibilityMap.keySet()) {
- String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
- store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName));
- }
-
- // Initialize default title visibility for compartments in preference page.
- for(String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) {
- String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
- store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName));
- }
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreationCondition.java deleted file mode 100644 index 08c43df7061..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/PackageDiagramCreationCondition.java +++ /dev/null @@ -1,33 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * Atos Origin - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-
-/**
- * PackageDiagramCreationCondition class allows to check if a Class diagram can be added to the
- * selected element.
- */
-public class PackageDiagramCreationCondition extends PerspectiveContextDependence {
-
- /**
- * @return whether the diagram can be created.
- */
- public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package;
- }
- return false;
- }
-
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/CustomDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/CustomDragDropEditPolicy.java deleted file mode 100644 index fe78e45de1b..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/edit/policy/CustomDragDropEditPolicy.java +++ /dev/null @@ -1,33 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg.edit.policy;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * <pre>
- * Customization of the DND edit policy for the Package Diagram.
- *
- * Never use specific drop implemented in ClassDiagram, which are
- * related to elements that are not used currently in PackageDiagram.
- * </pre>
- */
-public class CustomDragDropEditPolicy extends PackageDiagramDragDropEditPolicy {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Set<Integer> getDroppableElementVisualId() {
- Set<Integer> droppableElementsVisualID = new HashSet<Integer>();
- return droppableElementsVisualID;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CPackageEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CPackageEditPartProvider.java deleted file mode 100644 index 6e3fdbe2f3c..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CPackageEditPartProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.pkg.provider;
-
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.providers.CUMLEditPartProvider;
-import org.eclipse.papyrus.uml.diagram.clazz.part.UMLVisualIDRegistry;
-
-/**
- * Reuse the Custom EditPartProvider from the Class Diagram
- *
- * @author Camille Letavernier
- */
-public class CPackageEditPartProvider extends CUMLEditPartProvider {
-
- @Override
- public synchronized boolean provides(IOperation operation) {
- super.provides(operation);
- if(operation instanceof CreateGraphicEditPartOperation) {
- View view = ((IEditPartOperation)operation).getView();
- if(!ElementTypes.DIAGRAM_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
- return false;
- }
- if(isAllowCaching() && getCachedPart(view) != null) {
- return true;
- }
- IGraphicalEditPart part = createEditPart(view);
- if(part != null) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CustomEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CustomEditPolicyProvider.java deleted file mode 100644 index cd58245db87..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/provider/CustomEditPolicyProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.pkg.provider; - -import org.eclipse.gef.EditPart; - -public class CustomEditPolicyProvider extends PackageDiagramEditPolicyProvider { - - @Override - public void createEditPolicies(EditPart editPart) { - super.createEditPolicies(editPart); - } - -} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF index 6464f04410f..f64cb487ea0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/META-INF/MANIFEST.MF @@ -78,13 +78,12 @@ Require-Bundle: org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0. org.eclipse.emf.ecore.edit,
org.eclipse.ocl.ecore,
org.eclipse.emf.validation,
- org.eclipse.gef
+ org.eclipse.gef,
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.profile.part.UMLDiag
- ramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.profile;singleton
- :=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.profile.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.profile; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileDiagramWithNavigationHandler.java deleted file mode 100644 index 99300d9cbbe..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateProfileDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateProfileDiagramWithNavigationHandler() {
- super(new CreateProfileDiagramCommand(), new ProfileDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/ProfileDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/ProfileDiagramCreationCondition.java index 7b5240983bb..a1cb00e9b7f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/ProfileDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/ProfileDiagramCreationCondition.java @@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.profile; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Profile;
/**
* ProfileDiagramCreationCondition class allows to check if a Profile diagram can be added to the
@@ -24,9 +23,6 @@ public class ProfileDiagramCreationCondition extends PerspectiveContextDependenc * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof Profile;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomAssociationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomAssociationCreateCommand.java index 2d5f5c4192e..d74dfd36c8e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomAssociationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/CustomAssociationCreateCommand.java @@ -68,7 +68,7 @@ public class CustomAssociationCreateCommand extends org.eclipse.papyrus.uml.diag }
if(source instanceof Type && target instanceof Type && container instanceof Package) {
- Association newElement = (Association)ProfileDiagramAssociationHelper.createAssociation(getEditingDomain(), (Type)source, (Type)target, container);
+ Association newElement = (Association) ProfileDiagramAssociationHelper.createAssociation(getEditingDomain(), (Type) source, (Type) target, container, null);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java index 77c25c81ff3..5ad3a99b783 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/commands/PropertyCommandForAssociation.java @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassPropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Association;
@@ -39,8 +40,8 @@ public class PropertyCommandForAssociation extends ClassPropertyCreateCommand { * @param req
* the req to launch the command
*/
- public PropertyCommandForAssociation(CreateElementRequest req) {
- super(req);
+ public PropertyCommandForAssociation(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/MultiAssociationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/MultiAssociationHelper.java index 1b53bdd9ac4..5405d72767d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/MultiAssociationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/MultiAssociationHelper.java @@ -49,6 +49,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DeleteLinkDuringCreationCommand;
import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper;
@@ -374,7 +375,7 @@ public class MultiAssociationHelper extends ElementHelper { // 3.1 creation of the property
CreateElementRequest request = new CreateElementRequest(getEditingDomain(), association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
request.setParameter("type", newSemanticElement); //$NON-NLS-1$
- EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request);
+ EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request, DiagramUtils.getDiagramFrom(sourceEditPart));
propertyCreateCommand.setReuseParentTransaction(true);
((CompoundCommand)command).add(new ICommandProxy(propertyCreateCommand));
@@ -456,7 +457,7 @@ public class MultiAssociationHelper extends ElementHelper { // 0. add semantic
CreateElementRequest request = new CreateElementRequest(getEditingDomain(), association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
request.setParameter("type", newSemanticElement); //$NON-NLS-1$
- EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request);
+ EditElementCommand propertyCreateCommand = new PropertyCommandForAssociation(request, DiagramUtils.getDiagramFrom(sourceEditPart));
((CompoundCommand)command).add(new ICommandProxy(propertyCreateCommand));
//System.err.println("0. add semantic, can execute?" + command.canExecute());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/ProfileDiagramAssociationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/ProfileDiagramAssociationHelper.java index 1bd91b82a59..ca1a2132fee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/ProfileDiagramAssociationHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/custom/helper/ProfileDiagramAssociationHelper.java @@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.common.helper.NamedElementHelper;
import org.eclipse.papyrus.uml.diagram.profile.custom.commands.PropertyCommandForAssociation;
import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers;
@@ -42,24 +43,26 @@ public class ProfileDiagramAssociationHelper { * Returns the created Association corresponding to these parameters
*
* @param domain
- * the {@link TransactionalEditingDomain}
+ * the {@link TransactionalEditingDomain}
* @param source
- * the source of the {@link Association}
+ * the source of the {@link Association}
* @param target
- * the target of the {@link Association}
+ * the target of the {@link Association}
* @param container
- * the {@link Container} of the {@link Association}
+ * the {@link Container} of the {@link Association}
+ * @param diagram
+ * the current diagram
* @return
* The created Association corresponding to these parameters
*/
- public static EObject createAssociation(TransactionalEditingDomain domain, Type source, Type target, Package container) {
+ public static EObject createAssociation(TransactionalEditingDomain domain, Type source, Type target, Package container, Diagram diagram) {
Association association = UMLFactory.eINSTANCE.createAssociation();
String targetString = target.getName().substring(0, 1).toLowerCase() + target.getName().substring(1, target.getName().length());
String sourceString = source.getName().substring(0, 1).toLowerCase() + source.getName().substring(1, source.getName().length());
// create target property
CreateElementRequest request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- EditElementCommand c = new PropertyCommandForAssociation(request);
+ EditElementCommand c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
@@ -81,7 +84,7 @@ public class ProfileDiagramAssociationHelper { // create source property
request = new CreateElementRequest(domain, association, UMLElementTypes.Property_3002, UMLPackage.eINSTANCE.getAssociation_OwnedEnd());
- c = new PropertyCommandForAssociation(request);
+ c = new PropertyCommandForAssociation(request, diagram);
try {
c.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen index 6c1a36c3b01..bc3e7d69ba6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.gmfgen @@ -1241,7 +1241,7 @@ <children xsi:type="gmfgen:GenStandardPreferencePage" iD="org.eclipse.uml2.uml.diagram.pathmaps" name="Pathmaps" kind="Pathmaps"/>
</preferencePages>
</diagram>
- <plugin iD="org.eclipse.papyrus.uml.diagram.profile" name="PapyrusUMLProfileDiagram" provider="CEA LIST" version="1.0.0.vqualifier">
+ <plugin iD="org.eclipse.papyrus.uml.diagram.profile" name="PapyrusUMLProfileDiagram" provider="CEA LIST" version="1.0.0.qualifier">
<requiredPlugins>org.eclipse.draw2d</requiredPlugins>
<requiredPlugins>org.eclipse.gmf.runtime.draw2d.ui</requiredPlugins>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml index dbdd1c909e6..0140f6c0a48 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml @@ -994,51 +994,6 @@ sequence="F5"/> </extension> -<extension
- point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramCommand"
- icon="icons/obj16/Diagram_Profile.gif"
- label="Create a new Profile Diagram"
- style="push"
- tooltip="Create a new Profile Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLProfile"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command commandId="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramCommand"
- icon="icons/obj16/Diagram_Profile.gif"
- label="Create a new Profile Diagram"
- style="push"
- tooltip="Create a new Profile Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLProfile"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramCommand"
- icon="icons/obj16/Diagram_Profile.gif"
- label="Create a new Profile Diagram"
- style="push"
- tooltip="Create a new Profile Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLProfile"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
-</extension> <extension point="org.eclipse.ui.menus" id="context-menus"> <?gmfgen generated="true"?> @@ -1290,21 +1245,6 @@ name="New PapyII Profile Diagram( Papyrus II)">
</command>
</extension>
-<extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramCommand">
- <activeWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
-</extension>
<extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/AssociationNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/AssociationNodeCreateCommand.java index 1892a88e39f..e15047a7625 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/AssociationNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/AssociationNodeCreateCommand.java @@ -24,10 +24,14 @@ 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.Association;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class AssociationNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class AssociationNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public AssociationNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public AssociationNodeCreateCommand(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 AssociationNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new AssociationNodeCreateCommand(req, eObject);
+ public static AssociationNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new AssociationNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public AssociationNodeCreateCommand(CreateElementRequest req) {
+ public AssociationNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class AssociationNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getAssociation());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class AssociationNodeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Association newElement = UMLFactory.eINSTANCE.createAssociation();
- 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");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassOperationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassOperationCreateCommand.java index b4ea73286a2..bd14b5496c3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassOperationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassOperationCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ClassOperationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ClassOperationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ClassOperationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ClassOperationCreateCommand(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 ClassOperationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ClassOperationCreateCommand(req, eObject);
+ public static ClassOperationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassOperationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassOperationCreateCommand(CreateElementRequest req) {
+ public ClassOperationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ClassOperationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ClassOperationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- Class owner = (Class)getElementToEdit();
- owner.getOwnedOperations().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3020(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java index 37ab2976f34..b8b6ab47422 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.StructuredClassifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ClassPropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ClassPropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ClassPropertyCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ClassPropertyCreateCommand(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 ClassPropertyCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ClassPropertyCreateCommand(req, eObject);
+ public static ClassPropertyCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ClassPropertyCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ClassPropertyCreateCommand(CreateElementRequest req) {
+ public ClassPropertyCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ClassPropertyCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ClassPropertyCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- StructuredClassifier owner = (StructuredClassifier)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ StructuredClassifier qualifiedTarget = (StructuredClassifier)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentCreateCommandCN.java index f7656c486c7..a4f86c43308 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentCreateCommandCN 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentCreateCommandCN 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_1007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentEditPartCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentEditPartCreateCommand.java index 893a03df628..3d0cd08bc93 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentEditPartCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/CommentEditPartCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentEditPartCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentEditPartCreateCommand extends EditElementCommand { /**
* @generated
*/
- public CommentEditPartCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CommentEditPartCreateCommand(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 CommentEditPartCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CommentEditPartCreateCommand(req, eObject);
+ public static CommentEditPartCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentEditPartCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentEditPartCreateCommand(CreateElementRequest req) {
+ public CommentEditPartCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentEditPartCreateCommand 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentEditPartCreateCommand 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_1002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommand.java index ecd94230efc..d912e3f52c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ConstraintCreateCommand 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();
}
/**
@@ -96,8 +103,19 @@ public class ConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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_Constraint_1014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommandCN.java index b8967a509b3..2b84e48cfd3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ConstraintCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,7 +93,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();
}
/**
@@ -96,8 +103,19 @@ public class ConstraintCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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_Constraint_1028(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommand.java index 1099dec110c..82670619774 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommand(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 DataTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommand(req, eObject);
+ public static DataTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommand(CreateElementRequest req) {
+ public DataTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- 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_DataType_2010(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommandCN.java index 2f2302e4159..7a9da15a613 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public DataTypeCreateCommandCN(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 DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new DataTypeCreateCommandCN(req, eObject);
+ public static DataTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeCreateCommandCN(CreateElementRequest req) {
+ public DataTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDataType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DataType newElement = UMLFactory.eINSTANCE.createDataType();
- 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_DataType_3027(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeOperationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeOperationCreateCommand.java index 6173070ed63..dca0c1628b3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeOperationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypeOperationCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypeOperationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypeOperationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DataTypeOperationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataTypeOperationCreateCommand(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 DataTypeOperationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataTypeOperationCreateCommand(req, eObject);
+ public static DataTypeOperationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypeOperationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypeOperationCreateCommand(CreateElementRequest req) {
+ public DataTypeOperationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypeOperationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypeOperationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Operation newElement = UMLFactory.eINSTANCE.createOperation();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedOperations().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedOperations().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Operation_3019(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypePropertyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypePropertyCreateCommand.java index eb8e6085e5a..21e93277d69 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypePropertyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DataTypePropertyCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DataTypePropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DataTypePropertyCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DataTypePropertyCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DataTypePropertyCreateCommand(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 DataTypePropertyCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DataTypePropertyCreateCommand(req, eObject);
+ public static DataTypePropertyCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DataTypePropertyCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DataTypePropertyCreateCommand(CreateElementRequest req) {
+ public DataTypePropertyCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DataTypePropertyCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DataTypePropertyCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Property newElement = UMLFactory.eINSTANCE.createProperty();
- DataType owner = (DataType)getElementToEdit();
- owner.getOwnedAttributes().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 {
+ DataType qualifiedTarget = (DataType)target;
+ qualifiedTarget.getOwnedAttributes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Property_3018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DependencyNodeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DependencyNodeCreateCommand.java index 58d2c0c0313..cde0a27a69e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DependencyNodeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/DependencyNodeCreateCommand.java @@ -24,10 +24,14 @@ 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.Dependency;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class DependencyNodeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DependencyNodeCreateCommand(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 DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DependencyNodeCreateCommand(req, eObject);
+ public static DependencyNodeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DependencyNodeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DependencyNodeCreateCommand(CreateElementRequest req) {
+ public DependencyNodeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class DependencyNodeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDependency());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class DependencyNodeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Dependency newElement = UMLFactory.eINSTANCE.createDependency();
- 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");
+ }
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommand.java index 828b566d389..18ad56a25df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommand(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 EnumerationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommand(req, eObject);
+ public static EnumerationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommand(CreateElementRequest req) {
+ public EnumerationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- 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_Enumeration_2006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommandCN.java index fb487bb5eda..e1fc1c2652b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public EnumerationCreateCommandCN(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 EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new EnumerationCreateCommandCN(req, eObject);
+ public static EnumerationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationCreateCommandCN(CreateElementRequest req) {
+ public EnumerationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumeration());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();
- 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_Enumeration_3025(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationLiteralCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationLiteralCreateCommand.java index 297ba3d0a79..ec3811234e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationLiteralCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/EnumerationLiteralCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EnumerationLiteralCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EnumerationLiteralCreateCommand(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 EnumerationLiteralCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EnumerationLiteralCreateCommand(req, eObject);
+ public static EnumerationLiteralCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EnumerationLiteralCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EnumerationLiteralCreateCommand(CreateElementRequest req) {
+ public EnumerationLiteralCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getEnumerationLiteral());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class EnumerationLiteralCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
EnumerationLiteral newElement = UMLFactory.eINSTANCE.createEnumerationLiteral();
- Enumeration owner = (Enumeration)getElementToEdit();
- owner.getOwnedLiterals().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 {
+ Enumeration qualifiedTarget = (Enumeration)target;
+ qualifiedTarget.getOwnedLiterals().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_EnumerationLiteral_1037(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommand.java index 1075ed082d0..e8b1d6ac520 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class MetaclassCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class MetaclassCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MetaclassCreateCommand(CreateElementRequest req, EObject eObject) {
+ public MetaclassCreateCommand(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 MetaclassCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new MetaclassCreateCommand(req, eObject);
+ public static MetaclassCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new MetaclassCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public MetaclassCreateCommand(CreateElementRequest req) {
+ public MetaclassCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class MetaclassCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class MetaclassCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- 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_Class_1031(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommandCN.java index 0f688db4951..b9e2c735bdc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/MetaclassCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class MetaclassCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class MetaclassCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public MetaclassCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public MetaclassCreateCommandCN(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 MetaclassCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new MetaclassCreateCommandCN(req, eObject);
+ public static MetaclassCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new MetaclassCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public MetaclassCreateCommandCN(CreateElementRequest req) {
+ public MetaclassCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class MetaclassCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClass_());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class MetaclassCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Class newElement = UMLFactory.eINSTANCE.createClass();
- 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_Class_3028(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandCN.java index df8096a38b4..8b599d7d1e4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ModelCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandCN(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 ModelCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandCN(req, eObject);
+ public static ModelCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandCN(CreateElementRequest req) {
+ public ModelCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ModelCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ModelCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_1027(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandTN.java index fef0c36c1f6..9dcbfe97968 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ModelCreateCommandTN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ModelCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ModelCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ModelCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ModelCreateCommandTN(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 ModelCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ModelCreateCommandTN(req, eObject);
+ public static ModelCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ModelCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ModelCreateCommandTN(CreateElementRequest req) {
+ public ModelCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ModelCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getModel());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ModelCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Model newElement = UMLFactory.eINSTANCE.createModel();
- 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_Model_2005(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommand.java index 169130d4d46..26d111af1d7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommand.java @@ -24,10 +24,14 @@ 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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommand(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 PackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommand(req, eObject);
+ public static PackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommand(CreateElementRequest req) {
+ public PackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_2007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommandCN.java index a6c38f618d6..ecbf810ad3e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PackageCreateCommandCN.java @@ -24,10 +24,14 @@ 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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandCN(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 PackageCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandCN(req, eObject);
+ public static PackageCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req) {
+ public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PackageCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_1012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommand.java index feb81be1460..5eb398e2a1c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommand(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 PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommand(req, eObject);
+ public static PrimitiveTypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommand(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PrimitiveTypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- 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_PrimitiveType_2009(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommandCN.java index 7e37c877ce7..250c864705d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/PrimitiveTypeCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PrimitiveTypeCreateCommandCN(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 PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PrimitiveTypeCreateCommandCN(req, eObject);
+ public static PrimitiveTypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PrimitiveTypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PrimitiveTypeCreateCommandCN(CreateElementRequest req) {
+ public PrimitiveTypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPrimitiveType());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class PrimitiveTypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
PrimitiveType newElement = UMLFactory.eINSTANCE.createPrimitiveType();
- 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_PrimitiveType_3026(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandCN.java index 51ee2b219ab..530c201f056 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ProfileCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ProfileCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public ProfileCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public ProfileCreateCommandCN(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 ProfileCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new ProfileCreateCommandCN(req, eObject);
+ public static ProfileCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ProfileCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public ProfileCreateCommandCN(CreateElementRequest req) {
+ public ProfileCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ProfileCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProfile());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ProfileCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Profile newElement = UMLFactory.eINSTANCE.createProfile();
- 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_Profile_1024(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandTN.java index 9ba8cb4d502..7f9aba0f687 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ProfileCreateCommandTN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ProfileCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ProfileCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ProfileCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ProfileCreateCommandTN(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 ProfileCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ProfileCreateCommandTN(req, eObject);
+ public static ProfileCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ProfileCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ProfileCreateCommandTN(CreateElementRequest req) {
+ public ProfileCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ProfileCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProfile());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ProfileCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Profile newElement = UMLFactory.eINSTANCE.createProfile();
- 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_Profile_1030(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java index 2da73b61d4c..45baa2b3ab7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java @@ -37,7 +37,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +47,25 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ShortCutDiagramCreateCommand(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 ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ShortCutDiagramCreateCommand(req, eObject);
+ public static ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ShortCutDiagramCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req) {
+ public ShortCutDiagramCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommand.java index 76a757dd4d5..d873106e5e4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommand.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StereotypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StereotypeCreateCommand extends EditElementCommand { /**
* @generated
*/
- public StereotypeCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StereotypeCreateCommand(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 StereotypeCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StereotypeCreateCommand(req, eObject);
+ public static StereotypeCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StereotypeCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StereotypeCreateCommand(CreateElementRequest req) {
+ public StereotypeCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class StereotypeCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStereotype());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class StereotypeCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Stereotype newElement = UMLFactory.eINSTANCE.createStereotype();
- Package owner = (Package)getElementToEdit();
- owner.getOwnedStereotypes().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.getOwnedStereotypes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Stereotype_1026(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommandCN.java index 09d0f4c9556..9e28742c3ef 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/StereotypeCreateCommandCN.java @@ -24,11 +24,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.profile.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StereotypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StereotypeCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public StereotypeCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public StereotypeCreateCommandCN(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 StereotypeCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new StereotypeCreateCommandCN(req, eObject);
+ public static StereotypeCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StereotypeCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public StereotypeCreateCommandCN(CreateElementRequest req) {
+ public StereotypeCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class StereotypeCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStereotype());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class StereotypeCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Stereotype newElement = UMLFactory.eINSTANCE.createStereotype();
- Package owner = (Package)getElementToEdit();
- owner.getOwnedStereotypes().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.getOwnedStereotypes().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Stereotype_1023(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java index 34db2e8b22d..e251b13e49f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypePropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypePropertyCreateCommand(req));
+ return getGEFWrapper(new DataTypePropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java index bb44b84368c..c9fa0a87d87 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeAttributeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypePropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeAttributeCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypePropertyCreateCommand(req));
+ return getGEFWrapper(new DataTypePropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java index 8bcf29e809b..1f2b1498e67 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeOperationCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeOperationCreateCommand(req));
+ return getGEFWrapper(new DataTypeOperationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java index 983a500c179..19d55d0a312 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/DataTypeOperationCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeOperationCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class DataTypeOperationCompartmentItemSemanticEditPolicyCN extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeOperationCreateCommand(req));
+ return getGEFWrapper(new DataTypeOperationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java index 2118d34b248..2ae67efa915 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.EnumerationLiteralCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicy exte if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java index 7a6f8f8bbd5..449b39ff4a8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.EnumerationLiteralCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class EnumerationEnumerationLiteralCompartmentItemSemanticEditPolicyCN ex if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationLiteralCreateCommand(req));
+ return getGEFWrapper(new EnumerationLiteralCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java index cbf611fb2ec..4bc93540d2f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -64,49 +65,49 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyCN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java index d6f0b930619..996af869f74 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ModelPackageableElementCompartmentItemSemanticEditPolicyTN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -64,49 +65,49 @@ public class ModelPackageableElementCompartmentItemSemanticEditPolicyTN extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackageItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackageItemSemanticEditPolicyCN.java index 79079388c29..0c64616f04a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackageItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackageItemSemanticEditPolicyCN.java @@ -38,6 +38,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentAnnotatedElementCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintConstrainedElementCreateCommand;
@@ -114,7 +115,7 @@ public class PackageItemSemanticEditPolicyCN extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java index be6d57e7374..3abd078798c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -64,49 +65,49 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java index 6c5f53d1cdb..368195c3f7e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -64,49 +65,49 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfileDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfileDiagramItemSemanticEditPolicy.java index 19fc56375c5..348fbb9f59c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfileDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfileDiagramItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.AssociationNodeCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentEditPartCreateCommand;
@@ -74,79 +75,79 @@ public class ProfileDiagramItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DependencyNodeCreateCommand(req));
+ return getGEFWrapper(new DependencyNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Association_2015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationNodeCreateCommand(req));
+ return getGEFWrapper(new AssociationNodeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Stereotype_1026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StereotypeCreateCommand(req));
+ return getGEFWrapper(new StereotypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_1031 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new MetaclassCreateCommand(req));
+ return getGEFWrapper(new MetaclassCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_1002 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentEditPartCreateCommand(req));
+ return getGEFWrapper(new CommentEditPartCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1014 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_2005 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandTN(req));
+ return getGEFWrapper(new ModelCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1030 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandTN(req));
+ return getGEFWrapper(new ProfileCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_2007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommand(req));
+ return getGEFWrapper(new PackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_2006 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommand(req));
+ return getGEFWrapper(new EnumerationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_2009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommand(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_2010 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommand(req));
+ return getGEFWrapper(new DataTypeCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Diagram_2016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShortCutDiagramCreateCommand(req));
+ return getGEFWrapper(new ShortCutDiagramCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyCN.java index b4af3a90901..95339f6d229 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -66,61 +67,61 @@ public class ProfilePackageableElementCompartmentItemSemanticEditPolicyCN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StereotypeCreateCommandCN(req));
+ return getGEFWrapper(new StereotypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_1007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new MetaclassCreateCommandCN(req));
+ return getGEFWrapper(new MetaclassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyTN.java index 8c917e04bc1..fd27609fb7d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/ProfilePackageableElementCompartmentItemSemanticEditPolicyTN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.DataTypeCreateCommandCN;
@@ -66,61 +67,61 @@ public class ProfilePackageableElementCompartmentItemSemanticEditPolicyTN extend if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StereotypeCreateCommandCN(req));
+ return getGEFWrapper(new StereotypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Model_1027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ModelCreateCommandCN(req));
+ return getGEFWrapper(new ModelCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Profile_1024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ProfileCreateCommandCN(req));
+ return getGEFWrapper(new ProfileCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_1012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_1028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandCN(req));
+ return getGEFWrapper(new ConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Enumeration_3025 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EnumerationCreateCommandCN(req));
+ return getGEFWrapper(new EnumerationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.PrimitiveType_3026 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req));
+ return getGEFWrapper(new PrimitiveTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DataType_3027 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DataTypeCreateCommandCN(req));
+ return getGEFWrapper(new DataTypeCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_1007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Class_3028 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new MetaclassCreateCommandCN(req));
+ return getGEFWrapper(new MetaclassCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicy.java index 0eb212b9a93..429f607c13a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassPropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class StereotypeAttributeCompartmentItemSemanticEditPolicy extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassPropertyCreateCommand(req));
+ return getGEFWrapper(new ClassPropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicyCN.java index 3df6aeea8fb..092dfbd4373 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeAttributeCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassPropertyCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class StereotypeAttributeCompartmentItemSemanticEditPolicyCN extends UMLB if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassPropertyCreateCommand(req));
+ return getGEFWrapper(new ClassPropertyCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicy.java index de4e6282012..6e579c8b851 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassOperationCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class StereotypeOperationCompartmentItemSemanticEditPolicy extends UMLBas if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassOperationCreateCommand(req));
+ return getGEFWrapper(new ClassOperationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicyCN.java index 9303a158233..9f5dd0b9126 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/policies/StereotypeOperationCompartmentItemSemanticEditPolicyCN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.profile.edit.commands.ClassOperationCreateCommand;
import org.eclipse.papyrus.uml.diagram.profile.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class StereotypeOperationCompartmentItemSemanticEditPolicyCN extends UMLB if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ClassOperationCreateCommand(req));
+ return getGEFWrapper(new ClassOperationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java index ed084c0adea..eff446e1242 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLVisualIDRegistry.java @@ -183,13 +183,7 @@ public class UMLVisualIDRegistry { * @generated
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getProfile().isSuperTypeOf(domainElement.eClass()) && isDiagram((Profile)domainElement)) {
- return ProfileDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return ProfileDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF index f986c06dea4..137f52cd889 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/META-INF/MANIFEST.MF @@ -65,19 +65,18 @@ Require-Bundle: org.eclipse.core.expressions, org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
org.eclipse.gmf.tooling.runtime,
org.eclipse.papyrus.uml.diagram.menu;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.constraints;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.constraints;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDia
- gramEditorPlugin
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence;singleto
- n:=true
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence; singleton:=true
Import-Package: org.eclipse.core.databinding.observable,
org.eclipse.papyrus.infra.emf.databinding,
org.eclipse.papyrus.infra.tools.databinding,
org.eclipse.papyrus.uml.tools.databinding,
org.eclipse.papyrus.views.properties.contexts,
org.eclipse.papyrus.views.properties.modelelement
-
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java deleted file mode 100644 index 9ac52e8aa9f..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/CreateSequenceDiagramWithNavigationHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateSequenceDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateSequenceDiagramWithNavigationHandler() {
- super(new CreateSequenceDiagramCommand(), new SequenceDiagramCreationCondition());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java index 5f701bcc345..eeb5331c50f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/SequenceDiagramCreationCondition.java @@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.sequence; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.Interaction;
/**
* SequenceDiagramCreationCondition class allows to check if a Sequence diagram can be added to the
@@ -25,10 +24,6 @@ public class SequenceDiagramCreationCondition extends PerspectiveContextDependen */
@Override
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- // TODO : to specify according to the spec
- return selectedElement instanceof Interaction;
- }
return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomActionExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomActionExecutionSpecificationCreateCommand.java index b606523c5a9..0fa6f7c087a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomActionExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomActionExecutionSpecificationCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ActionExecutionSpecificationCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -37,8 +38,8 @@ public class CustomActionExecutionSpecificationCreateCommand extends ActionExecu * @param req
* @param eObject
*/
- public CustomActionExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomActionExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -46,8 +47,8 @@ public class CustomActionExecutionSpecificationCreateCommand extends ActionExecu *
* @param req
*/
- public CustomActionExecutionSpecificationCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomActionExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomBehaviorExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomBehaviorExecutionSpecificationCreateCommand.java index 3524e205cbf..73095cc1c9f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomBehaviorExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomBehaviorExecutionSpecificationCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.BehaviorExecutionSpecificationCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -37,8 +38,8 @@ public class CustomBehaviorExecutionSpecificationCreateCommand extends BehaviorE * @param req
* @param eObject
*/
- public CustomBehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomBehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -46,8 +47,8 @@ public class CustomBehaviorExecutionSpecificationCreateCommand extends BehaviorE *
* @param req
*/
- public CustomBehaviorExecutionSpecificationCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomBehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragment2CreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragment2CreateCommand.java index 31df7eff2fc..97b5e9d1e6f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragment2CreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragment2CreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CombinedFragment2CreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -36,8 +37,8 @@ public class CustomCombinedFragment2CreateCommand extends CombinedFragment2Creat * @param req
* @param eObject
*/
- public CustomCombinedFragment2CreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomCombinedFragment2CreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -45,8 +46,8 @@ public class CustomCombinedFragment2CreateCommand extends CombinedFragment2Creat *
* @param req
*/
- public CustomCombinedFragment2CreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomCombinedFragment2CreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragmentCreateCommand.java index 98c68a5360a..41320d8ee3f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomCombinedFragmentCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CombinedFragmentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -41,8 +42,8 @@ public class CustomCombinedFragmentCreateCommand extends CombinedFragmentCreateC * @param req
* @param eObject
*/
- public CustomCombinedFragmentCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomCombinedFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -50,8 +51,8 @@ public class CustomCombinedFragmentCreateCommand extends CombinedFragmentCreateC *
* @param req
*/
- public CustomCombinedFragmentCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomCombinedFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConsiderIgnoreFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConsiderIgnoreFragmentCreateCommand.java index df07d86fcdc..c7cfa87305d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConsiderIgnoreFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConsiderIgnoreFragmentCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ConsiderIgnoreFragmentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -42,8 +43,8 @@ public class CustomConsiderIgnoreFragmentCreateCommand extends ConsiderIgnoreFra * @param req
* @param eObject
*/
- public CustomConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -51,8 +52,8 @@ public class CustomConsiderIgnoreFragmentCreateCommand extends ConsiderIgnoreFra *
* @param req
*/
- public CustomConsiderIgnoreFragmentCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConstraintCreateCommand.java index 523990ac3db..89182ed481c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomConstraintCreateCommand.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.command; import org.eclipse.emf.ecore.EObject;
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.uml.diagram.sequence.edit.commands.ConstraintCreateCommand;
import org.eclipse.uml2.uml.Lifeline;
@@ -33,8 +34,8 @@ public class CustomConstraintCreateCommand extends ConstraintCreateCommand { * @param req
* @param eObject
*/
- public CustomConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
this.eObject = eObject;
}
@@ -43,8 +44,8 @@ public class CustomConstraintCreateCommand extends ConstraintCreateCommand { *
* @param req
*/
- public CustomConstraintCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
protected EObject getElementToEdit() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomContinuationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomContinuationCreateCommand.java index 38d1181ce83..8c312db57e5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomContinuationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomContinuationCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ContinuationCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.CombinedFragment;
@@ -39,8 +40,8 @@ public class CustomContinuationCreateCommand extends ContinuationCreateCommand { * @param req
* @param eObject
*/
- public CustomContinuationCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomContinuationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -48,8 +49,8 @@ public class CustomContinuationCreateCommand extends ContinuationCreateCommand { *
* @param req
*/
- public CustomContinuationCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomContinuationCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDestructionOccurrenceSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDestructionOccurrenceSpecificationCreateCommand.java index 19268067955..80de7c7c4d6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDestructionOccurrenceSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDestructionOccurrenceSpecificationCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.DestructionOccurrenceSpecificationCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
@@ -38,8 +39,8 @@ public class CustomDestructionOccurrenceSpecificationCreateCommand extends Destr * @param req
* @param eObject
*/
- public CustomDestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomDestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -47,8 +48,8 @@ public class CustomDestructionOccurrenceSpecificationCreateCommand extends Destr *
* @param req
*/
- public CustomDestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomDestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintCreateCommand.java index 0c3622370e4..ad9124326a7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.DurationConstraintCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -42,8 +43,8 @@ public class CustomDurationConstraintCreateCommand extends DurationConstraintCre * @param req
* @param eObject
*/
- public CustomDurationConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomDurationConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -51,8 +52,8 @@ public class CustomDurationConstraintCreateCommand extends DurationConstraintCre *
* @param req
*/
- public CustomDurationConstraintCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomDurationConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintInMessageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintInMessageCreateCommand.java index 988bc22ea0a..0c86a091340 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintInMessageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationConstraintInMessageCreateCommand.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.command; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.DurationConstraintInMessageCreateCommand;
/**
@@ -28,8 +29,8 @@ public class CustomDurationConstraintInMessageCreateCommand extends DurationCons * @param req
* @param eObject
*/
- public CustomDurationConstraintInMessageCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomDurationConstraintInMessageCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -37,8 +38,8 @@ public class CustomDurationConstraintInMessageCreateCommand extends DurationCons *
* @param req
*/
- public CustomDurationConstraintInMessageCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomDurationConstraintInMessageCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationObservationCreateCommand.java index 5b553c993b4..335a4892e7d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomDurationObservationCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.DurationObservationCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -41,8 +42,8 @@ public class CustomDurationObservationCreateCommand extends DurationObservationC * @param req
* @param eObject
*/
- public CustomDurationObservationCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomDurationObservationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -50,8 +51,8 @@ public class CustomDurationObservationCreateCommand extends DurationObservationC *
* @param req
*/
- public CustomDurationObservationCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomDurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionCreateCommand.java index 31d3f97958c..5550e5c2e5c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.InteractionCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.BehavioredClassifier;
@@ -37,8 +38,8 @@ public class CustomInteractionCreateCommand extends InteractionCreateCommand { * @param req
* @param eObject
*/
- public CustomInteractionCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomInteractionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -46,8 +47,8 @@ public class CustomInteractionCreateCommand extends InteractionCreateCommand { *
* @param req
*/
- public CustomInteractionCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomInteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionOperandCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionOperandCreateCommand.java index bcb1f899901..3e0a3f65f80 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionOperandCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionOperandCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.InteractionOperandCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -43,8 +44,8 @@ public class CustomInteractionOperandCreateCommand extends InteractionOperandCre * @param req
* @param eObject
*/
- public CustomInteractionOperandCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomInteractionOperandCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -52,8 +53,8 @@ public class CustomInteractionOperandCreateCommand extends InteractionOperandCre *
* @param req
*/
- public CustomInteractionOperandCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomInteractionOperandCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionUseCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionUseCreateCommand.java index dbec50e8f2e..dd326bf19aa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionUseCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomInteractionUseCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.InteractionUseCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
@@ -37,8 +38,8 @@ public class CustomInteractionUseCreateCommand extends InteractionUseCreateComma * @param req
* @param eObject
*/
- public CustomInteractionUseCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomInteractionUseCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -46,8 +47,8 @@ public class CustomInteractionUseCreateCommand extends InteractionUseCreateComma *
* @param req
*/
- public CustomInteractionUseCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomInteractionUseCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomLifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomLifelineCreateCommand.java index a1ec0684923..741c0379f14 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomLifelineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomLifelineCreateCommand.java @@ -24,6 +24,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.IElementType;
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.papyrus.uml.diagram.sequence.edit.commands.LifelineCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
@@ -53,8 +54,8 @@ public class CustomLifelineCreateCommand extends LifelineCreateCommand { * @param req
* @param eObject
*/
- public CustomLifelineCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomLifelineCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -62,8 +63,8 @@ public class CustomLifelineCreateCommand extends LifelineCreateCommand { *
* @param req
*/
- public CustomLifelineCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomLifelineCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomStateInvariantCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomStateInvariantCreateCommand.java index b5aed9e1e64..a8a1a438871 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomStateInvariantCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomStateInvariantCreateCommand.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.StateInvariantCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -36,8 +37,8 @@ public class CustomStateInvariantCreateCommand extends StateInvariantCreateComma * @param req
* @param eObject
*/
- public CustomStateInvariantCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomStateInvariantCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -45,8 +46,8 @@ public class CustomStateInvariantCreateCommand extends StateInvariantCreateComma *
* @param req
*/
- public CustomStateInvariantCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomStateInvariantCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeConstraintCreateCommand.java index 241617aeaa4..491384be237 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CustomTimeConstraintCreateCommand.java @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.TimeConstraintCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
@@ -44,8 +45,8 @@ public class CustomTimeConstraintCreateCommand extends TimeConstraintCreateComma * @param req
* @param eObject
*/
- public CustomTimeConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
- super(req, eObject);
+ public CustomTimeConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req, eObject, diagram);
}
/**
@@ -53,8 +54,8 @@ public class CustomTimeConstraintCreateCommand extends TimeConstraintCreateComma *
* @param req
*/
- public CustomTimeConstraintCreateCommand(CreateElementRequest req) {
- super(req);
+ public CustomTimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
+ super(req, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomCombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomCombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java index eff27a8d0ab..3a746d5d6ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomCombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomCombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java @@ -19,6 +19,7 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomInteractionOperandCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -52,7 +53,7 @@ public class CustomCombinedFragmentCombinedFragmentCompartmentItemSemanticEditPo }
// make compound command
CompoundCommand result = new CompoundCommand();
- Command cmd = getGEFWrapper(new CustomInteractionOperandCreateCommand(req));
+ Command cmd = getGEFWrapper(new CustomInteractionOperandCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
result.add(cmd);
// append a command which notifies
// Fixed bug: remove the notify dialog, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402977
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionInteractionCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionInteractionCompartmentItemSemanticEditPolicy.java index a628bc7e83e..a8f4ecab65d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionInteractionCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionInteractionCompartmentItemSemanticEditPolicy.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCombinedFragmentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConsiderIgnoreFragmentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintCreateCommand;
@@ -38,31 +39,31 @@ public class CustomInteractionInteractionCompartmentItemSemanticEditPolicy exten @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.ConsiderIgnoreFragment_3007 == req.getElementType()) {
- return getGEFWrapper(new CustomConsiderIgnoreFragmentCreateCommand(req));
+ return getGEFWrapper(new CustomConsiderIgnoreFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3004 == req.getElementType()) {
- return getGEFWrapper(new CustomCombinedFragmentCreateCommand(req));
+ return getGEFWrapper(new CustomCombinedFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Lifeline_3001 == req.getElementType()) {
- return getGEFWrapper(new CustomLifelineCreateCommand(req));
+ return getGEFWrapper(new CustomLifelineCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionUse_3002 == req.getElementType()) {
- return getGEFWrapper(new CustomInteractionUseCreateCommand(req));
+ return getGEFWrapper(new CustomInteractionUseCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3008 == req.getElementType()) {
- return getGEFWrapper(new CustomConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3009 == req.getElementType()) {
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_3020 == req.getElementType()) {
return getGEFWrapper(new CustomTimeObservationCreateCommand(req));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3021 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionItemSemanticEditPolicy.java index adf80307fd2..ed33cec95e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
@@ -68,10 +69,10 @@ public class CustomInteractionItemSemanticEditPolicy extends InteractionItemSema @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintInMessageCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintInMessageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionOperandItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionOperandItemSemanticEditPolicy.java index 39a1c4547c5..45f52fbda6c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionOperandItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomInteractionOperandItemSemanticEditPolicy.java @@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCombinedFragmentCreateCommand;
@@ -80,16 +81,16 @@ public class CustomInteractionOperandItemSemanticEditPolicy extends InteractionO @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.InteractionUse_3002 == req.getElementType()) {
- return getGEFWrapper(new CustomInteractionUseCreateCommand(req));
+ return getGEFWrapper(new CustomInteractionUseCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConsiderIgnoreFragment_3007 == req.getElementType()) {
- return getGEFWrapper(new CustomConsiderIgnoreFragmentCreateCommand(req));
+ return getGEFWrapper(new CustomConsiderIgnoreFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3004 == req.getElementType()) {
- return getGEFWrapper(new CustomCombinedFragmentCreateCommand(req));
+ return getGEFWrapper(new CustomCombinedFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Continuation_3016 == req.getElementType()) {
- return getGEFWrapper(new CustomContinuationCreateCommand(req));
+ return getGEFWrapper(new CustomContinuationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomLifelineItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomLifelineItemSemanticEditPolicy.java index 86f6ba5b09e..54c00bcf5d3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomLifelineItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomLifelineItemSemanticEditPolicy.java @@ -29,6 +29,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomActionExecutionSpecificationCreateCommand;
@@ -93,42 +94,42 @@ public class CustomLifelineItemSemanticEditPolicy extends LifelineItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.ActionExecutionSpecification_3006 == req.getElementType()) {
- return getGEFWrapper(new CustomActionExecutionSpecificationCreateCommand(req));
+ return getGEFWrapper(new CustomActionExecutionSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.BehaviorExecutionSpecification_3003 == req.getElementType()) {
- return getGEFWrapper(new CustomBehaviorExecutionSpecificationCreateCommand(req));
+ return getGEFWrapper(new CustomBehaviorExecutionSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateInvariant_3017 == req.getElementType()) {
- return getGEFWrapper(new CustomStateInvariantCreateCommand(req));
+ return getGEFWrapper(new CustomStateInvariantCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3018 == req.getElementType()) {
- return getGEFWrapper(new CustomCombinedFragment2CreateCommand(req));
+ return getGEFWrapper(new CustomCombinedFragment2CreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3019 == req.getElementType()) {
- return getGEFWrapper(new CustomTimeConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomTimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
//Fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=364826
// if(UMLElementTypes.TimeObservation_3020 == req.getElementType()) {
// return getGEFWrapper(new TimeObservationCreateCommand(req));
// }
if(UMLElementTypes.DurationConstraint_3021 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DestructionOccurrenceSpecification_3022 == req.getElementType()) {
- return getGEFWrapper(new CustomDestructionOccurrenceSpecificationCreateCommand(req));
+ return getGEFWrapper(new CustomDestructionOccurrenceSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
//add lifelines
if(UMLElementTypes.Lifeline_3001 == req.getElementType()) {
CustomLifelineEditPart lifelineEditPart = (CustomLifelineEditPart)getHost();
if(lifelineEditPart.isInlineCapability()) {
- CustomLifelineCreateCommand cmd = new CustomLifelineCreateCommand(req);
+ CustomLifelineCreateCommand cmd = new CustomLifelineCreateCommand(req, DiagramUtils.getDiagramFrom(getHost()));
cmd.setAvailableProperties(lifelineEditPart.getAvailableProperties());
return getGEFWrapper(cmd);
}
}
//add DurationObservation/Constraint
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
// Fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=364826
// if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage2ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage2ItemSemanticEditPolicy.java index d3a38ec96de..200487329aa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage2ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage2ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessage2ItemSemanticEditPolicy extends Message2ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage3ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage3ItemSemanticEditPolicy.java index 64a5b8a7cce..8a0adca4859 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage3ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage3ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessage3ItemSemanticEditPolicy extends Message3ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage4ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage4ItemSemanticEditPolicy.java index 79af282f9df..b06f09f1b90 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage4ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage4ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -71,10 +72,10 @@ public class CustomMessage4ItemSemanticEditPolicy extends Message4ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage5ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage5ItemSemanticEditPolicy.java index be8f0da4b7d..1ff17e3e08f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage5ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage5ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessage5ItemSemanticEditPolicy extends Message5ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage6ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage6ItemSemanticEditPolicy.java index e2f3a907e1c..dff3856f165 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage6ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage6ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessage6ItemSemanticEditPolicy extends Message6ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage7ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage7ItemSemanticEditPolicy.java index 465e67f3f44..2e2b82ac8fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage7ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessage7ItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessage7ItemSemanticEditPolicy extends Message7ItemSemanticEd @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessageItemSemanticEditPolicy.java index 1bc40b19bfb..bf6d84a1486 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomMessageItemSemanticEditPolicy.java @@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomCommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomConstraintConstrainedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomDurationConstraintCreateCommand;
@@ -70,10 +71,10 @@ public class CustomMessageItemSemanticEditPolicy extends MessageItemSemanticEdit @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.DurationConstraint_3023 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationConstraintCreateCommand(req));
+ return getGEFWrapper(new CustomDurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == req.getElementType()) {
- return getGEFWrapper(new CustomDurationObservationCreateCommand(req));
+ return getGEFWrapper(new CustomDurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomPackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomPackageItemSemanticEditPolicy.java index 3a2b208bbad..8fc2f65b830 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomPackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/semantic/CustomPackageItemSemanticEditPolicy.java @@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.command.CustomInteractionCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.PackageItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -30,7 +31,7 @@ public class CustomPackageItemSemanticEditPolicy extends PackageItemSemanticEdit @Override
protected Command getCreateCommand(CreateElementRequest req) {
if(UMLElementTypes.Interaction_2001 == req.getElementType()) {
- return getGEFWrapper(new CustomInteractionCreateCommand(req));
+ return getGEFWrapper(new CustomInteractionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml index 71d50b24796..75d882f2d56 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml @@ -45,77 +45,7 @@ </command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramCommand">
- <activeWhen>
- <or>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </or>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
-
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramCommand"
- icon="icons/obj16/Diagram_Sequence.gif"
- label="Create a new Sequence Diagram"
- style="push"
- tooltip="Create a new Sequence Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution
- locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramCommand"
- icon="icons/obj16/Diagram_Sequence.gif"
- label="Create a new Sequence Diagram"
- style="push"
- tooltip="Create a new Sequence Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramCommand"
- icon="icons/obj16/Diagram_Sequence.gif"
- label="Create a new Sequence Diagram"
- style="push"
- tooltip="Create a new Sequence Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
- </extension>
<extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java index e5ef3fcd60b..c5c64281966 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java @@ -24,10 +24,14 @@ 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.ActionExecutionSpecification;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ActionExecutionSpecificationCreateCommand extends EditElementComman /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ActionExecutionSpecificationCreateCommand extends EditElementComman /**
* @generated
*/
- public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActionExecutionSpecificationCreateCommand(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 ActionExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActionExecutionSpecificationCreateCommand(req, eObject);
+ public static ActionExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActionExecutionSpecificationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActionExecutionSpecificationCreateCommand(CreateElementRequest req) {
+ public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +94,9 @@ public class ActionExecutionSpecificationCreateCommand extends EditElementComman */
@Override
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionExecutionSpecification());
+ return data.isPermitted();
}
/**
@@ -100,8 +107,19 @@ public class ActionExecutionSpecificationCreateCommand extends EditElementComman @Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ActionExecutionSpecification newElement = UMLFactory.eINSTANCE.createActionExecutionSpecification();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().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.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java index d37ede2064e..62d12593c89 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java @@ -24,10 +24,14 @@ 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.BehaviorExecutionSpecification;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class BehaviorExecutionSpecificationCreateCommand extends EditElementComm /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class BehaviorExecutionSpecificationCreateCommand extends EditElementComm /**
* @generated
*/
- public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public BehaviorExecutionSpecificationCreateCommand(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 BehaviorExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new BehaviorExecutionSpecificationCreateCommand(req, eObject);
+ public static BehaviorExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new BehaviorExecutionSpecificationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req) {
+ public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +94,9 @@ public class BehaviorExecutionSpecificationCreateCommand extends EditElementComm */
@Override
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehaviorExecutionSpecification());
+ return data.isPermitted();
}
/**
@@ -100,8 +107,19 @@ public class BehaviorExecutionSpecificationCreateCommand extends EditElementComm @Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
BehaviorExecutionSpecification newElement = UMLFactory.eINSTANCE.createBehaviorExecutionSpecification();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().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.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java index a53e909e9d8..40bde3d8c77 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CombinedFragment2CreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CombinedFragment2CreateCommand extends EditElementCommand { /**
* @generated
*/
- public CombinedFragment2CreateCommand(CreateElementRequest req, EObject eObject) {
+ public CombinedFragment2CreateCommand(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 CombinedFragment2CreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CombinedFragment2CreateCommand(req, eObject);
+ public static CombinedFragment2CreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CombinedFragment2CreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CombinedFragment2CreateCommand(CreateElementRequest req) {
+ public CombinedFragment2CreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CombinedFragment2CreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment());
+ return data.isPermitted();
}
/**
@@ -100,8 +107,19 @@ public class CombinedFragment2CreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CombinedFragment_3018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java index 530e1944b05..89e0d665e23 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class CombinedFragmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CombinedFragmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public CombinedFragmentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public CombinedFragmentCreateCommand(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 CombinedFragmentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new CombinedFragmentCreateCommand(req, eObject);
+ public static CombinedFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CombinedFragmentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public CombinedFragmentCreateCommand(CreateElementRequest req) {
+ public CombinedFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +95,9 @@ public class CombinedFragmentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment());
+ return data.isPermitted();
}
/**
@@ -101,8 +108,19 @@ public class CombinedFragmentCreateCommand extends EditElementCommand { @SuppressWarnings("unchecked")
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_CombinedFragment_3004(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java index 9934877c5f3..0a283d990ff 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,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;
}
/**
@@ -88,7 +93,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();
}
/**
@@ -96,8 +103,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_3009(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java index 02af5a78ee8..6bc342886bb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConsiderIgnoreFragmentCreateCommand(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 ConsiderIgnoreFragmentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConsiderIgnoreFragmentCreateCommand(req, eObject);
+ public static ConsiderIgnoreFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConsiderIgnoreFragmentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req) {
+ public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +95,9 @@ public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConsiderIgnoreFragment());
+ return data.isPermitted();
}
/**
@@ -101,8 +108,19 @@ public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand { @SuppressWarnings("unchecked")
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ConsiderIgnoreFragment newElement = UMLFactory.eINSTANCE.createConsiderIgnoreFragment();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ConsiderIgnoreFragment_3007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java index 5868a34930f..19314dc2af7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ConstraintCreateCommand 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();
}
/**
@@ -96,8 +103,19 @@ public class ConstraintCreateCommand 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_3008(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java index 3f0928353f9..58052e7ed05 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Continuation;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ContinuationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ContinuationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ContinuationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ContinuationCreateCommand(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 ContinuationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ContinuationCreateCommand(req, eObject);
+ public static ContinuationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ContinuationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ContinuationCreateCommand(CreateElementRequest req) {
+ public ContinuationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ContinuationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getContinuation());
+ return data.isPermitted();
}
/**
@@ -98,8 +105,19 @@ public class ContinuationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Continuation newElement = UMLFactory.eINSTANCE.createContinuation();
- InteractionOperand owner = (InteractionOperand)getElementToEdit();
- owner.getFragments().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 {
+ InteractionOperand qualifiedTarget = (InteractionOperand)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Continuation_3016(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java index 64be8d01d1b..86f3dd6385b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java @@ -11,11 +11,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,7 +29,7 @@ public class DestructionOccurrenceSpecificationCreateCommand extends EditElement /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -35,24 +39,25 @@ public class DestructionOccurrenceSpecificationCreateCommand extends EditElement /**
* @generated
*/
- public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DestructionOccurrenceSpecificationCreateCommand(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 DestructionOccurrenceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DestructionOccurrenceSpecificationCreateCommand(req, eObject);
+ public static DestructionOccurrenceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DestructionOccurrenceSpecificationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req) {
+ public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -77,7 +82,9 @@ public class DestructionOccurrenceSpecificationCreateCommand extends EditElement * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification());
+ return data.isPermitted();
}
/**
@@ -85,8 +92,19 @@ public class DestructionOccurrenceSpecificationCreateCommand extends EditElement */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_DestructionOccurrenceSpecification_3022(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java index e3d0f93a879..e6fa027b189 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintCreateCommand(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 DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintCreateCommand(req, eObject);
+ public static DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintCreateCommand(CreateElementRequest req) {
+ public DurationConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DurationConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DurationConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- 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_DurationConstraint_3021(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java index 162905fd3e7..49b831c4d55 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationConstraintInMessageCreateCommand extends EditElementCommand /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationConstraintInMessageCreateCommand extends EditElementCommand /**
* @generated
*/
- public DurationConstraintInMessageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationConstraintInMessageCreateCommand(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 DurationConstraintInMessageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationConstraintInMessageCreateCommand(req, eObject);
+ public static DurationConstraintInMessageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintInMessageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintInMessageCreateCommand(CreateElementRequest req) {
+ public DurationConstraintInMessageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DurationConstraintInMessageCreateCommand extends EditElementCommand * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DurationConstraintInMessageCreateCommand extends EditElementCommand */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- 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_DurationConstraint_3023(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java index 59d5b0b10c8..b0b4c95e7d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.DurationObservation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class DurationObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DurationObservationCreateCommand(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 DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DurationObservationCreateCommand(req, eObject);
+ public static DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationObservationCreateCommand(CreateElementRequest req) {
+ public DurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class DurationObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class DurationObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
- 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_DurationObservation_3024(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java index fd1c5128a9d..b72ab7a1611 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionCreateCommand(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 InteractionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionCreateCommand(req, eObject);
+ public static InteractionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCreateCommand(CreateElementRequest req) {
+ public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class InteractionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class InteractionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- 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_Interaction_2001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java index a2049e35297..ecf8d1819c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java @@ -24,10 +24,14 @@ 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.CombinedFragment;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class InteractionOperandCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class InteractionOperandCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionOperandCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionOperandCreateCommand(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 InteractionOperandCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionOperandCreateCommand(req, eObject);
+ public static InteractionOperandCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionOperandCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionOperandCreateCommand(CreateElementRequest req) {
+ public InteractionOperandCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class InteractionOperandCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionOperand());
+ return data.isPermitted();
}
/**
@@ -98,8 +105,19 @@ public class InteractionOperandCreateCommand extends EditElementCommand { @SuppressWarnings({ "unchecked" })
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InteractionOperand newElement = UMLFactory.eINSTANCE.createInteractionOperand();
- CombinedFragment owner = (CombinedFragment)getElementToEdit();
- owner.getOperands().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 {
+ CombinedFragment qualifiedTarget = (CombinedFragment)target;
+ qualifiedTarget.getOperands().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.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java index 1f39392c82f..5227bb793f8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.InteractionUse;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class InteractionUseCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class InteractionUseCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InteractionUseCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InteractionUseCreateCommand(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 InteractionUseCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InteractionUseCreateCommand(req, eObject);
+ public static InteractionUseCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionUseCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionUseCreateCommand(CreateElementRequest req) {
+ public InteractionUseCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +95,9 @@ public class InteractionUseCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionUse());
+ return data.isPermitted();
}
/**
@@ -100,8 +107,19 @@ public class InteractionUseCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
InteractionUse newElement = UMLFactory.eINSTANCE.createInteractionUse();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_InteractionUse_3002(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java index 293310dddd5..17a81a96219 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class LifelineCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class LifelineCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LifelineCreateCommand(CreateElementRequest req, EObject eObject) {
+ public LifelineCreateCommand(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 LifelineCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new LifelineCreateCommand(req, eObject);
+ public static LifelineCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LifelineCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LifelineCreateCommand(CreateElementRequest req) {
+ public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -90,7 +95,9 @@ public class LifelineCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
+ return data.isPermitted();
}
/**
@@ -100,8 +107,19 @@ public class LifelineCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getLifelines().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getLifelines().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Lifeline_3001(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java index b1a066f49c6..dd427a5c91e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class StateInvariantCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class StateInvariantCreateCommand extends EditElementCommand { /**
* @generated
*/
- public StateInvariantCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StateInvariantCreateCommand(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 StateInvariantCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateInvariantCreateCommand(req, eObject);
+ public static StateInvariantCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateInvariantCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StateInvariantCreateCommand(CreateElementRequest req) {
+ public StateInvariantCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class StateInvariantCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
+ return data.isPermitted();
}
/**
@@ -98,8 +105,19 @@ public class StateInvariantCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
- Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_StateInvariant_3017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java index a5525403a4a..1d2c0f726e3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeConstraintCreateCommand(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 TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeConstraintCreateCommand(req, eObject);
+ public static TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintCreateCommand(CreateElementRequest req) {
+ public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class TimeConstraintCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class TimeConstraintCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- 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_TimeConstraint_3019(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java index d5b489d5f68..4c1553279d3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java @@ -24,11 +24,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.sequence.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req, EObject eObject) {
+ public TimeObservationCreateCommand(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 TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new TimeObservationCreateCommand(req, eObject);
+ public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeObservationCreateCommand(CreateElementRequest req) {
+ public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class TimeObservationCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class TimeObservationCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
- 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_TimeObservation_3020(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java index d91fbfdf627..1a0e5cc82c6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.InteractionOperandCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -59,7 +60,7 @@ public class CombinedFragmentCombinedFragmentCompartmentItemSemanticEditPolicy e if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionOperandCreateCommand(req));
+ return getGEFWrapper(new InteractionOperandCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java index 6e082733392..9f33dcfac6c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionInteractionCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CombinedFragmentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CommentCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ConsiderIgnoreFragmentCreateCommand;
@@ -62,37 +63,37 @@ public class InteractionInteractionCompartmentItemSemanticEditPolicy extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConsiderIgnoreFragmentCreateCommand(req));
+ return getGEFWrapper(new ConsiderIgnoreFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3004 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CombinedFragmentCreateCommand(req));
+ return getGEFWrapper(new CombinedFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Lifeline_3001 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new LifelineCreateCommand(req));
+ return getGEFWrapper(new LifelineCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.InteractionUse_3002 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionUseCreateCommand(req));
+ return getGEFWrapper(new InteractionUseCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3008 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3009 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java index fba2221a2ba..f6a8f798579 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CommentAnnotatedElementCreateCommand;
@@ -98,13 +99,13 @@ public class InteractionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintInMessageCreateCommand(req));
+ return getGEFWrapper(new DurationConstraintInMessageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_3024 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommand(req));
+ return getGEFWrapper(new DurationObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandItemSemanticEditPolicy.java index 8658fcbef54..19714399164 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.CombinedFragmentCreateCommand;
@@ -100,25 +101,25 @@ public class InteractionOperandItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionUseCreateCommand(req));
+ return getGEFWrapper(new InteractionUseCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConsiderIgnoreFragment_3007 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConsiderIgnoreFragmentCreateCommand(req));
+ return getGEFWrapper(new ConsiderIgnoreFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3004 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CombinedFragmentCreateCommand(req));
+ return getGEFWrapper(new CombinedFragmentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Continuation_3016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ContinuationCreateCommand(req));
+ return getGEFWrapper(new ContinuationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java index 13d7bf6b443..ef6a41be44e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineItemSemanticEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.ActionExecutionSpecificationCreateCommand;
@@ -104,49 +105,49 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActionExecutionSpecificationCreateCommand(req));
+ return getGEFWrapper(new ActionExecutionSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.BehaviorExecutionSpecification_3003 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new BehaviorExecutionSpecificationCreateCommand(req));
+ return getGEFWrapper(new BehaviorExecutionSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.StateInvariant_3017 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateInvariantCreateCommand(req));
+ return getGEFWrapper(new StateInvariantCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.CombinedFragment_3018 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CombinedFragment2CreateCommand(req));
+ return getGEFWrapper(new CombinedFragment2CreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_3019 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ return getGEFWrapper(new TimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_3020 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_3021 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommand(req));
+ return getGEFWrapper(new DurationConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DestructionOccurrenceSpecification_3022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommand(req));
+ return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java index 7743d315358..a04522811ab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/PackageItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.commands.InteractionCreateCommand;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -62,7 +63,7 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCreateCommand(req));
+ return getGEFWrapper(new InteractionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java index 9ddbddfb147..05ae3190680 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLVisualIDRegistry.java @@ -164,13 +164,7 @@ public class UMLVisualIDRegistry { * @generated
*/
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return PackageEditPart.VISUAL_ID;
- }
- return -1;
+ return PackageEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF index cdf2ff5533b..f7c7333e33f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/META-INF/MANIFEST.MF @@ -77,14 +77,13 @@ Require-Bundle: org.eclipse.core.expressions, org.eclipse.emf.validation.ocl;visibility:=reexport,
org.eclipse.gef,
org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Ant-Version: Apache Ant 1.7.0
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.statemachine.part.UM
- LDiagramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.statemachine;sing
- leton:=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.statemachine; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java deleted file mode 100644 index 015e24097b8..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramWithNavigationHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.statemachine;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-
-public class CreateStateMachineDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateStateMachineDiagramWithNavigationHandler() {
- super(new CreateStateMachineDiagramCommand(), new StateMachineDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/StateMachineDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/StateMachineDiagramCreationCondition.java index 122cae35937..45ad2050f3d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/StateMachineDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/StateMachineDiagramCreationCondition.java @@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.statemachine; import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.extension.commands.PerspectiveContextDependence;
-import org.eclipse.uml2.uml.StateMachine;
/**
* StateMachineDiagramCreationCondition class allows to check if a State Machine
@@ -24,10 +23,6 @@ public class StateMachineDiagramCreationCondition extends PerspectiveContextDepe * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- // TODO : to specify according to the spec
- return selectedElement instanceof StateMachine;
- }
return false;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java index 4c208a9571c..31f7f6a6ba8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomConnectionPointReferenceCreateCommand.java @@ -1,14 +1,15 @@ package org.eclipse.papyrus.uml.diagram.statemachine.custom.commands; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand; import org.eclipse.uml2.uml.State; public class CustomConnectionPointReferenceCreateCommand extends ConnectionPointReferenceCreateCommand { - public CustomConnectionPointReferenceCreateCommand(CreateElementRequest req) { - super(req); + public CustomConnectionPointReferenceCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req, diagram); // TODO Auto-generated constructor stub } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java index f8d564520d5..609ed0652c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateEntryPointCreateCommand.java @@ -5,6 +5,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand; import org.eclipse.papyrus.uml.diagram.statemachine.providers.ElementInitializers; import org.eclipse.uml2.uml.Pseudostate; @@ -14,8 +15,8 @@ import org.eclipse.uml2.uml.UMLFactory; public class CustomPseudostateEntryPointCreateCommand extends PseudostateEntryPointCreateCommand { - public CustomPseudostateEntryPointCreateCommand(CreateElementRequest req) { - super(req); + public CustomPseudostateEntryPointCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req, diagram); // TODO Auto-generated constructor stub } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java index efa0c40a6c0..1db596f8d40 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/commands/CustomPseudostateExitPointCreateCommand.java @@ -5,6 +5,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand; import org.eclipse.papyrus.uml.diagram.statemachine.providers.ElementInitializers; import org.eclipse.uml2.uml.Pseudostate; @@ -14,8 +15,8 @@ import org.eclipse.uml2.uml.UMLFactory; public class CustomPseudostateExitPointCreateCommand extends PseudostateExitPointCreateCommand { - public CustomPseudostateExitPointCreateCommand(CreateElementRequest req) { - super(req); + public CustomPseudostateExitPointCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req, diagram); // TODO Auto-generated constructor stub } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java index 48ecbebd807..5894f7fcf09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/policies/CustomStateItemSemanticEditPolicy.java @@ -3,6 +3,7 @@ package org.eclipse.papyrus.uml.diagram.statemachine.custom.policies; import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomConnectionPointReferenceCreateCommand; import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomPseudostateEntryPointCreateCommand; import org.eclipse.papyrus.uml.diagram.statemachine.custom.commands.CustomPseudostateExitPointCreateCommand; @@ -17,13 +18,13 @@ public class CustomStateItemSemanticEditPolicy extends StateItemSemanticEditPoli @Override protected Command getCreateCommand(CreateElementRequest req) { if(UMLElementTypes.Pseudostate_16000 == req.getElementType()) { - return getGEFWrapper(new CustomPseudostateEntryPointCreateCommand(req)); + return getGEFWrapper(new CustomPseudostateEntryPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost()))); } if(UMLElementTypes.Pseudostate_17000 == req.getElementType()) { - return getGEFWrapper(new CustomPseudostateExitPointCreateCommand(req)); + return getGEFWrapper(new CustomPseudostateExitPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost()))); } if(UMLElementTypes.ConnectionPointReference_18000 == req.getElementType()) { - return getGEFWrapper(new CustomConnectionPointReferenceCreateCommand(req)); + return getGEFWrapper(new CustomConnectionPointReferenceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost()))); } return super.getCreateCommand(req); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml index 4a55c8929cb..082b8319cf3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml @@ -701,59 +701,9 @@ description="Create a new StateMachine Diagram"
categoryId="org.eclipse.papyrus.editor.category"/>
</extension>
- - <extension point="org.eclipse.ui.handlers"> - <handler
- class="org.eclipse.papyrus.uml.diagram.statemachine.CreateStateMachineDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.statemachine.CreationCommand">
- <activeWhen>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor" />
- </with>
- </activeWhen>
- </handler> - </extension>
-
-<!-- Diagram creation command registration in menu and toolbar -->
-<extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" label="Diagrams">
- <command commandId="org.eclipse.papyrus.uml.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif" label="Create a new StateMachine Diagram"
- style="push" tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command commandId="org.eclipse.papyrus.uml.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif" label="Create a new StateMachine Diagram"
- style="push" tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.statemachine.CreationCommand"
- icon="icons/obj16/Diagram_StateMachine.gif"
- label="Create a new StateMachine Diagram"
- style="push"
- tooltip="Create a new StateMachine Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
-</extension>
+<!-- Diagram creation command registration in menu and toolbar -->
<extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/CommentCreateCommand.java index 40b757b79b2..66284e9b855 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/CommentCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
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
@@ -25,7 +29,7 @@ public class CommentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -35,24 +39,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;
}
/**
@@ -75,7 +80,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();
}
/**
@@ -83,8 +90,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_666(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java index 3f3285e7765..8ca8b5a2a95 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConnectionPointReferenceCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.ConnectionPointReference;
import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class ConnectionPointReferenceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static ConnectionPointReferenceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConnectionPointReferenceCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public ConnectionPointReferenceCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public ConnectionPointReferenceCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static ConnectionPointReferenceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConnectionPointReferenceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConnectionPointReferenceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConnectionPointReferenceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConnectionPointReference());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class ConnectionPointReferenceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ConnectionPointReference newElement = UMLFactory.eINSTANCE.createConnectionPointReference();
- State owner = (State)getElementToEdit();
- owner.getConnections().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 {
+ State qualifiedTarget = (State)target;
+ qualifiedTarget.getConnections().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ConnectionPointReference_18000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConstraintCreateCommand.java index 972c11d6f6b..e77e7c65472 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ConstraintCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
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
@@ -25,7 +29,7 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -35,24 +39,25 @@ public class ConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommand(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 ConstraintCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommand(req, eObject);
+ public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommand(CreateElementRequest req) {
+ public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -75,7 +80,9 @@ public class ConstraintCreateCommand 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();
}
/**
@@ -83,8 +90,19 @@ public class ConstraintCreateCommand 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_668(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/DoActivityStateBehaviorStateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/DoActivityStateBehaviorStateCreateCommand.java index c37994415ec..36b520baba5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/DoActivityStateBehaviorStateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/DoActivityStateBehaviorStateCreateCommand.java @@ -11,9 +11,13 @@ 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.Behavior;
import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -23,7 +27,7 @@ public class DoActivityStateBehaviorStateCreateCommand extends EditElementComman /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -33,24 +37,25 @@ public class DoActivityStateBehaviorStateCreateCommand extends EditElementComman /**
* @generated
*/
- public DoActivityStateBehaviorStateCreateCommand(CreateElementRequest req, EObject eObject) {
+ public DoActivityStateBehaviorStateCreateCommand(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 DoActivityStateBehaviorStateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new DoActivityStateBehaviorStateCreateCommand(req, eObject);
+ public static DoActivityStateBehaviorStateCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DoActivityStateBehaviorStateCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public DoActivityStateBehaviorStateCreateCommand(CreateElementRequest req) {
+ public DoActivityStateBehaviorStateCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -77,7 +82,9 @@ public class DoActivityStateBehaviorStateCreateCommand extends EditElementComman if(container.getDoActivity() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehavior());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/EntryStateBehaviorCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/EntryStateBehaviorCreateCommand.java index 7b6c5ccde88..7ca96dd1844 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/EntryStateBehaviorCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/EntryStateBehaviorCreateCommand.java @@ -11,9 +11,13 @@ 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.Behavior;
import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -23,7 +27,7 @@ public class EntryStateBehaviorCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -33,24 +37,25 @@ public class EntryStateBehaviorCreateCommand extends EditElementCommand { /**
* @generated
*/
- public EntryStateBehaviorCreateCommand(CreateElementRequest req, EObject eObject) {
+ public EntryStateBehaviorCreateCommand(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 EntryStateBehaviorCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new EntryStateBehaviorCreateCommand(req, eObject);
+ public static EntryStateBehaviorCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new EntryStateBehaviorCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public EntryStateBehaviorCreateCommand(CreateElementRequest req) {
+ public EntryStateBehaviorCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -77,7 +82,9 @@ public class EntryStateBehaviorCreateCommand extends EditElementCommand { if(container.getEntry() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehavior());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ExitStateBehaviorCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ExitStateBehaviorCreateCommand.java index 4e0913ee906..f76c63dd0a9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ExitStateBehaviorCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/ExitStateBehaviorCreateCommand.java @@ -11,9 +11,13 @@ 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.Behavior;
import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -23,7 +27,7 @@ public class ExitStateBehaviorCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -33,24 +37,25 @@ public class ExitStateBehaviorCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ExitStateBehaviorCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExitStateBehaviorCreateCommand(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 ExitStateBehaviorCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExitStateBehaviorCreateCommand(req, eObject);
+ public static ExitStateBehaviorCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExitStateBehaviorCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExitStateBehaviorCreateCommand(CreateElementRequest req) {
+ public ExitStateBehaviorCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -77,7 +82,9 @@ public class ExitStateBehaviorCreateCommand extends EditElementCommand { if(container.getExit() != null) {
return false;
}
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehavior());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/FinalStateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/FinalStateCreateCommand.java index 086703c80da..18439fdc143 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/FinalStateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/FinalStateCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.FinalState;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class FinalStateCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static FinalStateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new FinalStateCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public FinalStateCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public FinalStateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static FinalStateCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FinalStateCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public FinalStateCreateCommand(CreateElementRequest req, EObject eObject) {
+ public FinalStateCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getFinalState());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class FinalStateCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
FinalState newElement = UMLFactory.eINSTANCE.createFinalState();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_FinalState_5000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/InternalTransitionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/InternalTransitionCreateCommand.java index 91312217b2b..ef97ce961a6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/InternalTransitionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/InternalTransitionCreateCommand.java @@ -11,10 +11,14 @@ 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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Transition;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.Vertex;
/**
@@ -25,7 +29,7 @@ public class InternalTransitionCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -35,24 +39,25 @@ public class InternalTransitionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public InternalTransitionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public InternalTransitionCreateCommand(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 InternalTransitionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new InternalTransitionCreateCommand(req, eObject);
+ public static InternalTransitionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InternalTransitionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public InternalTransitionCreateCommand(CreateElementRequest req) {
+ public InternalTransitionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -75,7 +80,9 @@ public class InternalTransitionCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTransition());
+ return data.isPermitted();
}
/**
@@ -83,8 +90,19 @@ public class InternalTransitionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Transition newElement = UMLFactory.eINSTANCE.createTransition();
- Vertex owner = (Vertex)getElementToEdit();
- owner.getIncomings().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 {
+ Vertex qualifiedTarget = (Vertex)target;
+ qualifiedTarget.getIncomings().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Transition_680(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java index ae5bed0ac72..e4335fd6140 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateChoiceCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateChoiceCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateChoiceCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateChoiceCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateChoiceCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateChoiceCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateChoiceCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateChoiceCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateChoiceCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateChoiceCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateChoiceCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_11000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java index 3b8bd7c512a..a0a5d9047d4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateDeepHistoryCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateDeepHistoryCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateDeepHistoryCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateDeepHistoryCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateDeepHistoryCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateDeepHistoryCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateDeepHistoryCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateDeepHistoryCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateDeepHistoryCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateDeepHistoryCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateDeepHistoryCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_14000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java index bec620e4a80..49861f0d81b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateEntryPointCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateEntryPointCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateEntryPointCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateEntryPointCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateEntryPointCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateEntryPointCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateEntryPointCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateEntryPointCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateEntryPointCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateEntryPointCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateEntryPointCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getConnectionPoints().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 {
+ StateMachine qualifiedTarget = (StateMachine)target;
+ qualifiedTarget.getConnectionPoints().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_16000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java index 301270e0924..1c813d8f96e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateExitPointCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateExitPointCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateExitPointCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateExitPointCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateExitPointCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateExitPointCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateExitPointCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateExitPointCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateExitPointCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateExitPointCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateExitPointCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getConnectionPoints().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 {
+ StateMachine qualifiedTarget = (StateMachine)target;
+ qualifiedTarget.getConnectionPoints().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_17000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java index f64b46d85de..fba16292b8f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateForkCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateForkCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateForkCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateForkCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateForkCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateForkCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateForkCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateForkCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateForkCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateForkCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateForkCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_10000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java index bbdc881d02f..af0ea92d910 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateInitialCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateInitialCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateInitialCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateInitialCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateInitialCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateInitialCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateInitialCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateInitialCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateInitialCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateInitialCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateInitialCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_8000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java index 60f721fe4c1..d7397669263 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJoinCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateJoinCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateJoinCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateJoinCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateJoinCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateJoinCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateJoinCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateJoinCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateJoinCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateJoinCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateJoinCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_9000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java index c8c7e1e5b50..0d3f38cf9b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateJunctionCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateJunctionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateJunctionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateJunctionCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateJunctionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateJunctionCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateJunctionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateJunctionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateJunctionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateJunctionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateJunctionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_12000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java index 57c93616fe2..8323d82a595 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateShallowHistoryCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateShallowHistoryCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateShallowHistoryCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateShallowHistoryCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateShallowHistoryCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateShallowHistoryCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateShallowHistoryCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateShallowHistoryCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateShallowHistoryCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateShallowHistoryCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateShallowHistoryCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_13000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java index 708aa91bca7..1b8b8543983 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/PseudostateTerminateCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Pseudostate;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class PseudostateTerminateCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static PseudostateTerminateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new PseudostateTerminateCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public PseudostateTerminateCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public PseudostateTerminateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static PseudostateTerminateCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PseudostateTerminateCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public PseudostateTerminateCreateCommand(CreateElementRequest req, EObject eObject) {
+ public PseudostateTerminateCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPseudostate());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class PseudostateTerminateCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Pseudostate newElement = UMLFactory.eINSTANCE.createPseudostate();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Pseudostate_15000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/RegionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/RegionCreateCommand.java index d6788b547b9..2695f5ab4ce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/RegionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/RegionCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class RegionCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static RegionCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new RegionCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public RegionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public RegionCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static RegionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new RegionCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public RegionCreateCommand(CreateElementRequest req, EObject eObject) {
+ public RegionCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getRegion());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class RegionCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Region newElement = UMLFactory.eINSTANCE.createRegion();
- StateMachine owner = (StateMachine)getElementToEdit();
- owner.getRegions().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 {
+ StateMachine qualifiedTarget = (StateMachine)target;
+ qualifiedTarget.getRegions().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Region_3000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateCreateCommand.java index fd9528acb8c..2f1d176b101 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class StateCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static StateCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public StateCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public StateCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static StateCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StateCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StateCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getState());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class StateCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
State newElement = UMLFactory.eINSTANCE.createState();
- Region owner = (Region)getElementToEdit();
- owner.getSubvertices().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 {
+ Region qualifiedTarget = (Region)target;
+ qualifiedTarget.getSubvertices().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_State_6000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateMachineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateMachineCreateCommand.java index 86a1bf09d36..2a03cd0cd01 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateMachineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/StateMachineCreateCommand.java @@ -11,11 +11,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.statemachine.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -25,41 +29,44 @@ public class StateMachineCreateCommand extends EditElementCommand { /**
* @generated
*/
- public static StateMachineCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new StateMachineCreateCommand(req, eObject);
- }
+ private Diagram diagram = null;
/**
* @generated
*/
- private EClass eClass = null;
+ private EObject eObject = null;
/**
* @generated
*/
- private EObject eObject = null;
+ public StateMachineCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ super(req.getLabel(), null, req);
+ this.eObject = eObject;
+ this.diagram = diagram;
+ }
/**
* @generated
*/
- public StateMachineCreateCommand(CreateElementRequest req) {
- super(req.getLabel(), null, req);
+ public static StateMachineCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new StateMachineCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public StateMachineCreateCommand(CreateElementRequest req, EObject eObject) {
+ public StateMachineCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.eClass = eObject != null ? eObject.eClass() : null;
+ this.diagram = diagram;
}
/**
* @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateMachine());
+ return data.isPermitted();
}
/**
@@ -81,8 +88,19 @@ public class StateMachineCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
StateMachine newElement = UMLFactory.eINSTANCE.createStateMachine();
- 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_StateMachine_2000(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionCreateCommand.java index 3e5966f5a78..db6f5a50736 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionCreateCommand.java @@ -32,7 +32,7 @@ public class TransitionCreateCommand extends EditElementCommand { */
protected Region deduceContainer(EObject source, EObject target) {
// TODO: avoid modification of generated code, problem is that model needs to be changed at many places ...
- return EMFCustomTransitionRetargetContainerCommand.deduceContainer (source, target);
+ return EMFCustomTransitionRetargetContainerCommand.deduceContainer(source, target);
}
/**
@@ -80,9 +80,6 @@ public class TransitionCreateCommand extends EditElementCommand { if(getContainer() == null) {
return false;
}
- if(!EMFCustomTransitionRetargetContainerCommand.isValid(source, target)) {
- return false;
- }
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canCreateTransition_7000(getContainer(), getSource(), getTarget());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionReorientCommand.java index 5df3b201cb4..b7d3f70b570 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/commands/TransitionReorientCommand.java @@ -71,7 +71,7 @@ public class TransitionReorientCommand extends EditElementCommand { return false;
}
// TODO: avoid modifications here. Not done due to many required changes
- if (!EMFCustomTransitionRetargetContainerCommand.isValid(newEnd, target)) {
+ if(!EMFCustomTransitionRetargetContainerCommand.isValid(newEnd, target)) {
return false;
}
Region container = (Region)getLink().eContainer();
@@ -90,7 +90,7 @@ public class TransitionReorientCommand extends EditElementCommand { return false;
}
// TODO: avoid modifications here. Not done due to many required changes
- if (!EMFCustomTransitionRetargetContainerCommand.isValid(source, newEnd)) {
+ if(!EMFCustomTransitionRetargetContainerCommand.isValid(source, newEnd)) {
return false;
}
Region container = (Region)getLink().eContainer();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java index 9cecdfcce96..5ebc449240f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageCanonicalEditPolicy.java @@ -28,6 +28,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.CommentEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.ConstraintEditPart;
@@ -74,7 +75,136 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private Collection<UMLLinkDescriptor> collectAllLinks(View view, Map<EObject, View> domain2NotationMap) {
+ private Diagram getDiagram() {
+ return ((View)getHost().getModel()).getDiagram();
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart getSourceEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
+ return getEditPart(descriptor.getSource(), domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart getTargetEditPart(UpdaterLinkDescriptor descriptor, Domain2Notation domain2NotationMap) {
+ return getEditPart(descriptor.getDestination(), domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ protected final EditPart getHintedEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap, int hintVisualId) {
+ View view = (View)domain2NotationMap.getHinted(domainModelElement, UMLVisualIDRegistry.getType(hintVisualId));
+ if(view != null) {
+ return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("serial")
+ protected static class Domain2Notation extends HashMap<EObject, View> {
+
+ /**
+ * @generated
+ */
+ public boolean containsDomainElement(EObject domainElement) {
+ return this.containsKey(domainElement);
+ }
+
+ /**
+ * @generated
+ */
+ public View getHinted(EObject domainEObject, String hint) {
+ return this.get(domainEObject);
+ }
+
+ /**
+ * @generated
+ */
+ public void putView(EObject domainElement, View view) {
+ if(!containsKey(view.getElement())) {
+ this.put(domainElement, view);
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected EStructuralFeature getFeatureToSynchronize() {
+ return UMLPackage.eINSTANCE.getPackage_PackagedElement();
+ }
+
+ /**
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ protected List getSemanticChildrenList() {
+ View viewObject = (View)getHost().getModel();
+ LinkedList<EObject> result = new LinkedList<EObject>();
+ List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getPackage_1000SemanticChildren(viewObject);
+ for(UMLNodeDescriptor d : childDescriptors) {
+ result.add(d.getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isMyDiagramElement(View view) {
+ return StateMachineEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
+ return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<IAdaptable> refreshConnections() {
+ Domain2Notation domain2NotationMap = new Domain2Notation();
+ Collection<UMLLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
+ Collection existingLinks = new LinkedList(getDiagram().getEdges());
+ for(Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ Edge nextDiagramLink = (Edge)linksIterator.next();
+ int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
+ if(diagramLinkVisualID == -1) {
+ if(nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
+ linksIterator.remove();
+ }
+ continue;
+ }
+ EObject diagramLinkObject = nextDiagramLink.getElement();
+ EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ for(Iterator<UMLLinkDescriptor> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ UMLLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next();
+ if(diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
+ linksIterator.remove();
+ linkDescriptorsIterator.remove();
+ break;
+ }
+ }
+ }
+ deleteViews(existingLinks.iterator());
+ return createConnections(linkDescriptors, domain2NotationMap);
+ }
+
+ /**
+ * @generated
+ */
+ private Collection<UMLLinkDescriptor> collectAllLinks(View view, Domain2Notation domain2NotationMap) {
if(!PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
return Collections.emptyList();
}
@@ -85,9 +215,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPackage_1000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case StateMachineEditPart.VISUAL_ID:
@@ -95,9 +223,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getStateMachine_2000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case RegionEditPart.VISUAL_ID:
@@ -105,9 +231,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getRegion_3000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case FinalStateEditPart.VISUAL_ID:
@@ -115,9 +239,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getFinalState_5000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case StateEditPart.VISUAL_ID:
@@ -125,9 +247,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getState_6000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateInitialEditPart.VISUAL_ID:
@@ -135,9 +255,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_8000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateJoinEditPart.VISUAL_ID:
@@ -145,9 +263,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_9000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateForkEditPart.VISUAL_ID:
@@ -155,9 +271,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_10000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateChoiceEditPart.VISUAL_ID:
@@ -165,9 +279,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_11000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateJunctionEditPart.VISUAL_ID:
@@ -175,9 +287,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_12000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateShallowHistoryEditPart.VISUAL_ID:
@@ -185,9 +295,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_13000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateDeepHistoryEditPart.VISUAL_ID:
@@ -195,9 +303,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_14000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateTerminateEditPart.VISUAL_ID:
@@ -205,9 +311,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_15000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateEntryPointEditPart.VISUAL_ID:
@@ -215,9 +319,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_16000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case PseudostateExitPointEditPart.VISUAL_ID:
@@ -225,9 +327,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getPseudostate_17000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConnectionPointReferenceEditPart.VISUAL_ID:
@@ -235,9 +335,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getConnectionPointReference_18000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case CommentEditPart.VISUAL_ID:
@@ -245,9 +343,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getComment_666ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case ConstraintEditPart.VISUAL_ID:
@@ -255,9 +351,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getConstraint_668ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case TransitionEditPart.VISUAL_ID:
@@ -265,9 +359,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getTransition_7000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
case GeneralizationEditPart.VISUAL_ID:
@@ -275,9 +367,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { if(!domain2NotationMap.containsKey(view.getElement())) {
result.addAll(UMLDiagramUpdater.getGeneralization_19000ContainedLinks(view));
}
- if(!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- domain2NotationMap.put(view.getElement(), view);
- }
+ domain2NotationMap.putView(view.getElement(), view);
break;
}
}
@@ -293,11 +383,11 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private Collection<IAdaptable> createConnections(Collection<UMLLinkDescriptor> linkDescriptors, Map<EObject, View> domain2NotationMap) {
+ private Collection<IAdaptable> createConnections(Collection<UMLLinkDescriptor> linkDescriptors, Domain2Notation domain2NotationMap) {
LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
for(UMLLinkDescriptor nextLinkDescriptor : linkDescriptors) {
- EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
- EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+ EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, domain2NotationMap);
+ EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, domain2NotationMap);
if(sourceEditPart == null || targetEditPart == null) {
continue;
}
@@ -323,14 +413,7 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- private Diagram getDiagram() {
- return ((View)getHost().getModel()).getDiagram();
- }
-
- /**
- * @generated
- */
- private EditPart getEditPart(EObject domainModelElement, Map<EObject, View> domain2NotationMap) {
+ private EditPart getEditPart(EObject domainModelElement, Domain2Notation domain2NotationMap) {
View view = (View)domain2NotationMap.get(domainModelElement);
if(view != null) {
return (EditPart)getHost().getViewer().getEditPartRegistry().get(view);
@@ -341,73 +424,6 @@ public class PackageCanonicalEditPolicy extends CanonicalEditPolicy { /**
* @generated
*/
- protected EStructuralFeature getFeatureToSynchronize() {
- return UMLPackage.eINSTANCE.getPackage_PackagedElement();
- }
-
- /**
- * @generated
- */
- @SuppressWarnings("rawtypes")
- protected List getSemanticChildrenList() {
- View viewObject = (View)getHost().getModel();
- LinkedList<EObject> result = new LinkedList<EObject>();
- List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.getPackage_1000SemanticChildren(viewObject);
- for(UMLNodeDescriptor d : childDescriptors) {
- result.add(d.getModelElement());
- }
- return result;
- }
-
- /**
- * @generated
- */
- private boolean isMyDiagramElement(View view) {
- return StateMachineEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(view);
- }
-
- /**
- * @generated
- */
- protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) {
- return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement());
- }
-
- /**
- * @generated
- */
- private Collection<IAdaptable> refreshConnections() {
- Map<EObject, View> domain2NotationMap = new HashMap<EObject, View>();
- Collection<UMLLinkDescriptor> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- Collection existingLinks = new LinkedList(getDiagram().getEdges());
- for(Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- Edge nextDiagramLink = (Edge)linksIterator.next();
- int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
- if(diagramLinkVisualID == -1) {
- if(nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
- linksIterator.remove();
- }
- continue;
- }
- EObject diagramLinkObject = nextDiagramLink.getElement();
- EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
- EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
- for(Iterator<UMLLinkDescriptor> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- UMLLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next();
- if(diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
- }
- }
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
- }
-
- /**
- * @generated
- */
protected void refreshSemantic() {
if(resolveSemanticElement() == null) {
return;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java index d378c9fcd84..2ae705e7d62 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/PackageItemSemanticEditPolicy.java @@ -9,6 +9,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.StateMachineCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
@@ -65,7 +66,7 @@ public class PackageItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateMachineCreateCommand(req));
+ return getGEFWrapper(new StateMachineCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java index 99f39efba04..60fc6158f41 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/RegionCompartmentItemSemanticEditPolicy.java @@ -5,6 +5,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.CommentCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.ConstraintCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.FinalStateCreateCommand;
@@ -57,85 +58,85 @@ public class RegionCompartmentItemSemanticEditPolicy extends UMLBaseItemSemantic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateInitialCreateCommand(req));
+ return getGEFWrapper(new PseudostateInitialCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_9000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateJoinCreateCommand(req));
+ return getGEFWrapper(new PseudostateJoinCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_10000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateForkCreateCommand(req));
+ return getGEFWrapper(new PseudostateForkCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_11000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateChoiceCreateCommand(req));
+ return getGEFWrapper(new PseudostateChoiceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_12000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateJunctionCreateCommand(req));
+ return getGEFWrapper(new PseudostateJunctionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_13000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateShallowHistoryCreateCommand(req));
+ return getGEFWrapper(new PseudostateShallowHistoryCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_14000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateDeepHistoryCreateCommand(req));
+ return getGEFWrapper(new PseudostateDeepHistoryCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_15000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateTerminateCreateCommand(req));
+ return getGEFWrapper(new PseudostateTerminateCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.FinalState_5000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FinalStateCreateCommand(req));
+ return getGEFWrapper(new FinalStateCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.State_6000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new StateCreateCommand(req));
+ return getGEFWrapper(new StateCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_16000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateEntryPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_17000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateExitPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_666 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommand(req));
+ return getGEFWrapper(new CommentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_668 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommand(req));
+ return getGEFWrapper(new ConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java index 7d0e0fd9e59..07d4462a182 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateCompartmentItemSemanticEditPolicy.java @@ -5,6 +5,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.RegionCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLElementTypes;
@@ -45,13 +46,13 @@ public class StateCompartmentItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RegionCreateCommand(req));
+ return getGEFWrapper(new RegionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectionPointReference_18000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req));
+ return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java index c1ac4179917..8aded92095b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.CommentAnnotatedElementCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.CommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.ConnectionPointReferenceCreateCommand;
@@ -326,49 +327,49 @@ public class StateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new EntryStateBehaviorCreateCommand(req));
+ return getGEFWrapper(new EntryStateBehaviorCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Behavior_691 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DoActivityStateBehaviorStateCreateCommand(req));
+ return getGEFWrapper(new DoActivityStateBehaviorStateCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Behavior_692 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExitStateBehaviorCreateCommand(req));
+ return getGEFWrapper(new ExitStateBehaviorCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Transition_680 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InternalTransitionCreateCommand(req));
+ return getGEFWrapper(new InternalTransitionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Region_3000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RegionCreateCommand(req));
+ return getGEFWrapper(new RegionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_16000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateEntryPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_17000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateExitPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConnectionPointReference_18000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req));
+ return getGEFWrapper(new ConnectionPointReferenceCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java index 805c394cf5c..d5b8a944fe1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineCompartmentItemSemanticEditPolicy.java @@ -5,6 +5,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.PseudostateEntryPointCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.PseudostateExitPointCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.RegionCreateCommand;
@@ -46,19 +47,19 @@ public class StateMachineCompartmentItemSemanticEditPolicy extends UMLBaseItemSe if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new RegionCreateCommand(req));
+ return getGEFWrapper(new RegionCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_16000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateEntryPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_17000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateExitPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java index 92e38360e14..ed02b737c16 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/edit/policies/StateMachineItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.CommentAnnotatedElementCreateCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.CommentAnnotatedElementReorientCommand;
import org.eclipse.papyrus.uml.diagram.statemachine.edit.commands.ConstraintConstrainedElementCreateCommand;
@@ -280,13 +281,13 @@ public class StateMachineItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateEntryPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateEntryPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Pseudostate_17000 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PseudostateExitPointCreateCommand(req));
+ return getGEFWrapper(new PseudostateExitPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java index fed64e09642..461fa0a879a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLVisualIDRegistry.java @@ -354,17 +354,8 @@ public class UMLVisualIDRegistry { return false;
}
- /**
- * @generated
- */
public static int getDiagramVisualID(EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return PackageEditPart.VISUAL_ID;
- }
- return -1;
+ return PackageEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF index 3d5e952d06b..6da8da94fb0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/META-INF/MANIFEST.MF @@ -67,13 +67,13 @@ Require-Bundle: org.eclipse.emf.ecore, org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagr
- amEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.timing;singleton:
- =true
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.timing.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.timing; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java deleted file mode 100644 index 8855b26a55b..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/CreateTimingDiagramWithNavigationHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.timing.custom;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateTimingDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateTimingDiagramWithNavigationHandler() {
- super(new CreateTimingDiagramCommand(), new TimingDiagramCreationCondition());
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java index ccb59f22bb9..3e44b6255c5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/TimingDiagramCreationCondition.java @@ -21,14 +21,7 @@ public class TimingDiagramCreationCondition extends PerspectiveContextDependence */
@Override
public boolean create(final EObject selectedElement) {
- return true;
-
- // FIXME: condition?
-
- // if (super.create(selectedElement)) {
- // return selectedElement instanceof org.eclipse.uml2.uml.Package;
- // }
- // return false;
+ return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java index df9eb3059c1..531a0a995b4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomInteractionCompartmentItemSemanticEditPolicy.java @@ -14,6 +14,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.LifelineUtils.LifelineType;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.CompactLifelineCreateCommandCN;
@@ -28,7 +29,7 @@ public class CustomInteractionCompartmentItemSemanticEditPolicy extends Interact protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType elementType = req.getElementType();
if(UMLElementTypes.Lifeline_19 == elementType) {
- return getGEFWrapper(new FullLifelineCreateCommandCN(req) {
+ return getGEFWrapper(new FullLifelineCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())) {
@Override
protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -38,7 +39,7 @@ public class CustomInteractionCompartmentItemSemanticEditPolicy extends Interact });
}
if(UMLElementTypes.Lifeline_20 == elementType) {
- return getGEFWrapper(new CompactLifelineCreateCommandCN(req) {
+ return getGEFWrapper(new CompactLifelineCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())) {
@Override
protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java index 139856ca5e8..a4bbc9181f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomMessageOccurrenceSpecificationItemSemanticEditPolicy.java @@ -15,6 +15,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageCreateCommand;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.CustomMessageReorientCommand;
import org.eclipse.papyrus.uml.diagram.timing.custom.utils.MessageUtils;
@@ -41,10 +42,10 @@ public class CustomMessageOccurrenceSpecificationItemSemanticEditPolicy extends protected Command getCreateCommand(final CreateElementRequest req) {
final IElementType elementType = req.getElementType();
if(UMLElementTypes.TimeConstraint_15 == elementType) {
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ return getGEFWrapper(new TimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_16 == elementType) {
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml index 23c0703b30e..df0bd7c32a4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml @@ -1226,13 +1226,6 @@ sequence="F5"/> </extension> - <extension point="org.eclipse.ui.menus" id="context-menus"> - <?gmfgen generated="true"?> - <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after="> - </menuContribution> - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after="> - </menuContribution --> - </extension> @@ -1268,17 +1261,6 @@ name="Toggle Time Ruler Visibility"/> </extension> - <extension point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.papyrus.uml.diagram.timing.custom.CreateTimingDiagramWithNavigationHandler" - commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand"> - <activeWhen> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/> - </with> - </activeWhen> - </handler> - </extension> <extension point="org.eclipse.ui.bindings" @@ -1310,50 +1292,8 @@ <extension point="org.eclipse.ui.menus"> - <menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu"> - <menu - id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams" - label="Diagrams"> - <command - commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand" - icon="icons/obj16/Diagram_Timing.gif" - label="Create a new Timing Diagram" - style="push" - tooltip="Create a new Timing Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menu> - </menuContribution> - <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar"> - <toolbar id="org.eclipse.papyrus.uml.diagram.ui.toolbar"> - <command - commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand" - icon="icons/obj16/Diagram_Timing.gif" - label="Create a new Timing Diagram" - style="push" - tooltip="Create a new Timing Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </toolbar> - </menuContribution> - <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram"> - <command - commandId="org.eclipse.papyrus.uml.diagram.timing.CreateTimingDiagramCommand" - icon="icons/obj16/Diagram_Timing.gif" - label="Create a new Timing Diagram" - style="push" - tooltip="Create a new Timing Diagram"> - <visibleWhen> - <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/> - </visibleWhen> - </command> - </menuContribution> <menuContribution locationURI="popup:popup:org.eclipse.ui.popup.any?after=additions"> <command commandId="org.eclipse.papyrus.uml.diagram.timing.custom.switchLifeline" diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java index aac5ef9e2f3..e2febf3c71d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Interaction;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CompactLifelineCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public CompactLifelineCreateCommandCN(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 CompactLifelineCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new CompactLifelineCreateCommandCN(req, eObject);
+ public static CompactLifelineCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CompactLifelineCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CompactLifelineCreateCommandCN(final CreateElementRequest req) {
+ public CompactLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- final Interaction owner = (Interaction)getElementToEdit();
- owner.getLifelines().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+ 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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getLifelines().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);
}
@@ -112,15 +123,14 @@ public class CompactLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java index 169baf0cdf8..f4c74291c8a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Interaction;
import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CompactStateInvariantCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public CompactStateInvariantCreateCommandCN(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 CompactStateInvariantCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new CompactStateInvariantCreateCommandCN(req, eObject);
+ public static CompactStateInvariantCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CompactStateInvariantCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CompactStateInvariantCreateCommandCN(final CreateElementRequest req) {
+ public CompactStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
-
- final Interaction owner = (Interaction)getElementToEdit();
- owner.getFragments().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
+ 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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFragments().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);
}
@@ -112,15 +123,14 @@ public class CompactStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final StateInvariant newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java index 291358df10b..c603595654b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java @@ -19,10 +19,14 @@ 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.DestructionOccurrenceSpecification;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme /**
* @generated
*/
- public DestructionOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public DestructionOccurrenceSpecificationCreateCommandCN(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 DestructionOccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new DestructionOccurrenceSpecificationCreateCommandCN(req, eObject);
+ public static DestructionOccurrenceSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DestructionOccurrenceSpecificationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DestructionOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ public DestructionOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
-
- final Lifeline owner = (Lifeline)getElementToEdit();
- owner.getCoveredBys().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
+ 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 {
+ Lifeline qualifiedTarget = (Lifeline)target;
+ qualifiedTarget.getCoveredBys().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);
}
@@ -112,15 +123,14 @@ public class DestructionOccurrenceSpecificationCreateCommandCN extends EditEleme /**
* @generated
*/
- protected void doConfigure(final DestructionOccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(DestructionOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java index 1fe8cf4db15..44fd26b3418 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java @@ -19,10 +19,14 @@ 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.DurationConstraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DurationConstraintCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public DurationConstraintCreateCommandCN(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 DurationConstraintCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new DurationConstraintCreateCommandCN(req, eObject);
+ public static DurationConstraintCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationConstraintCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationConstraintCreateCommandCN(final CreateElementRequest req) {
+ public DurationConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
-
- final Namespace owner = (Namespace)getElementToEdit();
- owner.getOwnedRules().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
+ 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -112,15 +123,14 @@ public class DurationConstraintCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final DurationConstraint newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java index 60f38663826..8d0fe922d05 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java @@ -19,10 +19,14 @@ 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.DurationObservation;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public DurationObservationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public DurationObservationCreateCommandCN(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 DurationObservationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new DurationObservationCreateCommandCN(req, eObject);
+ public static DurationObservationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DurationObservationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public DurationObservationCreateCommandCN(final CreateElementRequest req) {
+ public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
-
- final Package owner = (Package)getElementToEdit();
- owner.getPackagedElements().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
+ 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -112,15 +123,14 @@ public class DurationObservationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final DurationObservation newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java index f78653354c1..72727a3677f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Interaction;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public FullLifelineCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public FullLifelineCreateCommandCN(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 FullLifelineCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new FullLifelineCreateCommandCN(req, eObject);
+ public static FullLifelineCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FullLifelineCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public FullLifelineCreateCommandCN(final CreateElementRequest req) {
+ public FullLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- final Interaction owner = (Interaction)getElementToEdit();
- owner.getLifelines().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+ 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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getLifelines().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);
}
@@ -112,15 +123,14 @@ public class FullLifelineCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java index 826afe40125..d81c83f8c05 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Lifeline;
import org.eclipse.uml2.uml.StateInvariant;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public FullStateInvariantCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public FullStateInvariantCreateCommandCN(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 FullStateInvariantCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new FullStateInvariantCreateCommandCN(req, eObject);
+ public static FullStateInvariantCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new FullStateInvariantCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public FullStateInvariantCreateCommandCN(final CreateElementRequest req) {
+ public FullStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
-
- final Lifeline owner = (Lifeline)getElementToEdit();
- owner.getCoveredBys().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
+ 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 {
+ Lifeline qualifiedTarget = (Lifeline)target;
+ qualifiedTarget.getCoveredBys().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);
}
@@ -112,15 +123,14 @@ public class FullStateInvariantCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final StateInvariant newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java index 05e166feb32..08ed60c03c7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java @@ -19,10 +19,14 @@ 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.Gate;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class GateCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class GateCreateCommand extends EditElementCommand { /**
* @generated
*/
- public GateCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ public GateCreateCommand(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 GateCreateCommand create(final CreateElementRequest req, final EObject eObject) {
- return new GateCreateCommand(req, eObject);
+ public static GateCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new GateCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public GateCreateCommand(final CreateElementRequest req) {
+ public GateCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class GateCreateCommand extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class GateCreateCommand extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class GateCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGate());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final Gate newElement = UMLFactory.eINSTANCE.createGate();
-
- final Interaction owner = (Interaction)getElementToEdit();
- owner.getFormalGates().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Gate newElement = UMLFactory.eINSTANCE.createGate();
+ 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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getFormalGates().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);
}
@@ -112,15 +123,14 @@ public class GateCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final Gate newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Gate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java index c6687a706c4..85109f8e4aa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java @@ -19,10 +19,14 @@ 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.GeneralOrdering;
import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { /**
* @generated
*/
- public GeneralOrderingCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ public GeneralOrderingCreateCommand(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 GeneralOrderingCreateCommand create(final CreateElementRequest req, final EObject eObject) {
- return new GeneralOrderingCreateCommand(req, eObject);
+ public static GeneralOrderingCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new GeneralOrderingCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public GeneralOrderingCreateCommand(final CreateElementRequest req) {
+ public GeneralOrderingCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGeneralOrdering());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final GeneralOrdering newElement = UMLFactory.eINSTANCE.createGeneralOrdering();
-
- final InteractionFragment owner = (InteractionFragment)getElementToEdit();
- owner.getGeneralOrderings().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ GeneralOrdering newElement = UMLFactory.eINSTANCE.createGeneralOrdering();
+ 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 {
+ InteractionFragment qualifiedTarget = (InteractionFragment)target;
+ qualifiedTarget.getGeneralOrderings().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);
}
@@ -112,15 +123,14 @@ public class GeneralOrderingCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final GeneralOrdering newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(GeneralOrdering newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java index 53d109e7c8d..27ef67539e3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java @@ -19,10 +19,14 @@ 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.Interaction;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class InteractionCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class InteractionCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public InteractionCreateCommandTN(final CreateElementRequest req, final EObject eObject) {
+ public InteractionCreateCommandTN(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 InteractionCreateCommandTN create(final CreateElementRequest req, final EObject eObject) {
- return new InteractionCreateCommandTN(req, eObject);
+ public static InteractionCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new InteractionCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public InteractionCreateCommandTN(final CreateElementRequest req) {
+ public InteractionCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class InteractionCreateCommandTN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class InteractionCreateCommandTN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class InteractionCreateCommandTN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
-
- final Package owner = (Package)getElementToEdit();
- owner.getPackagedElements().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
+ 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -112,15 +123,14 @@ public class InteractionCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final Interaction newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java index a159897c518..889ac8ba3b3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java @@ -19,10 +19,14 @@ 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.Interaction;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class LifelineCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class LifelineCreateCommand extends EditElementCommand { /**
* @generated
*/
- public LifelineCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ public LifelineCreateCommand(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 LifelineCreateCommand create(final CreateElementRequest req, final EObject eObject) {
- return new LifelineCreateCommand(req, eObject);
+ public static LifelineCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new LifelineCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public LifelineCreateCommand(final CreateElementRequest req) {
+ public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class LifelineCreateCommand extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class LifelineCreateCommand extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class LifelineCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- final Interaction owner = (Interaction)getElementToEdit();
- owner.getLifelines().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
+ 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 {
+ Interaction qualifiedTarget = (Interaction)target;
+ qualifiedTarget.getLifelines().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);
}
@@ -112,15 +123,14 @@ public class LifelineCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final Lifeline newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java index 78589b26a75..59d3139b082 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncCreateCommand.java @@ -50,11 +50,11 @@ public class MessageAsyncCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageAsyncCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageAsyncCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageAsyncCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,32 +85,30 @@ public class MessageAsyncCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
- final Message newElement = UMLFactory.eINSTANCE.createMessage();
+ Message newElement = UMLFactory.eINSTANCE.createMessage();
getContainer().getMessages().add(newElement);
newElement.setReceiveEvent(getSource());
newElement.setSendEvent(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -120,7 +118,7 @@ public class MessageAsyncCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -128,21 +126,21 @@ public class MessageAsyncCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -151,7 +149,7 @@ public class MessageAsyncCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -162,5 +160,4 @@ public class MessageAsyncCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java index 86356c91650..7d6f32c1b5f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageAsyncReorientCommand.java @@ -46,11 +46,11 @@ public class MessageAsyncReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageAsyncReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageAsyncReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -61,10 +61,10 @@ public class MessageAsyncReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -74,14 +74,14 @@ public class MessageAsyncReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_4(container, getLink(), getNewSource(), target);
}
@@ -89,14 +89,14 @@ public class MessageAsyncReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_4(container, getLink(), source, getNewTarget());
}
@@ -104,14 +104,14 @@ public class MessageAsyncReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageAsyncReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java index 3d2fa0b3873..55c4303dad2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateCreateCommand.java @@ -50,11 +50,11 @@ public class MessageCreateCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageCreateCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageCreateCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageCreateCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,32 +85,30 @@ public class MessageCreateCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
- final Message newElement = UMLFactory.eINSTANCE.createMessage();
+ Message newElement = UMLFactory.eINSTANCE.createMessage();
getContainer().getMessages().add(newElement);
newElement.setReceiveEvent(getSource());
newElement.setSendEvent(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -120,7 +118,7 @@ public class MessageCreateCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -128,21 +126,21 @@ public class MessageCreateCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -151,7 +149,7 @@ public class MessageCreateCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -162,5 +160,4 @@ public class MessageCreateCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java index 094de7eaf39..2dd2c8c841d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageCreateReorientCommand.java @@ -46,11 +46,11 @@ public class MessageCreateReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageCreateReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageCreateReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -61,10 +61,10 @@ public class MessageCreateReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -74,14 +74,14 @@ public class MessageCreateReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_44(container, getLink(), getNewSource(), target);
}
@@ -89,14 +89,14 @@ public class MessageCreateReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_44(container, getLink(), source, getNewTarget());
}
@@ -104,14 +104,14 @@ public class MessageCreateReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageCreateReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java index f12ba33fe1c..d1824bc9452 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteCreateCommand.java @@ -50,11 +50,11 @@ public class MessageDeleteCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageDeleteCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageDeleteCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageDeleteCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,32 +85,30 @@ public class MessageDeleteCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
- final Message newElement = UMLFactory.eINSTANCE.createMessage();
+ Message newElement = UMLFactory.eINSTANCE.createMessage();
getContainer().getMessages().add(newElement);
newElement.setReceiveEvent(getSource());
newElement.setSendEvent(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -120,7 +118,7 @@ public class MessageDeleteCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -128,21 +126,21 @@ public class MessageDeleteCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -151,7 +149,7 @@ public class MessageDeleteCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -162,5 +160,4 @@ public class MessageDeleteCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java index c9aa11253db..5ac1f0980e6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageDeleteReorientCommand.java @@ -46,11 +46,11 @@ public class MessageDeleteReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageDeleteReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageDeleteReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -61,10 +61,10 @@ public class MessageDeleteReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -74,14 +74,14 @@ public class MessageDeleteReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_47(container, getLink(), getNewSource(), target);
}
@@ -89,14 +89,14 @@ public class MessageDeleteReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_47(container, getLink(), source, getNewTarget());
}
@@ -104,14 +104,14 @@ public class MessageDeleteReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageDeleteReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java index cf7fbd5ef33..cdfe7126943 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundCreateCommand.java @@ -50,11 +50,11 @@ public class MessageFoundCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageFoundCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageFoundCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageFoundCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof Element) {
+ if(source != null && false == source instanceof Element) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,26 +85,24 @@ public class MessageFoundCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
throw new UnsupportedOperationException();
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -114,7 +112,7 @@ public class MessageFoundCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -122,21 +120,21 @@ public class MessageFoundCreateCommand extends EditElementCommand { * @generated
*/
protected Element getSource() {
- return (Element)this.source;
+ return (Element)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -145,7 +143,7 @@ public class MessageFoundCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -156,5 +154,4 @@ public class MessageFoundCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java index 7addc368ffc..235759db847 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageFoundReorientCommand.java @@ -47,11 +47,11 @@ public class MessageFoundReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageFoundReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageFoundReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -62,10 +62,10 @@ public class MessageFoundReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -75,14 +75,14 @@ public class MessageFoundReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof Element && this.newEnd instanceof Element)) {
+ if(!(oldEnd instanceof Element && newEnd instanceof Element)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_53(container, getLink(), getNewSource(), target);
}
@@ -90,14 +90,14 @@ public class MessageFoundReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final Element source = getLink().getOwner();
+ Element source = getLink().getOwner();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_53(container, getLink(), source, getNewTarget());
}
@@ -105,14 +105,14 @@ public class MessageFoundReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageFoundReorientCommand extends EditElementCommand { * @generated
*/
protected Element getOldSource() {
- return (Element)this.oldEnd;
+ return (Element)oldEnd;
}
/**
* @generated
*/
protected Element getNewSource() {
- return (Element)this.newEnd;
+ return (Element)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java index 21f904f6631..5b408f51625 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostCreateCommand.java @@ -50,11 +50,11 @@ public class MessageLostCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageLostCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageLostCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageLostCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof Element) {
+ if(target != null && false == target instanceof Element) {
return false;
}
if(getSource() == null) {
@@ -85,26 +85,24 @@ public class MessageLostCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
throw new UnsupportedOperationException();
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -114,7 +112,7 @@ public class MessageLostCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -122,21 +120,21 @@ public class MessageLostCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected Element getTarget() {
- return (Element)this.target;
+ return (Element)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -145,7 +143,7 @@ public class MessageLostCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -156,5 +154,4 @@ public class MessageLostCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java index 5e189028828..cd0178a5571 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageLostReorientCommand.java @@ -47,11 +47,11 @@ public class MessageLostReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageLostReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageLostReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -62,10 +62,10 @@ public class MessageLostReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -75,14 +75,14 @@ public class MessageLostReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final Element target = getLink().getOwner();
+ Element target = getLink().getOwner();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_50(container, getLink(), getNewSource(), target);
}
@@ -90,14 +90,14 @@ public class MessageLostReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof Element && this.newEnd instanceof Element)) {
+ if(!(oldEnd instanceof Element && newEnd instanceof Element)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_50(container, getLink(), source, getNewTarget());
}
@@ -105,14 +105,14 @@ public class MessageLostReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageLostReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected Element getOldTarget() {
- return (Element)this.oldEnd;
+ return (Element)oldEnd;
}
/**
* @generated
*/
protected Element getNewTarget() {
- return (Element)this.newEnd;
+ return (Element)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java index eef4db153e6..a978a12a420 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Lifeline;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo /**
* @generated
*/
- public MessageOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public MessageOccurrenceSpecificationCreateCommandCN(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 MessageOccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new MessageOccurrenceSpecificationCreateCommandCN(req, eObject);
+ public static MessageOccurrenceSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new MessageOccurrenceSpecificationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public MessageOccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ public MessageOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getMessageOccurrenceSpecification());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final MessageOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
-
- final Lifeline owner = (Lifeline)getElementToEdit();
- owner.getCoveredBys().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ MessageOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
+ 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 {
+ Lifeline qualifiedTarget = (Lifeline)target;
+ qualifiedTarget.getCoveredBys().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);
}
@@ -112,15 +123,14 @@ public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCo /**
* @generated
*/
- protected void doConfigure(final MessageOccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(MessageOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java index 105df89b331..13b3991b3b3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyCreateCommand.java @@ -50,11 +50,11 @@ public class MessageReplyCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageReplyCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageReplyCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageReplyCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,32 +85,30 @@ public class MessageReplyCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
- final Message newElement = UMLFactory.eINSTANCE.createMessage();
+ Message newElement = UMLFactory.eINSTANCE.createMessage();
getContainer().getMessages().add(newElement);
newElement.setReceiveEvent(getSource());
newElement.setSendEvent(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -120,7 +118,7 @@ public class MessageReplyCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -128,21 +126,21 @@ public class MessageReplyCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -151,7 +149,7 @@ public class MessageReplyCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -162,5 +160,4 @@ public class MessageReplyCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java index 5d46893aa93..18643d8c709 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageReplyReorientCommand.java @@ -46,11 +46,11 @@ public class MessageReplyReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageReplyReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageReplyReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -61,10 +61,10 @@ public class MessageReplyReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -74,14 +74,14 @@ public class MessageReplyReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_41(container, getLink(), getNewSource(), target);
}
@@ -89,14 +89,14 @@ public class MessageReplyReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_41(container, getLink(), source, getNewTarget());
}
@@ -104,14 +104,14 @@ public class MessageReplyReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageReplyReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java index 53a3e14e881..569bafd41ef 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncCreateCommand.java @@ -50,11 +50,11 @@ public class MessageSyncCreateCommand extends EditElementCommand { /**
* @generated
*/
- public MessageSyncCreateCommand(final CreateRelationshipRequest request, final EObject source, final EObject target) {
+ public MessageSyncCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
- this.container = deduceContainer(source, target);
+ container = deduceContainer(source, target);
}
/**
@@ -62,13 +62,13 @@ public class MessageSyncCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
- if(this.source == null && this.target == null) {
+ if(source == null && target == null) {
return false;
}
- if(this.source != null && false == this.source instanceof MessageEnd) {
+ if(source != null && false == source instanceof MessageEnd) {
return false;
}
- if(this.target != null && false == this.target instanceof MessageEnd) {
+ if(target != null && false == target instanceof MessageEnd) {
return false;
}
if(getSource() == null) {
@@ -85,32 +85,30 @@ public class MessageSyncCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
-
- final Message newElement = UMLFactory.eINSTANCE.createMessage();
+ Message newElement = UMLFactory.eINSTANCE.createMessage();
getContainer().getMessages().add(newElement);
newElement.setReceiveEvent(getSource());
newElement.setSendEvent(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
-
}
/**
* @generated
*/
- protected void doConfigure(final Message newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(Message newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
configureRequest.setParameter(CreateRelationshipRequest.SOURCE, getSource());
configureRequest.setParameter(CreateRelationshipRequest.TARGET, getTarget());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
@@ -120,7 +118,7 @@ public class MessageSyncCreateCommand extends EditElementCommand { * @generated
*/
@Override
- protected void setElementToEdit(final EObject element) {
+ protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
@@ -128,21 +126,21 @@ public class MessageSyncCreateCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getSource() {
- return (MessageEnd)this.source;
+ return (MessageEnd)source;
}
/**
* @generated
*/
protected MessageEnd getTarget() {
- return (MessageEnd)this.target;
+ return (MessageEnd)target;
}
/**
* @generated
*/
public Interaction getContainer() {
- return this.container;
+ return container;
}
/**
@@ -151,7 +149,7 @@ public class MessageSyncCreateCommand extends EditElementCommand { *
* @generated
*/
- protected Interaction deduceContainer(final EObject source, final EObject target) {
+ protected Interaction deduceContainer(EObject source, EObject target) {
// Find container element for the new link.
// Climb up by containment hierarchy starting from the source
// and return the first element that is instance of the container class.
@@ -162,5 +160,4 @@ public class MessageSyncCreateCommand extends EditElementCommand { }
return null;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java index 0b540068711..845d99634ec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageSyncReorientCommand.java @@ -46,11 +46,11 @@ public class MessageSyncReorientCommand extends EditElementCommand { /**
* @generated
*/
- public MessageSyncReorientCommand(final ReorientRelationshipRequest request) {
+ public MessageSyncReorientCommand(ReorientRelationshipRequest request) {
super(request.getLabel(), request.getRelationship(), request);
- this.reorientDirection = request.getDirection();
- this.oldEnd = request.getOldRelationshipEnd();
- this.newEnd = request.getNewRelationshipEnd();
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
}
/**
@@ -61,10 +61,10 @@ public class MessageSyncReorientCommand extends EditElementCommand { if(false == getElementToEdit() instanceof Message) {
return false;
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return canReorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return canReorientTarget();
}
return false;
@@ -74,14 +74,14 @@ public class MessageSyncReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientSource() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd target = getLink().getSendEvent();
+ MessageEnd target = getLink().getSendEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_3(container, getLink(), getNewSource(), target);
}
@@ -89,14 +89,14 @@ public class MessageSyncReorientCommand extends EditElementCommand { * @generated
*/
protected boolean canReorientTarget() {
- if(!(this.oldEnd instanceof MessageEnd && this.newEnd instanceof MessageEnd)) {
+ if(!(oldEnd instanceof MessageEnd && newEnd instanceof MessageEnd)) {
return false;
}
- final MessageEnd source = getLink().getReceiveEvent();
+ MessageEnd source = getLink().getReceiveEvent();
if(!(getLink().eContainer() instanceof Interaction)) {
return false;
}
- final Interaction container = (Interaction)getLink().eContainer();
+ Interaction container = (Interaction)getLink().eContainer();
return UMLBaseItemSemanticEditPolicy.getLinkConstraints().canExistMessage_3(container, getLink(), source, getNewTarget());
}
@@ -104,14 +104,14 @@ public class MessageSyncReorientCommand extends EditElementCommand { * @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(!canExecute()) {
throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
}
- if(this.reorientDirection == ReorientRequest.REORIENT_SOURCE) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
return reorientSource();
}
- if(this.reorientDirection == ReorientRequest.REORIENT_TARGET) {
+ if(reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
return reorientTarget();
}
throw new IllegalStateException();
@@ -144,27 +144,27 @@ public class MessageSyncReorientCommand extends EditElementCommand { * @generated
*/
protected MessageEnd getOldSource() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewSource() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
/**
* @generated
*/
protected MessageEnd getOldTarget() {
- return (MessageEnd)this.oldEnd;
+ return (MessageEnd)oldEnd;
}
/**
* @generated
*/
protected MessageEnd getNewTarget() {
- return (MessageEnd)this.newEnd;
+ return (MessageEnd)newEnd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java index f195ed5984c..4e489cf1e00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java @@ -19,10 +19,14 @@ 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.Lifeline;
import org.eclipse.uml2.uml.OccurrenceSpecification;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public OccurrenceSpecificationCreateCommandCN(final CreateElementRequest req, final EObject eObject) {
+ public OccurrenceSpecificationCreateCommandCN(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 OccurrenceSpecificationCreateCommandCN create(final CreateElementRequest req, final EObject eObject) {
- return new OccurrenceSpecificationCreateCommandCN(req, eObject);
+ public static OccurrenceSpecificationCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new OccurrenceSpecificationCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public OccurrenceSpecificationCreateCommandCN(final CreateElementRequest req) {
+ public OccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOccurrenceSpecification());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final OccurrenceSpecification newElement = UMLFactory.eINSTANCE.createOccurrenceSpecification();
-
- final Lifeline owner = (Lifeline)getElementToEdit();
- owner.getCoveredBys().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ OccurrenceSpecification newElement = UMLFactory.eINSTANCE.createOccurrenceSpecification();
+ 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 {
+ Lifeline qualifiedTarget = (Lifeline)target;
+ qualifiedTarget.getCoveredBys().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);
}
@@ -112,15 +123,14 @@ public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final OccurrenceSpecification newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(OccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java index ea4deda222b..c7aaf9e9588 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java @@ -19,10 +19,14 @@ 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.Namespace;
import org.eclipse.uml2.uml.TimeConstraint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeConstraintCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ public TimeConstraintCreateCommand(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 TimeConstraintCreateCommand create(final CreateElementRequest req, final EObject eObject) {
- return new TimeConstraintCreateCommand(req, eObject);
+ public static TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeConstraintCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeConstraintCreateCommand(final CreateElementRequest req) {
+ public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class TimeConstraintCreateCommand extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class TimeConstraintCreateCommand extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class TimeConstraintCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
-
- final Namespace owner = (Namespace)getElementToEdit();
- owner.getOwnedRules().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
+ 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -112,15 +123,14 @@ public class TimeConstraintCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final TimeConstraint newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(TimeConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java index ccfa5cf2276..6e3346163b6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java @@ -19,10 +19,14 @@ 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.Package;
import org.eclipse.uml2.uml.TimeObservation;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -34,7 +38,7 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -44,24 +48,25 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- public TimeObservationCreateCommand(final CreateElementRequest req, final EObject eObject) {
+ public TimeObservationCreateCommand(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 TimeObservationCreateCommand create(final CreateElementRequest req, final EObject eObject) {
- return new TimeObservationCreateCommand(req, eObject);
+ public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new TimeObservationCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public TimeObservationCreateCommand(final CreateElementRequest req) {
+ public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -71,7 +76,6 @@ public class TimeObservationCreateCommand extends EditElementCommand { */
@Override
protected EObject getElementToEdit() {
-
EObject container = ((CreateElementRequest)getRequest()).getContainer();
if(container instanceof View) {
container = ((View)container).getElement();
@@ -79,7 +83,7 @@ public class TimeObservationCreateCommand extends EditElementCommand { if(container != null) {
return container;
}
- return this.eObject;
+ return eObject;
}
/**
@@ -87,24 +91,31 @@ public class TimeObservationCreateCommand extends EditElementCommand { */
@Override
public boolean canExecute() {
-
- return true;
-
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
+ return data.isPermitted();
}
/**
* @generated
*/
@Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
-
- final TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
-
- final Package owner = (Package)getElementToEdit();
- owner.getPackagedElements().add(newElement);
-
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
+ 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");
+ }
doConfigure(newElement, monitor, info);
-
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -112,15 +123,14 @@ public class TimeObservationCreateCommand extends EditElementCommand { /**
* @generated
*/
- protected void doConfigure(final TimeObservation newElement, final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
- final ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
+ protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ IElementType elementType = ((CreateElementRequest)getRequest()).getElementType();
+ ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest)getRequest()).getClientContext());
configureRequest.addParameters(getRequest().getParameters());
- final ICommand configureCommand = elementType.getEditCommand(configureRequest);
+ ICommand configureCommand = elementType.getEditCommand(configureRequest);
if(configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java index b591034abdd..d6b6150cf1c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineCompartmentItemSemanticEditPolicyCN.java @@ -13,6 +13,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.CompactStateInvariantCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DestructionOccurrenceSpecificationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationConstraintCreateCommandCN;
@@ -42,8 +43,8 @@ public class CompactLifelineCompartmentItemSemanticEditPolicyCN extends UMLBaseI * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -54,8 +55,7 @@ public class CompactLifelineCompartmentItemSemanticEditPolicyCN extends UMLBaseI if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -64,57 +64,56 @@ public class CompactLifelineCompartmentItemSemanticEditPolicyCN extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CompactStateInvariantCreateCommandCN(req));
+ return getGEFWrapper(new CompactStateInvariantCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OccurrenceSpecification_12 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.MessageOccurrenceSpecification_13 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DestructionOccurrenceSpecification_27 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_18 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_17 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommandCN(req));
+ return getGEFWrapper(new DurationObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_15 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ return getGEFWrapper(new TimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_16 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.GeneralOrdering_67 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new GeneralOrderingCreateCommand(req));
+ return getGEFWrapper(new GeneralOrderingCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java index 35430e90f2d..d511667691c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class CompactLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemantic }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java index 75528f51e37..67674586c5c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java @@ -33,8 +33,8 @@ public class CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -45,13 +45,11 @@ public class CompactLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java index 34cf94b472e..e6245ba1791 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/CompactStateInvariantItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class CompactStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSe }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java index 54131bcc319..bd48a03cfc1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DestructionOccurrenceSpecificationItemSemanticEditPolicyCN.java @@ -62,13 +62,12 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -80,16 +79,16 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -100,8 +99,7 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -154,8 +152,8 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -166,8 +164,7 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -224,7 +221,7 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageSyncEditPart.VISUAL_ID:
return getGEFWrapper(new MessageSyncReorientCommand(req));
@@ -243,5 +240,4 @@ public class DestructionOccurrenceSpecificationItemSemanticEditPolicyCN extends }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java index d1b48b72954..6704305bfd5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationConstraintItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class DurationConstraintItemSemanticEditPolicyCN extends UMLBaseItemSeman }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java index 93cca0e6d66..bb0d2900ab1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/DurationObservationItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class DurationObservationItemSemanticEditPolicyCN extends UMLBaseItemSema }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java index fdbdd05ba22..3492ae2d96c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class FullLifelineItemSemanticEditPolicyCN extends UMLBaseItemSemanticEdi }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java index 340edfbf3fa..e519a13860f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN.java @@ -33,8 +33,8 @@ public class FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN exte * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -45,13 +45,11 @@ public class FullLifelineStateDefinitionCompartmentItemSemanticEditPolicyCN exte if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java index 71294a04fc9..7c715eea807 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN.java @@ -33,8 +33,8 @@ public class FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends UM * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -45,13 +45,11 @@ public class FullLifelineTimeRulerCompartmentItemSemanticEditPolicyCN extends UM if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java index 8ea077efd8f..6ea609ee11f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullLifelineTimelineCompartmentItemSemanticEditPolicyCN.java @@ -13,6 +13,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DestructionOccurrenceSpecificationCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationConstraintCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.DurationObservationCreateCommandCN;
@@ -42,8 +43,8 @@ public class FullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends UML * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -54,8 +55,7 @@ public class FullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends UML if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -64,57 +64,56 @@ public class FullLifelineTimelineCompartmentItemSemanticEditPolicyCN extends UML if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FullStateInvariantCreateCommandCN(req));
+ return getGEFWrapper(new FullStateInvariantCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.OccurrenceSpecification_12 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new OccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.MessageOccurrenceSpecification_13 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new MessageOccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DestructionOccurrenceSpecification_27 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req));
+ return getGEFWrapper(new DestructionOccurrenceSpecificationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationConstraint_18 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationConstraintCreateCommandCN(req));
+ return getGEFWrapper(new DurationConstraintCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.DurationObservation_17 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DurationObservationCreateCommandCN(req));
+ return getGEFWrapper(new DurationObservationCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeConstraint_15 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeConstraintCreateCommand(req));
+ return getGEFWrapper(new TimeConstraintCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.TimeObservation_16 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new TimeObservationCreateCommand(req));
+ return getGEFWrapper(new TimeObservationCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.GeneralOrdering_67 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new GeneralOrderingCreateCommand(req));
+ return getGEFWrapper(new GeneralOrderingCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java index 19b2c6a2450..6f17fc0a148 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/FullStateInvariantItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class FullStateInvariantItemSemanticEditPolicyCN extends UMLBaseItemSeman }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java index e190f061e29..c56d2b1a8b6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GateItemSemanticEditPolicy.java @@ -62,13 +62,12 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -80,16 +79,16 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -100,8 +99,7 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -154,8 +152,8 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -166,8 +164,7 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -224,7 +221,7 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageSyncEditPart.VISUAL_ID:
return getGEFWrapper(new MessageSyncReorientCommand(req));
@@ -243,5 +240,4 @@ public class GateItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java index ed3cbe1fc87..b48b1468880 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/GeneralOrderingItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class GeneralOrderingItemSemanticEditPolicy extends UMLBaseItemSemanticEd }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java index 69ab0662cdd..97657b54fca 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionCompartmentItemSemanticEditPolicyTN.java @@ -13,6 +13,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.CompactLifelineCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.FullLifelineCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
@@ -35,8 +36,8 @@ public class InteractionCompartmentItemSemanticEditPolicyTN extends UMLBaseItemS * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -47,8 +48,7 @@ public class InteractionCompartmentItemSemanticEditPolicyTN extends UMLBaseItemS if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -57,15 +57,14 @@ public class InteractionCompartmentItemSemanticEditPolicyTN extends UMLBaseItemS if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new FullLifelineCreateCommandCN(req));
+ return getGEFWrapper(new FullLifelineCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Lifeline_20 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CompactLifelineCreateCommandCN(req));
+ return getGEFWrapper(new CompactLifelineCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java index 8cac636666b..951e7cbe0fa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/InteractionNodeItemSemanticEditPolicyTN.java @@ -20,6 +20,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.GateCreateCommand;
@@ -49,8 +50,8 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -61,8 +62,7 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -71,7 +71,7 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new GateCreateCommand(req));
+ return getGEFWrapper(new GateCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
@@ -80,13 +80,12 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -98,16 +97,16 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +117,7 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -139,8 +137,8 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -151,8 +149,7 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -176,7 +173,7 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -185,5 +182,4 @@ public class InteractionNodeItemSemanticEditPolicyTN extends UMLBaseItemSemantic }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java index 7ae3dc0af57..b220587bea3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/LifelineItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class LifelineItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java index c21cdaac003..8be6b8c5405 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageAsyncItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageAsyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditP }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java index 045509d391d..6b5ae8ebec7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageCreateItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageCreateItemSemanticEditPolicy extends UMLBaseItemSemanticEdit }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java index aa34ce1db35..4a66baa1d11 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageDeleteItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageDeleteItemSemanticEditPolicy extends UMLBaseItemSemanticEdit }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java index 545da71153f..b66876f0a6c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageFoundItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageFoundItemSemanticEditPolicy extends UMLBaseItemSemanticEditP }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java index 2db6c1a129c..8122664ee02 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageLostItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageLostItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java index b208e5ef77d..1eb64daf1de 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageOccurrenceSpecificationItemSemanticEditPolicyCN.java @@ -62,13 +62,12 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -80,16 +79,16 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -100,8 +99,7 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -154,8 +152,8 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -166,8 +164,7 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -224,7 +221,7 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageSyncEditPart.VISUAL_ID:
return getGEFWrapper(new MessageSyncReorientCommand(req));
@@ -243,5 +240,4 @@ public class MessageOccurrenceSpecificationItemSemanticEditPolicyCN extends UMLB }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java index dd1493ea725..9d954226292 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageReplyItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageReplyItemSemanticEditPolicy extends UMLBaseItemSemanticEditP }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java index dd20f687f39..110751085f6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/MessageSyncItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class MessageSyncItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java index 96f23dfc1ca..b005705e735 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/OccurrenceSpecificationItemSemanticEditPolicyCN.java @@ -47,13 +47,12 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class OccurrenceSpecificationItemSemanticEditPolicyCN extends UMLBaseItem }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java index 6a780ca14b0..eb03a240084 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeConstraintItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class TimeConstraintItemSemanticEditPolicy extends UMLBaseItemSemanticEdi }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java index 1efd5463cc4..0bff4374b8b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeObservationItemSemanticEditPolicy.java @@ -47,13 +47,12 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
- final EObject selectedEObject = req.getElementToDestroy();
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ EObject selectedEObject = req.getElementToDestroy();
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject);
if(provider != null) {
// Retrieve delete command from the Element Edit service
- final ICommand deleteCommand = provider.getEditCommand(req);
-
+ ICommand deleteCommand = provider.getEditCommand(req);
if(deleteCommand != null) {
return new ICommandProxy(deleteCommand);
}
@@ -65,16 +64,16 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
return command != null ? command : super.getCreateRelationshipCommand(req);
}
/**
* @generated
*/
- protected Command getStartCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -85,8 +84,7 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -106,8 +104,8 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd /**
* @generated
*/
- protected Command getCompleteCreateRelationshipCommand(final CreateRelationshipRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return null;
}
@@ -118,8 +116,7 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -143,7 +140,7 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd * @generated
*/
@Override
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
switch(getVisualID(req)) {
case MessageLostEditPart.VISUAL_ID:
return getGEFWrapper(new MessageLostReorientCommand(req));
@@ -152,5 +149,4 @@ public class TimeObservationItemSemanticEditPolicy extends UMLBaseItemSemanticEd }
return super.getReorientRelationshipCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java index ca41ca53b9d..786d6f8d57a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimeRulerCompartmentItemSemanticEditPolicyCN.java @@ -33,8 +33,8 @@ public class TimeRulerCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSem * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -45,13 +45,11 @@ public class TimeRulerCompartmentItemSemanticEditPolicyCN extends UMLBaseItemSem if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
}
return super.getCreateCommand(req);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java index 82de5aedcc9..faf71de7429 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/TimingDiagramEditPartFactoryItemSemanticEditPolicy.java @@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.timing.edit.commands.InteractionCreateCommandTN;
import org.eclipse.papyrus.uml.diagram.timing.providers.UMLElementTypes;
@@ -39,8 +40,8 @@ public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseI * @generated
*/
@Override
- protected Command getCreateCommand(final CreateElementRequest req) {
- final IElementType requestElementType = req.getElementType();
+ protected Command getCreateCommand(CreateElementRequest req) {
+ IElementType requestElementType = req.getElementType();
if(requestElementType == null) {
return super.getCreateCommand(req);
}
@@ -51,8 +52,7 @@ public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseI if(baseElementType != null) {
isExtendedType = true;
} else {
- // no reference element type ID. using the closest super element type to give more opportunities, but
- // can lead to bugs.
+ // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs.
baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType)requestElementType);
isExtendedType = true;
}
@@ -61,7 +61,7 @@ public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseI if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new InteractionCreateCommandTN(req));
+ return getGEFWrapper(new InteractionCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
@@ -70,8 +70,8 @@ public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseI * @generated
*/
@Override
- protected Command getDuplicateCommand(final DuplicateElementsRequest req) {
- final TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
Diagram currentDiagram = null;
if(getHost() instanceof IGraphicalEditPart) {
currentDiagram = ((IGraphicalEditPart)getHost()).getNotationView().getDiagram();
@@ -87,15 +87,14 @@ public class TimingDiagramEditPartFactoryItemSemanticEditPolicy extends UMLBaseI /**
* @generated
*/
- private final Diagram diagram;
+ private Diagram diagram;
/**
* @generated
*/
- public DuplicateAnythingCommand(final TransactionalEditingDomain editingDomain, final DuplicateElementsRequest req, final Diagram currentDiagram) {
+ public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req, Diagram currentDiagram) {
super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap(), currentDiagram);
this.diagram = currentDiagram;
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java index 0387a764619..cd6ebf02c73 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -81,8 +81,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected UMLBaseItemSemanticEditPolicy(final IElementType elementType) {
- this.myElementType = elementType;
+ protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
+ myElementType = elementType;
}
/**
@@ -96,13 +96,13 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { */
@Override
@SuppressWarnings("unchecked")
- public Command getCommand(final Request request) {
+ public Command getCommand(Request request) {
if(request instanceof ReconnectRequest) {
- final Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
+ Object view = ((ReconnectRequest)request).getConnectionEditPart().getModel();
if(view instanceof View) {
- final Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View)view));
+ Integer id = new Integer(UMLVisualIDRegistry.getVisualID((View)view));
request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
+ request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, (View)view);
}
}
return super.getCommand(request);
@@ -113,8 +113,8 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { *
* @generated
*/
- protected int getVisualID(final IEditCommandRequest request) {
- final Object id = request.getParameter(VISUAL_ID_KEY);
+ protected int getVisualID(IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
return id instanceof Integer ? ((Integer)id).intValue() : -1;
}
@@ -122,12 +122,12 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { * @generated
*/
@Override
- protected Command getSemanticCommand(final IEditCommandRequest request) {
- final IEditCommandRequest completedRequest = completeRequest(request);
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ IEditCommandRequest completedRequest = completeRequest(request);
Command semanticCommand = getSemanticCommandSwitch(completedRequest);
semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
if(completedRequest instanceof DestroyRequest) {
- final DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
+ DestroyRequest destroyRequest = (DestroyRequest)completedRequest;
return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
}
return semanticCommand;
@@ -136,20 +136,20 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command addDeleteViewCommand(final Command mainCommand, final DestroyRequest completedRequest) {
- final Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
+ protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
+ Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View)getHost().getModel()));
return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
}
/**
* @generated
*/
- private Command getEditHelperCommand(final IEditCommandRequest request, final Command editPolicyCommand) {
+ private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
if(editPolicyCommand != null) {
- final ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
+ ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy)editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
}
- final IElementType requestContextElementType = getContextElementType(request);
+ IElementType requestContextElementType = getContextElementType(request);
request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
ICommand command = requestContextElementType.getEditCommand(request);
request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
@@ -166,15 +166,15 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected IElementType getContextElementType(final IEditCommandRequest request) {
- final IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : this.myElementType;
+ protected IElementType getContextElementType(IEditCommandRequest request) {
+ IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
}
/**
* @generated
*/
- protected Command getSemanticCommandSwitch(final IEditCommandRequest req) {
+ protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
if(req instanceof CreateRelationshipRequest) {
return getCreateRelationshipCommand((CreateRelationshipRequest)req);
} else if(req instanceof CreateElementRequest) {
@@ -204,22 +204,22 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getConfigureCommand(final ConfigureRequest req) {
+ protected Command getConfigureCommand(ConfigureRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getCreateRelationshipCommand(final CreateRelationshipRequest req) {
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getCreateCommand(final CreateElementRequest req) {
- // no more usage of the extended types here.
+ protected Command getCreateCommand(CreateElementRequest req) {
+ // no more usage of the extended types here.
return null;
}
@@ -227,39 +227,39 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getExtendedTypeCreationCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
+ protected Command getExtendedTypeCreationCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(request.getContainer());
if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
- final ICommand createGMFCommand = provider.getEditCommand(request);
+ ICommand createGMFCommand = provider.getEditCommand(request);
return getGEFWrapper(createGMFCommand);
}
/**
* @generated
*/
- protected Command getExtendedStartCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ protected Command getExtendedStartCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
- final ICommand createGMFCommand = provider.getEditCommand(request);
+ ICommand createGMFCommand = provider.getEditCommand(request);
return getGEFWrapper(createGMFCommand);
}
/**
* @generated
*/
- protected Command getExtendedCompleteCreateRelationshipCommand(final CreateElementRequest request, final IExtendedHintedElementType requestElementType) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
+ protected Command getExtendedCompleteCreateRelationshipCommand(CreateElementRequest request, IExtendedHintedElementType requestElementType) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(requestElementType);
if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve create command from the Element Edit service
- final ICommand createGMFCommand = provider.getEditCommand(request);
+ ICommand createGMFCommand = provider.getEditCommand(request);
return getGEFWrapper(createGMFCommand);
}
@@ -267,48 +267,47 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- protected Command getSetCommand(final SetRequest req) {
+ protected Command getSetCommand(SetRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getEditContextCommand(final GetEditContextRequest req) {
+ protected Command getEditContextCommand(GetEditContextRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getDestroyElementCommand(final DestroyElementRequest req) {
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getDestroyReferenceCommand(final DestroyReferenceRequest req) {
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getDuplicateCommand(final DuplicateElementsRequest req) {
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
return null;
}
/**
* @generated
*/
- protected Command getMoveCommand(final MoveRequest req) {
-
- final EObject targetCEObject = req.getTargetContainer();
+ protected Command getMoveCommand(MoveRequest req) {
+ EObject targetCEObject = req.getTargetContainer();
if(targetCEObject != null) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
if(provider != null) {
- final ICommand moveCommand = provider.getEditCommand(req);
+ ICommand moveCommand = provider.getEditCommand(req);
if(moveCommand != null) {
return new ICommandProxy(moveCommand);
}
@@ -317,27 +316,26 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { } else {
return getGEFWrapper(new MoveElementsCommand(req));
}
-
}
/**
* @generated
*/
- protected Command getReorientReferenceRelationshipCommand(final ReorientReferenceRelationshipRequest req) {
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
return UnexecutableCommand.INSTANCE;
}
/**
* @generated
*/
- protected Command getReorientRelationshipCommand(final ReorientRelationshipRequest req) {
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
return UnexecutableCommand.INSTANCE;
}
/**
* @generated
*/
- protected final Command getGEFWrapper(final ICommand cmd) {
+ protected final Command getGEFWrapper(ICommand cmd) {
return new ICommandProxy(cmd);
}
@@ -355,10 +353,10 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { *
* @generated
*/
- protected void addDestroyShortcutsCommand(final ICompositeCommand cmd, final View view) {
+ protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for(final Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- final View nextView = (View)it.next();
+ for(Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ View nextView = (View)it.next();
if(nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
continue;
}
@@ -392,100 +390,99 @@ public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { /**
* @generated
*/
- public boolean canCreateMessage_3(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ public boolean canCreateMessage_3(Interaction container, MessageEnd source, MessageEnd target) {
return canExistMessage_3(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_4(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ public boolean canCreateMessage_4(Interaction container, MessageEnd source, MessageEnd target) {
return canExistMessage_4(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_41(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ public boolean canCreateMessage_41(Interaction container, MessageEnd source, MessageEnd target) {
return canExistMessage_41(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_44(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ public boolean canCreateMessage_44(Interaction container, MessageEnd source, MessageEnd target) {
return canExistMessage_44(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_47(final Interaction container, final MessageEnd source, final MessageEnd target) {
+ public boolean canCreateMessage_47(Interaction container, MessageEnd source, MessageEnd target) {
return canExistMessage_47(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_50(final Interaction container, final MessageEnd source, final Element target) {
+ public boolean canCreateMessage_50(Interaction container, MessageEnd source, Element target) {
return canExistMessage_50(container, null, source, target);
}
/**
* @generated
*/
- public boolean canCreateMessage_53(final Interaction container, final Element source, final MessageEnd target) {
+ public boolean canCreateMessage_53(Interaction container, Element source, MessageEnd target) {
return canExistMessage_53(container, null, source, target);
}
/**
* @generated
*/
- public boolean canExistMessage_3(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ public boolean canExistMessage_3(Interaction container, Message linkInstance, MessageEnd source, MessageEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_4(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ public boolean canExistMessage_4(Interaction container, Message linkInstance, MessageEnd source, MessageEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_41(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ public boolean canExistMessage_41(Interaction container, Message linkInstance, MessageEnd source, MessageEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_44(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ public boolean canExistMessage_44(Interaction container, Message linkInstance, MessageEnd source, MessageEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_47(final Interaction container, final Message linkInstance, final MessageEnd source, final MessageEnd target) {
+ public boolean canExistMessage_47(Interaction container, Message linkInstance, MessageEnd source, MessageEnd target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_50(final Interaction container, final Message linkInstance, final MessageEnd source, final Element target) {
+ public boolean canExistMessage_50(Interaction container, Message linkInstance, MessageEnd source, Element target) {
return true;
}
/**
* @generated
*/
- public boolean canExistMessage_53(final Interaction container, final Message linkInstance, final Element source, final MessageEnd target) {
+ public boolean canExistMessage_53(Interaction container, Message linkInstance, Element source, MessageEnd target) {
return true;
}
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java index 80bcd5386fd..aa740184aa5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextNonResizableEditPolicy.java @@ -72,7 +72,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl ((WrappingLabel)getHostFigure()).setFocus(false);
} else {
hideSelection();
- addFeedback(this.selectionFeedbackFigure = createSelectionFeedbackFigure());
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
getHostFigure().addFigureListener(getHostPositionListener());
refreshSelectionFeedback();
hideFocus();
@@ -88,10 +88,10 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl ((WrappingLabel)getHostFigure()).setSelected(false);
((WrappingLabel)getHostFigure()).setFocus(false);
} else {
- if(this.selectionFeedbackFigure != null) {
- removeFeedback(this.selectionFeedbackFigure);
+ if(selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
getHostFigure().removeFigureListener(getHostPositionListener());
- this.selectionFeedbackFigure = null;
+ selectionFeedbackFigure = null;
}
hideFocus();
}
@@ -106,7 +106,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl ((WrappingLabel)getHostFigure()).setFocus(true);
} else {
hideFocus();
- addFeedback(this.focusFeedbackFigure = createFocusFeedbackFigure());
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
refreshFocusFeedback();
}
}
@@ -119,9 +119,9 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl if(getHostFigure() instanceof WrappingLabel) {
((WrappingLabel)getHostFigure()).setFocus(false);
} else {
- if(this.focusFeedbackFigure != null) {
- removeFeedback(this.focusFeedbackFigure);
- this.focusFeedbackFigure = null;
+ if(focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
}
}
}
@@ -147,13 +147,13 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */
protected IFigure createSelectionFeedbackFigure() {
if(getHostFigure() instanceof Label) {
- final Label feedbackFigure = new Label();
+ Label feedbackFigure = new Label();
feedbackFigure.setOpaque(true);
feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
return feedbackFigure;
} else {
- final RectangleFigure feedbackFigure = new RectangleFigure();
+ RectangleFigure feedbackFigure = new RectangleFigure();
feedbackFigure.setFill(false);
return feedbackFigure;
}
@@ -165,8 +165,7 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl protected IFigure createFocusFeedbackFigure() {
return new Figure() {
- @Override
- protected void paintFigure(final Graphics graphics) {
+ protected void paintFigure(Graphics graphics) {
graphics.drawFocus(getBounds().getResized(-1, -1));
}
};
@@ -175,8 +174,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl /**
* @generated
*/
- protected void updateLabel(final Label target) {
- final Label source = (Label)getHostFigure();
+ protected void updateLabel(Label target) {
+ Label source = (Label)getHostFigure();
target.setText(source.getText());
target.setTextAlignment(source.getTextAlignment());
target.setFont(source.getFont());
@@ -186,12 +185,12 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated
*/
protected void refreshSelectionFeedback() {
- if(this.selectionFeedbackFigure != null) {
- if(this.selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)this.selectionFeedbackFigure);
- this.selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ if(selectionFeedbackFigure != null) {
+ if(selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label)selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
} else {
- this.selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
}
}
}
@@ -200,8 +199,8 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated
*/
protected void refreshFocusFeedback() {
- if(this.focusFeedbackFigure != null) {
- this.focusFeedbackFigure.setBounds(getFeedbackBounds());
+ if(focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
}
}
@@ -217,15 +216,15 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl * @generated
*/
private FigureListener getHostPositionListener() {
- if(this.hostPositionListener == null) {
- this.hostPositionListener = new FigureListener() {
+ if(hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
- public void figureMoved(final IFigure source) {
+ public void figureMoved(IFigure source) {
refreshFeedback();
}
};
}
- return this.hostPositionListener;
+ return hostPositionListener;
}
/**
@@ -233,10 +232,9 @@ public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx impl */
@Override
protected List createSelectionHandles() {
- final MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost());
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart)getHost());
moveHandle.setBorder(null);
moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
return Collections.singletonList(moveHandle);
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java index d9f06ea32da..7b2da04390d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/edit/policies/UMLTextSelectionEditPolicy.java @@ -66,7 +66,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I ((WrappingLabel)getHostFigure()).setFocus(false);
} else {
hideSelection();
- addFeedback(this.selectionFeedbackFigure = createSelectionFeedbackFigure());
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
getHostFigure().addFigureListener(getHostPositionListener());
refreshSelectionFeedback();
hideFocus();
@@ -82,10 +82,10 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I ((WrappingLabel)getHostFigure()).setSelected(false);
((WrappingLabel)getHostFigure()).setFocus(false);
} else {
- if(this.selectionFeedbackFigure != null) {
- removeFeedback(this.selectionFeedbackFigure);
+ if(selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
getHostFigure().removeFigureListener(getHostPositionListener());
- this.selectionFeedbackFigure = null;
+ selectionFeedbackFigure = null;
}
hideFocus();
}
@@ -100,7 +100,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I ((WrappingLabel)getHostFigure()).setFocus(true);
} else {
hideFocus();
- addFeedback(this.focusFeedbackFigure = createFocusFeedbackFigure());
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
refreshFocusFeedback();
}
}
@@ -113,9 +113,9 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I if(getHostFigure() instanceof WrappingLabel) {
((WrappingLabel)getHostFigure()).setFocus(false);
} else {
- if(this.focusFeedbackFigure != null) {
- removeFeedback(this.focusFeedbackFigure);
- this.focusFeedbackFigure = null;
+ if(focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
}
}
}
@@ -141,13 +141,13 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I */
protected IFigure createSelectionFeedbackFigure() {
if(getHostFigure() instanceof Label) {
- final Label feedbackFigure = new Label();
+ Label feedbackFigure = new Label();
feedbackFigure.setOpaque(true);
feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
return feedbackFigure;
} else {
- final RectangleFigure feedbackFigure = new RectangleFigure();
+ RectangleFigure feedbackFigure = new RectangleFigure();
feedbackFigure.setFill(false);
return feedbackFigure;
}
@@ -159,8 +159,7 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I protected IFigure createFocusFeedbackFigure() {
return new Figure() {
- @Override
- protected void paintFigure(final Graphics graphics) {
+ protected void paintFigure(Graphics graphics) {
graphics.drawFocus(getBounds().getResized(-1, -1));
}
};
@@ -169,8 +168,8 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I /**
* @generated
*/
- protected void updateLabel(final Label target) {
- final Label source = (Label)getHostFigure();
+ protected void updateLabel(Label target) {
+ Label source = (Label)getHostFigure();
target.setText(source.getText());
target.setTextAlignment(source.getTextAlignment());
target.setFont(source.getFont());
@@ -180,12 +179,12 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated
*/
protected void refreshSelectionFeedback() {
- if(this.selectionFeedbackFigure != null) {
- if(this.selectionFeedbackFigure instanceof Label) {
- updateLabel((Label)this.selectionFeedbackFigure);
- this.selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ if(selectionFeedbackFigure != null) {
+ if(selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label)selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
} else {
- this.selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
}
}
}
@@ -194,8 +193,8 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated
*/
protected void refreshFocusFeedback() {
- if(this.focusFeedbackFigure != null) {
- this.focusFeedbackFigure.setBounds(getFeedbackBounds());
+ if(focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
}
}
@@ -211,15 +210,14 @@ public class UMLTextSelectionEditPolicy extends SelectionEditPolicy implements I * @generated
*/
private FigureListener getHostPositionListener() {
- if(this.hostPositionListener == null) {
- this.hostPositionListener = new FigureListener() {
+ if(hostPositionListener == null) {
+ hostPositionListener = new FigureListener() {
- public void figureMoved(final IFigure source) {
+ public void figureMoved(IFigure source) {
refreshFeedback();
}
};
}
- return this.hostPositionListener;
+ return hostPositionListener;
}
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java index dabf088973a..d497b04f62c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLVisualIDRegistry.java @@ -159,17 +159,8 @@ public class UMLVisualIDRegistry { return Integer.toString(visualID);
}
- /**
- * @generated
- */
public static int getDiagramVisualID(final EObject domainElement) {
- if(domainElement == null) {
- return -1;
- }
- if(UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((Package)domainElement)) {
- return TimingDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return TimingDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF index 46aebfc41a0..546fcb7082d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF @@ -69,13 +69,12 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.gef,
- org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiag
- ramEditorPlugin
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.usecase;singleton
- :=true
-
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.usecase.part.UMLDiagramEditorPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.usecase; singleton:=true
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/CreateUseCaseDiagramWithNavigationHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/CreateUseCaseDiagramWithNavigationHandler.java deleted file mode 100644 index c196e9be1bc..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/CreateUseCaseDiagramWithNavigationHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.usecase;
-
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreateDiagramWithNavigationHandler;
-
-public class CreateUseCaseDiagramWithNavigationHandler extends CreateDiagramWithNavigationHandler {
-
- public CreateUseCaseDiagramWithNavigationHandler() {
- super(new CreateUseCaseDiagramCommand(), new UseCaseDiagramCreationCondition());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UseCaseDiagramCreationCondition.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UseCaseDiagramCreationCondition.java index 7dca91bfb74..d0c215e6ba8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UseCaseDiagramCreationCondition.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/UseCaseDiagramCreationCondition.java @@ -23,9 +23,6 @@ public class UseCaseDiagramCreationCondition extends PerspectiveContextDependenc * @return whether the diagram can be created.
*/
public boolean create(EObject selectedElement) {
- if(super.create(selectedElement)) {
- return selectedElement instanceof org.eclipse.uml2.uml.Package;
- }
return false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateAssociationSupplement.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateAssociationSupplement.java index 73283fc88b3..8eac18e73fa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateAssociationSupplement.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateAssociationSupplement.java @@ -19,6 +19,7 @@ import java.util.List; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.common.commands.SupplementCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Association;
@@ -44,8 +45,8 @@ public class CreateAssociationSupplement extends SupplementCommand { * @param target
* the target of the association (Type)
*/
- public CreateAssociationSupplement(EObject container, EObject source, EObject target) {
- super(container, source, target);
+ public CreateAssociationSupplement(EObject container, EObject source, EObject target, Diagram diagram) {
+ super(container, source, target, diagram);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateExtensionPointCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateExtensionPointCommand.java index 6c9e9adfd53..fbbf22541ad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateExtensionPointCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/command/CreateExtensionPointCommand.java @@ -30,6 +30,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -67,8 +68,8 @@ public class CreateExtensionPointCommand extends Command { /** adapter to get the extend element */
private IAdaptable adapter;
- public CreateExtensionPointCommand(IHintedType elementType, AbstractEditPart compartmentPart, EObject container, IAdaptable adapter) {
- elementCreationCommand = getElementCreationCommand(container, elementType);
+ public CreateExtensionPointCommand(IHintedType elementType, AbstractEditPart compartmentPart, EObject container, IAdaptable adapter, Diagram diagram) {
+ elementCreationCommand = getElementCreationCommand(container, elementType, diagram);
type = elementType;
compartment = compartmentPart;
containerObject = container;
@@ -84,10 +85,10 @@ public class CreateExtensionPointCommand extends Command { * the type of the extension point
* @return the command to create model element or null
*/
- private static ICommandProxy getElementCreationCommand(EObject container, IHintedType elementType) {
+ private static ICommandProxy getElementCreationCommand(EObject container, IHintedType elementType, Diagram diagram) {
CreateElementRequest createElementReq = new CreateElementRequest(container, elementType);
if(UMLElementTypes.ExtensionPoint_3007.equals(elementType)) {
- ExtensionPointCreateCommand cmd = new ExtensionPointCreateCommand(createElementReq);
+ ExtensionPointCreateCommand cmd = new ExtensionPointCreateCommand(createElementReq, diagram);
return new ICommandProxy(cmd);
} else {
return null;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CreateExtensionPointEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CreateExtensionPointEditPolicy.java index 4643ac3ec24..e8e625ac4f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CreateExtensionPointEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CreateExtensionPointEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest; import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.command.CreateExtensionPointCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
import org.eclipse.uml2.uml.Extend;
@@ -51,7 +52,7 @@ public class CreateExtensionPointEditPolicy extends GraphicalNodeEditPolicy { if(targetEP instanceof AbstractEditPart) {
IAdaptable adapter = getExtendViewAdapter(request);
EObject usecase = ViewUtil.resolveSemanticElement((View)getHost().getModel());
- CreateExtensionPointCommand createExtensionPointCommand = new CreateExtensionPointCommand((IHintedType)UMLElementTypes.ExtensionPoint_3007, (AbstractEditPart)targetEP, usecase, adapter);
+ CreateExtensionPointCommand createExtensionPointCommand = new CreateExtensionPointCommand((IHintedType)UMLElementTypes.ExtensionPoint_3007, (AbstractEditPart)targetEP, usecase, adapter, DiagramUtils.getDiagramFrom(getHost()));
compound.add(createExtensionPointCommand);
return compound;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomDefaultNamedElementItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomDefaultNamedElementItemSemanticEditPolicyTN.java index 4dce914a316..4eac682e624 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomDefaultNamedElementItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomDefaultNamedElementItemSemanticEditPolicyTN.java @@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AssociationCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.GeneralizationCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
@@ -35,7 +36,7 @@ public class CustomDefaultNamedElementItemSemanticEditPolicyTN extends DefaultNa EObject eobject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
if((eobject instanceof Class) || (eobject instanceof Actor) || (eobject instanceof UseCase)) {
if(UMLElementTypes.Association_4011 == req.getElementType()) {
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
}
if((eobject instanceof Class) || (eobject instanceof Actor) || (eobject instanceof UseCase)) {
@@ -51,7 +52,7 @@ public class CustomDefaultNamedElementItemSemanticEditPolicyTN extends DefaultNa EObject eobject = ((GraphicalEditPart)getHost()).resolveSemanticElement();
if((eobject instanceof Class) || (eobject instanceof Actor) || (eobject instanceof UseCase)) {
if(UMLElementTypes.Association_4011 == req.getElementType()) {
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
}
if((eobject instanceof Class) || (eobject instanceof Actor) || (eobject instanceof UseCase)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomUseCaseDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomUseCaseDiagramItemSemanticEditPolicy.java index 00b1efc8fd6..07defde279b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomUseCaseDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/CustomUseCaseDiagramItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.command.CustomSubjectClassifierCreateCommandTN;
@@ -106,7 +107,7 @@ public class CustomUseCaseDiagramItemSemanticEditPolicy extends UseCaseDiagramIt else if(executableCommandCreation.size() > 1) {
return new ICommandProxy(new CustomSubjectClassifierCreateCommandTN(req, containerElement, executableHTypeCreation));
}
- return getGEFWrapper(new SubjectClassifierCreateCommandTN(req));
+ return getGEFWrapper(new SubjectClassifierCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml index 31d6135b63d..d3ce774b53f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml @@ -35,75 +35,6 @@ </command>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramWithNavigationHandler"
- commandId="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramCommand">
- <activeWhen>
- <or>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </or>
- </activeWhen>
- </handler>
- </extension>
-
- <extension
- point="org.eclipse.ui.menus">
-
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramCommand"
- icon="icons/obj16/Diagram_UseCase.gif"
- label="Create a new UseCase Diagram"
- style="push"
- tooltip="Create a new UseCase Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
-
- <menuContribution
- locationURI="menu:org.eclipse.papyrus.ui.menu">
- <menu
- id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
- label="Diagrams">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramCommand"
- icon="icons/obj16/Diagram_UseCase.gif"
- label="Create a new UseCase Diagram"
- style="push"
- tooltip="Create a new UseCase Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <command commandId="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramCommand"
- icon="icons/obj16/Diagram_UseCase.gif"
- label="Create a new UseCase Diagram"
- style="push"
- tooltip="Create a new UseCase Diagram">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
- </extension>
<extension
point="org.eclipse.papyrus.infra.core.papyrusDiagram">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorAsRectangleCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorAsRectangleCreateCommandTN.java index 80eb23a0f07..b8a8f889b1a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorAsRectangleCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorAsRectangleCreateCommandTN.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorAsRectangleCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorAsRectangleCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ActorAsRectangleCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ActorAsRectangleCreateCommandTN(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 ActorAsRectangleCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ActorAsRectangleCreateCommandTN(req, eObject);
+ public static ActorAsRectangleCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorAsRectangleCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorAsRectangleCreateCommandTN(CreateElementRequest req) {
+ public ActorAsRectangleCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActorAsRectangleCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ActorAsRectangleCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- 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_Actor_2012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorCreateCommandTN.java index ed89d67ee6c..3ce6ae04db9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorCreateCommandTN.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ActorCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ActorCreateCommandTN(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 ActorCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ActorCreateCommandTN(req, eObject);
+ public static ActorCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorCreateCommandTN(CreateElementRequest req) {
+ public ActorCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActorCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ActorCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- 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_Actor_2011(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInComponentCreateCommand.java index 20099a043cc..3445db4b8a3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInComponentCreateCommand.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ActorInComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActorInComponentCreateCommand(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 ActorInComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActorInComponentCreateCommand(req, eObject);
+ public static ActorInComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorInComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorInComponentCreateCommand(CreateElementRequest req) {
+ public ActorInComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActorInComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ActorInComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- Class owner = (Class)getElementToEdit();
- owner.getNestedClassifiers().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 {
+ Class qualifiedTarget = (Class)target;
+ qualifiedTarget.getNestedClassifiers().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Actor_3018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInPackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInPackageCreateCommand.java index 275ae400c10..3569e50a616 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInPackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ActorInPackageCreateCommand.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ActorInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ActorInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ActorInPackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ActorInPackageCreateCommand(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 ActorInPackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ActorInPackageCreateCommand(req, eObject);
+ public static ActorInPackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ActorInPackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ActorInPackageCreateCommand(CreateElementRequest req) {
+ public ActorInPackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ActorInPackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActor());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ActorInPackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Actor newElement = UMLFactory.eINSTANCE.createActor();
- 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_Actor_3011(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/AssociationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/AssociationCreateCommand.java index 6a27162e911..1b11ba490e0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/AssociationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/AssociationCreateCommand.java @@ -24,6 +24,7 @@ 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.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.uml.diagram.usecase.command.CreateAssociationSupplement;
import org.eclipse.papyrus.uml.diagram.usecase.edit.policies.UMLBaseItemSemanticEditPolicy;
import org.eclipse.uml2.uml.Association;
@@ -51,12 +52,18 @@ public class AssociationCreateCommand extends EditElementCommand { protected Package container;
/**
- * @generated
+ * @generated NOT
+ */
+ protected Diagram diagram;
+
+ /**
+ * @generated NOT
*/
- public AssociationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ public AssociationCreateCommand(CreateRelationshipRequest request, EObject source, EObject target, Diagram diagram) {
super(request.getLabel(), null, request);
this.source = source;
this.target = target;
+ this.diagram = diagram;
container = deduceContainer(source, target);
}
@@ -90,7 +97,7 @@ public class AssociationCreateCommand extends EditElementCommand { if(!canExecute()) {
throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
}
- CreateAssociationSupplement cacs = new CreateAssociationSupplement(container, source, target);
+ CreateAssociationSupplement cacs = new CreateAssociationSupplement(container, source, target, diagram);
Association newElement = (Association)cacs.doDefaultElementCreation(getEditingDomain(), null);
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandCN.java index 406edcd123c..13a8277f876 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandCN.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandCN(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 CommentCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandCN(req, eObject);
+ public static CommentCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandCN(CreateElementRequest req) {
+ public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentCreateCommandCN 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentCreateCommandCN 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_3015(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandTN.java index 183bf38aae7..759ef34a987 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/CommentCreateCommandTN.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class CommentCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class CommentCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public CommentCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public CommentCreateCommandTN(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 CommentCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new CommentCreateCommandTN(req, eObject);
+ public static CommentCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new CommentCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public CommentCreateCommandTN(CreateElementRequest req) {
+ public CommentCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class CommentCreateCommandTN 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();
}
/**
@@ -96,8 +103,19 @@ public class CommentCreateCommandTN 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_2018(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInComponentCreateCommand.java index ae6dce93394..64edba637c9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInComponentCreateCommand.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class ComponentInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class ComponentInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ComponentInComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ComponentInComponentCreateCommand(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 ComponentInComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ComponentInComponentCreateCommand(req, eObject);
+ public static ComponentInComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentInComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentInComponentCreateCommand(CreateElementRequest req) {
+ public ComponentInComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class ComponentInComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class ComponentInComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- Component owner = (Component)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 {
+ Component qualifiedTarget = (Component)target;
+ qualifiedTarget.getPackagedElements().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_Component_3016(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInPackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInPackageCreateCommand.java index a72042470e0..ef76dcddcce 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInPackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ComponentInPackageCreateCommand.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ComponentInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ComponentInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ComponentInPackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ComponentInPackageCreateCommand(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 ComponentInPackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ComponentInPackageCreateCommand(req, eObject);
+ public static ComponentInPackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ComponentInPackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ComponentInPackageCreateCommand(CreateElementRequest req) {
+ public ComponentInPackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ComponentInPackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComponent());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ComponentInPackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Component newElement = UMLFactory.eINSTANCE.createComponent();
- 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_Component_3013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintCreateCommandTN.java index 8e781084d8f..65096dcd639 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintCreateCommandTN.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -38,7 +42,7 @@ public class ConstraintCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConstraintCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public ConstraintCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public ConstraintCreateCommandTN(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 ConstraintCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new ConstraintCreateCommandTN(req, eObject);
+ public static ConstraintCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintCreateCommandTN(CreateElementRequest req) {
+ public ConstraintCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ConstraintCreateCommandTN 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();
}
/**
@@ -96,8 +103,19 @@ public class ConstraintCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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_Constraint_2017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInComponentCreateCommand.java index fed2fc9653b..58e0ff6593d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInComponentCreateCommand.java @@ -24,11 +24,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.usecase.providers.ElementInitializers;
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
@@ -38,7 +42,7 @@ public class ConstraintInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ConstraintInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintInComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintInComponentCreateCommand(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 ConstraintInComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintInComponentCreateCommand(req, eObject);
+ public static ConstraintInComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintInComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintInComponentCreateCommand(CreateElementRequest req) {
+ public ConstraintInComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ConstraintInComponentCreateCommand 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();
}
/**
@@ -96,8 +103,19 @@ public class ConstraintInComponentCreateCommand 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_3017(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInPackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInPackageCreateCommand.java index 0ec4c352037..80ecdda285a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInPackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ConstraintInPackageCreateCommand.java @@ -24,12 +24,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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -39,7 +43,7 @@ public class ConstraintInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -49,24 +53,25 @@ public class ConstraintInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ConstraintInPackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ConstraintInPackageCreateCommand(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 ConstraintInPackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ConstraintInPackageCreateCommand(req, eObject);
+ public static ConstraintInPackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ConstraintInPackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ConstraintInPackageCreateCommand(CreateElementRequest req) {
+ public ConstraintInPackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -89,7 +94,9 @@ public class ConstraintInPackageCreateCommand 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 +104,19 @@ public class ConstraintInPackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- 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");
+ }
Namespace childHolder = (Namespace)getElementToEdit();
childHolder.getOwnedRules().add(newElement);
ElementInitializers.getInstance().init_Constraint_3010(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/DefaultNamedElementCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/DefaultNamedElementCreateCommandTN.java index c45812b0592..724863ecf11 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/DefaultNamedElementCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/DefaultNamedElementCreateCommandTN.java @@ -24,8 +24,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
@@ -35,7 +39,7 @@ public class DefaultNamedElementCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -45,24 +49,25 @@ public class DefaultNamedElementCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public DefaultNamedElementCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public DefaultNamedElementCreateCommandTN(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 DefaultNamedElementCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new DefaultNamedElementCreateCommandTN(req, eObject);
+ public static DefaultNamedElementCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new DefaultNamedElementCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public DefaultNamedElementCreateCommandTN(CreateElementRequest req) {
+ public DefaultNamedElementCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -85,7 +90,9 @@ public class DefaultNamedElementCreateCommandTN 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.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointCreateCommand.java index 633bb0ad6e9..35da3a5eabc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointCreateCommand.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExtensionPoint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class ExtensionPointCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ExtensionPointCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ExtensionPointCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExtensionPointCreateCommand(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 ExtensionPointCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExtensionPointCreateCommand(req, eObject);
+ public static ExtensionPointCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExtensionPointCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExtensionPointCreateCommand(CreateElementRequest req) {
+ public ExtensionPointCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ExtensionPointCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExtensionPoint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ExtensionPointCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExtensionPoint newElement = UMLFactory.eINSTANCE.createExtensionPoint();
- UseCase owner = (UseCase)getElementToEdit();
- owner.getExtensionPoints().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 {
+ UseCase qualifiedTarget = (UseCase)target;
+ qualifiedTarget.getExtensionPoints().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ExtensionPoint_3007(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointInRectangleCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointInRectangleCreateCommand.java index 81a9a9399f5..dea7540cc37 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointInRectangleCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ExtensionPointInRectangleCreateCommand.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.ExtensionPoint;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class ExtensionPointInRectangleCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class ExtensionPointInRectangleCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ExtensionPointInRectangleCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ExtensionPointInRectangleCreateCommand(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 ExtensionPointInRectangleCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ExtensionPointInRectangleCreateCommand(req, eObject);
+ public static ExtensionPointInRectangleCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ExtensionPointInRectangleCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ExtensionPointInRectangleCreateCommand(CreateElementRequest req) {
+ public ExtensionPointInRectangleCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class ExtensionPointInRectangleCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getExtensionPoint());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class ExtensionPointInRectangleCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
ExtensionPoint newElement = UMLFactory.eINSTANCE.createExtensionPoint();
- UseCase owner = (UseCase)getElementToEdit();
- owner.getExtensionPoints().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 {
+ UseCase qualifiedTarget = (UseCase)target;
+ qualifiedTarget.getExtensionPoints().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
ElementInitializers.getInstance().init_ExtensionPoint_3008(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandCN.java index 370a8d30f4f..285276ab837 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandCN.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PackageCreateCommandCN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandCN(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 PackageCreateCommandCN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandCN(req, eObject);
+ public static PackageCreateCommandCN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandCN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandCN(CreateElementRequest req) {
+ public PackageCreateCommandCN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PackageCreateCommandCN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PackageCreateCommandCN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_3014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandTN.java index 42c696e95d7..992c823a414 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/PackageCreateCommandTN.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -37,7 +41,7 @@ public class PackageCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +51,25 @@ public class PackageCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public PackageCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public PackageCreateCommandTN(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 PackageCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new PackageCreateCommandTN(req, eObject);
+ public static PackageCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new PackageCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public PackageCreateCommandTN(CreateElementRequest req) {
+ public PackageCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -87,7 +92,9 @@ public class PackageCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPackage());
+ return data.isPermitted();
}
/**
@@ -95,8 +102,19 @@ public class PackageCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Package newElement = UMLFactory.eINSTANCE.createPackage();
- 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_Package_2016(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShapeNamedElementCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShapeNamedElementCreateCommand.java index b386f92e6df..d257a7625c1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShapeNamedElementCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShapeNamedElementCreateCommand.java @@ -24,8 +24,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
@@ -35,7 +39,7 @@ public class ShapeNamedElementCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -45,24 +49,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;
}
/**
@@ -85,7 +90,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.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShortCutDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShortCutDiagramCreateCommand.java index b7636d47fdc..5af300a4d91 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShortCutDiagramCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/ShortCutDiagramCreateCommand.java @@ -37,7 +37,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -47,24 +47,25 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand { /**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req, EObject eObject) {
+ public ShortCutDiagramCreateCommand(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 ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new ShortCutDiagramCreateCommand(req, eObject);
+ public static ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new ShortCutDiagramCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public ShortCutDiagramCreateCommand(CreateElementRequest req) {
+ public ShortCutDiagramCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/SubjectClassifierCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/SubjectClassifierCreateCommandTN.java index 2b90b516e29..5e3f3527063 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/SubjectClassifierCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/SubjectClassifierCreateCommandTN.java @@ -24,8 +24,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.Classifier;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
@@ -35,7 +39,7 @@ public class SubjectClassifierCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -45,24 +49,25 @@ public class SubjectClassifierCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public SubjectClassifierCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public SubjectClassifierCreateCommandTN(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 SubjectClassifierCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new SubjectClassifierCreateCommandTN(req, eObject);
+ public static SubjectClassifierCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new SubjectClassifierCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public SubjectClassifierCreateCommandTN(CreateElementRequest req) {
+ public SubjectClassifierCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -85,7 +90,9 @@ public class SubjectClassifierCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getClassifier());
+ return data.isPermitted();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseAsRectangleCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseAsRectangleCreateCommandTN.java index ec88a5c2e20..5eb7f0b0aab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseAsRectangleCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseAsRectangleCreateCommandTN.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseAsRectangleCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseAsRectangleCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public UseCaseAsRectangleCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public UseCaseAsRectangleCreateCommandTN(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 UseCaseAsRectangleCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new UseCaseAsRectangleCreateCommandTN(req, eObject);
+ public static UseCaseAsRectangleCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseAsRectangleCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseAsRectangleCreateCommandTN(CreateElementRequest req) {
+ public UseCaseAsRectangleCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class UseCaseAsRectangleCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class UseCaseAsRectangleCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- 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_UseCase_2014(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseCreateCommandTN.java index 3a8a08d17ea..18123926c08 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseCreateCommandTN.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseCreateCommandTN extends EditElementCommand { /**
* @generated
*/
- public UseCaseCreateCommandTN(CreateElementRequest req, EObject eObject) {
+ public UseCaseCreateCommandTN(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 UseCaseCreateCommandTN create(CreateElementRequest req, EObject eObject) {
- return new UseCaseCreateCommandTN(req, eObject);
+ public static UseCaseCreateCommandTN create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseCreateCommandTN(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseCreateCommandTN(CreateElementRequest req) {
+ public UseCaseCreateCommandTN(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class UseCaseCreateCommandTN extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class UseCaseCreateCommandTN extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- 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_UseCase_2013(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInComponentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInComponentCreateCommand.java index 3aeef9d7af9..025cb257fd3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInComponentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInComponentCreateCommand.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseInComponentCreateCommand extends EditElementCommand { /**
* @generated
*/
- public UseCaseInComponentCreateCommand(CreateElementRequest req, EObject eObject) {
+ public UseCaseInComponentCreateCommand(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 UseCaseInComponentCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new UseCaseInComponentCreateCommand(req, eObject);
+ public static UseCaseInComponentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseInComponentCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseInComponentCreateCommand(CreateElementRequest req) {
+ public UseCaseInComponentCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class UseCaseInComponentCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class UseCaseInComponentCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- Classifier owner = (Classifier)getElementToEdit();
- owner.getOwnedUseCases().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 {
+ Classifier qualifiedTarget = (Classifier)target;
+ qualifiedTarget.getOwnedUseCases().add(newElement);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
+ }
Classifier childHolder = (Classifier)getElementToEdit();
childHolder.getUseCases().add(newElement);
ElementInitializers.getInstance().init_UseCase_3009(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInPackageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInPackageCreateCommand.java index c13ef9cea16..ffe8e986ccf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInPackageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/commands/UseCaseInPackageCreateCommand.java @@ -24,10 +24,14 @@ 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.usecase.providers.ElementInitializers;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.UseCase;
/**
@@ -38,7 +42,7 @@ public class UseCaseInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- private EClass eClass = null;
+ private Diagram diagram = null;
/**
* @generated
@@ -48,24 +52,25 @@ public class UseCaseInPackageCreateCommand extends EditElementCommand { /**
* @generated
*/
- public UseCaseInPackageCreateCommand(CreateElementRequest req, EObject eObject) {
+ public UseCaseInPackageCreateCommand(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 UseCaseInPackageCreateCommand create(CreateElementRequest req, EObject eObject) {
- return new UseCaseInPackageCreateCommand(req, eObject);
+ public static UseCaseInPackageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
+ return new UseCaseInPackageCreateCommand(req, eObject, diagram);
}
/**
* @generated
*/
- public UseCaseInPackageCreateCommand(CreateElementRequest req) {
+ public UseCaseInPackageCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
+ this.diagram = diagram;
}
/**
@@ -88,7 +93,9 @@ public class UseCaseInPackageCreateCommand extends EditElementCommand { * @generated
*/
public boolean canExecute() {
- return true;
+ EObject target = getElementToEdit();
+ ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getUseCase());
+ return data.isPermitted();
}
/**
@@ -96,8 +103,19 @@ public class UseCaseInPackageCreateCommand extends EditElementCommand { */
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
UseCase newElement = UMLFactory.eINSTANCE.createUseCase();
- 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_UseCase_3012(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest)getRequest()).setNewElement(newElement);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorAsRectangleItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorAsRectangleItemSemanticEditPolicyTN.java index a13a96ec30d..079b0493d9b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorAsRectangleItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorAsRectangleItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ActorAsRectangleItemSemanticEditPolicyTN extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ActorAsRectangleItemSemanticEditPolicyTN extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInComponentItemSemanticEditPolicy.java index e0992510233..b84454ae91e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInComponentItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ActorInComponentItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ActorInComponentItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInPackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInPackageItemSemanticEditPolicy.java index b258e8dea0b..72941b3a72e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInPackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorInPackageItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ActorInPackageItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ActorInPackageItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorItemSemanticEditPolicyTN.java index 3838573fe4a..24d648c9a4d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ActorItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ActorItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ActorItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPolicy if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/AssociationItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/AssociationItemSemanticEditPolicy.java index bb0c70563a2..6ff8629a5fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/AssociationItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/AssociationItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class AssociationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class AssociationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPo if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInComponentItemSemanticEditPolicy.java index f540eedf999..ed78d4dc623 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInComponentItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ComponentInComponentItemSemanticEditPolicy extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ComponentInComponentItemSemanticEditPolicy extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInPackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInPackageItemSemanticEditPolicy.java index d2feb37b9cf..4c182058d52 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInPackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentInPackageItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class ComponentInPackageItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class ComponentInPackageItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases2ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases2ItemSemanticEditPolicy.java index 62a235cf431..56504e61cae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases2ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases2ItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorInComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ComponentInComponentCreateCommand;
@@ -61,31 +62,31 @@ public class ComponentUsecases2ItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseInComponentCreateCommand(req));
+ return getGEFWrapper(new UseCaseInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentInComponentCreateCommand(req));
+ return getGEFWrapper(new ComponentInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3017 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintInComponentCreateCommand(req));
+ return getGEFWrapper(new ConstraintInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3018 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorInComponentCreateCommand(req));
+ return getGEFWrapper(new ActorInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases3ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases3ItemSemanticEditPolicy.java index d63a6a16636..26e3f1ee231 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases3ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/ComponentUsecases3ItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorInComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ComponentInComponentCreateCommand;
@@ -61,31 +62,31 @@ public class ComponentUsecases3ItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseInComponentCreateCommand(req));
+ return getGEFWrapper(new UseCaseInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentInComponentCreateCommand(req));
+ return getGEFWrapper(new ComponentInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3017 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintInComponentCreateCommand(req));
+ return getGEFWrapper(new ConstraintInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3018 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorInComponentCreateCommand(req));
+ return getGEFWrapper(new ActorInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java index c3d1b02f17b..b714a27e1a4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartment2ItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorInPackageCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ComponentInPackageCreateCommand;
@@ -62,37 +63,37 @@ public class PackagePackageableElementCompartment2ItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintInPackageCreateCommand(req));
+ return getGEFWrapper(new ConstraintInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3011 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorInPackageCreateCommand(req));
+ return getGEFWrapper(new ActorInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseInPackageCreateCommand(req));
+ return getGEFWrapper(new UseCaseInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentInPackageCreateCommand(req));
+ return getGEFWrapper(new ComponentInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3014 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java index 9b47c8fc217..0d8006e81f9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/PackagePackageableElementCompartmentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorInPackageCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ComponentInPackageCreateCommand;
@@ -62,37 +63,37 @@ public class PackagePackageableElementCompartmentItemSemanticEditPolicy extends if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintInPackageCreateCommand(req));
+ return getGEFWrapper(new ConstraintInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_3011 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorInPackageCreateCommand(req));
+ return getGEFWrapper(new ActorInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_3012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseInPackageCreateCommand(req));
+ return getGEFWrapper(new UseCaseInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Component_3013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ComponentInPackageCreateCommand(req));
+ return getGEFWrapper(new ComponentInPackageCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_3014 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandCN(req));
+ return getGEFWrapper(new PackageCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectClassifierItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectClassifierItemSemanticEditPolicyTN.java index aaabda9ef9c..430cb0552e7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectClassifierItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectClassifierItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -117,7 +118,7 @@ public class SubjectClassifierItemSemanticEditPolicyTN extends UMLBaseItemSemant if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -188,7 +189,7 @@ public class SubjectClassifierItemSemanticEditPolicyTN extends UMLBaseItemSemant if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectComponentUsecasesItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectComponentUsecasesItemSemanticEditPolicy.java index 8bc802a6528..964aafd4f4e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectComponentUsecasesItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectComponentUsecasesItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.CommentCreateCommandCN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ConstraintInComponentCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.UseCaseInComponentCreateCommand;
@@ -59,19 +60,19 @@ public class SubjectComponentUsecasesItemSemanticEditPolicy extends UMLBaseItemS if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseInComponentCreateCommand(req));
+ return getGEFWrapper(new UseCaseInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_3015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandCN(req));
+ return getGEFWrapper(new CommentCreateCommandCN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_3017 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintInComponentCreateCommand(req));
+ return getGEFWrapper(new ConstraintInComponentCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectItemSemanticEditPolicyTN.java index 56e3d329e68..85a301c0bb3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/SubjectItemSemanticEditPolicyTN.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -91,7 +92,7 @@ public class SubjectItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPoli return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
}
if(UMLElementTypes.Association_4011 == req.getElementType()) {
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == req.getElementType()) {
return null;
@@ -125,7 +126,7 @@ public class SubjectItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPoli return getGEFWrapper(new GeneralizationCreateCommand(req, req.getSource(), req.getTarget()));
}
if(UMLElementTypes.Association_4011 == req.getElementType()) {
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == req.getElementType()) {
return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseAsRectangleItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseAsRectangleItemSemanticEditPolicyTN.java index 6903cb2c5f7..6f87badace0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseAsRectangleItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseAsRectangleItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -133,7 +134,7 @@ public class UseCaseAsRectangleItemSemanticEditPolicyTN extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -216,7 +217,7 @@ public class UseCaseAsRectangleItemSemanticEditPolicyTN extends UMLBaseItemSeman if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseDiagramItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseDiagramItemSemanticEditPolicy.java index 848c6130f06..c101bc424c6 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseDiagramItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseDiagramItemSemanticEditPolicy.java @@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.common.commands.DuplicateNamedElementCommand;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorAsRectangleCreateCommandTN;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ActorCreateCommandTN;
@@ -72,67 +73,67 @@ public class UseCaseDiagramItemSemanticEditPolicy extends UMLBaseItemSemanticEdi if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorCreateCommandTN(req));
+ return getGEFWrapper(new ActorCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Actor_2012 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ActorAsRectangleCreateCommandTN(req));
+ return getGEFWrapper(new ActorAsRectangleCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_2013 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseCreateCommandTN(req));
+ return getGEFWrapper(new UseCaseCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.UseCase_2014 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new UseCaseAsRectangleCreateCommandTN(req));
+ return getGEFWrapper(new UseCaseAsRectangleCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Classifier_2015 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new SubjectClassifierCreateCommandTN(req));
+ return getGEFWrapper(new SubjectClassifierCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Package_2016 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new PackageCreateCommandTN(req));
+ return getGEFWrapper(new PackageCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Constraint_2017 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ConstraintCreateCommandTN(req));
+ return getGEFWrapper(new ConstraintCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Comment_2018 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new CommentCreateCommandTN(req));
+ return getGEFWrapper(new CommentCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2022 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new DefaultNamedElementCreateCommandTN(req));
+ return getGEFWrapper(new DefaultNamedElementCreateCommandTN(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.NamedElement_2023 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShapeNamedElementCreateCommand(req));
+ return getGEFWrapper(new ShapeNamedElementCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.Diagram_2019 == baseElementType) {
if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ShortCutDiagramCreateCommand(req));
+ return getGEFWrapper(new ShortCutDiagramCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInComponentItemSemanticEditPolicy.java index b4822410237..96e79ca9cc5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInComponentItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -133,7 +134,7 @@ public class UseCaseInComponentItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -216,7 +217,7 @@ public class UseCaseInComponentItemSemanticEditPolicy extends UMLBaseItemSemanti if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInPackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInPackageItemSemanticEditPolicy.java index 391e261a820..3002b3fc861 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInPackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseInPackageItemSemanticEditPolicy.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -133,7 +134,7 @@ public class UseCaseInPackageItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -216,7 +217,7 @@ public class UseCaseInPackageItemSemanticEditPolicy extends UMLBaseItemSemanticE if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseItemSemanticEditPolicyTN.java index 6d1ef113736..6af75b78126 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCaseItemSemanticEditPolicyTN.java @@ -25,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.AbstractionCreateCommand;
@@ -133,7 +134,7 @@ public class UseCaseItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
return null;
@@ -216,7 +217,7 @@ public class UseCaseItemSemanticEditPolicyTN extends UMLBaseItemSemanticEditPoli if(isExtendedType) {
return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget()));
+ return getGEFWrapper(new AssociationCreateCommand(req, req.getSource(), req.getTarget(), DiagramUtils.getDiagramFrom(getHost())));
}
if(UMLElementTypes.ConstraintConstrainedElement_4012 == baseElementType) {
if(isExtendedType) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInComponentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInComponentItemSemanticEditPolicy.java index ba6b363b895..66e1c973c3c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInComponentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInComponentItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ExtensionPointCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class UseCasePointsInComponentItemSemanticEditPolicy extends UMLBaseItemS if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExtensionPointCreateCommand(req));
+ return getGEFWrapper(new ExtensionPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInPackageItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInPackageItemSemanticEditPolicy.java index ac55e1b9b54..4dd1591870a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInPackageItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInPackageItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ExtensionPointCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class UseCasePointsInPackageItemSemanticEditPolicy extends UMLBaseItemSem if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExtensionPointCreateCommand(req));
+ return getGEFWrapper(new ExtensionPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInRectangleItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInRectangleItemSemanticEditPolicy.java index 241450008ca..71014a09e07 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInRectangleItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsInRectangleItemSemanticEditPolicy.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ExtensionPointInRectangleCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class UseCasePointsInRectangleItemSemanticEditPolicy extends UMLBaseItemS if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExtensionPointInRectangleCreateCommand(req));
+ return getGEFWrapper(new ExtensionPointInRectangleCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsItemSemanticEditPolicyTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsItemSemanticEditPolicyTN.java index 3f234d8f6ab..b66cf3be44a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsItemSemanticEditPolicyTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/edit/policies/UseCasePointsItemSemanticEditPolicyTN.java @@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.usecase.edit.commands.ExtensionPointCreateCommand;
import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes;
@@ -57,7 +58,7 @@ public class UseCasePointsItemSemanticEditPolicyTN extends UMLBaseItemSemanticEd if(isExtendedType) {
return getExtendedTypeCreationCommand(req, (IExtendedHintedElementType)requestElementType);
}
- return getGEFWrapper(new ExtensionPointCreateCommand(req));
+ return getGEFWrapper(new ExtensionPointCreateCommand(req, DiagramUtils.getDiagramFrom(getHost())));
}
return super.getCreateCommand(req);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLVisualIDRegistry.java index 74920823f3b..988a5034a79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLVisualIDRegistry.java @@ -182,17 +182,8 @@ public class UMLVisualIDRegistry { 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 UseCaseDiagramEditPart.VISUAL_ID;
- }
- return -1;
+ return UseCaseDiagramEditPart.VISUAL_ID;
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF index 2df4a055e8c..a94137414af 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF @@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0",
org.eclipse.core.expressions;bundle-version="3.4.0"
Export-Package: org.eclipse.papyrus.uml.diagram.wizards,
org.eclipse.papyrus.uml.diagram.wizards.category,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/CreateModelWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/CreateModelWizard.java index 162668f7bda..debaef87057 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/CreateModelWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/CreateModelWizard.java @@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -36,7 +37,6 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.extension.commands.IModelCreationCommand;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -46,6 +46,7 @@ import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor;
import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryRegistry;
import org.eclipse.papyrus.uml.diagram.wizards.category.NewPapyrusModelCommand;
@@ -55,6 +56,7 @@ import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage; import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage.CategoryProvider;
import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectStorageProviderPage;
import org.eclipse.papyrus.uml.diagram.wizards.template.InitFromTemplateCommand;
+import org.eclipse.papyrus.uml.tools.model.UmlModel;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
@@ -586,13 +588,19 @@ public class CreateModelWizard extends Wizard implements INewWizard { * the category id
*/
protected void initDiagrams(ModelSet resourceSet, EObject root, String categoryId) {
- List<ICreationCommand> creationCommands = getDiagramKindsFor(categoryId);
+ if (root == null) {
+ UmlModel model = (UmlModel)resourceSet.getModel(UmlModel.MODEL_ID);
+ EList<EObject> roots = model.getResource().getContents();
+ if (!roots.isEmpty())
+ root = roots.get(0);
+ }
+ List<ViewPrototype> creationCommands = getPrototypesFor(categoryId);
String diagramName = selectDiagramKindPage.getDiagramName();
if(creationCommands.isEmpty()) {
createEmptyDiagramEditor(resourceSet);
} else {
for(int i = 0; i < creationCommands.size(); i++) {
- creationCommands.get(i).createDiagram(resourceSet, root, diagramName);
+ creationCommands.get(i).instantiateOn(root, diagramName);
}
}
}
@@ -604,8 +612,8 @@ public class CreateModelWizard extends Wizard implements INewWizard { * the category id
* @return the diagram kinds for
*/
- protected List<ICreationCommand> getDiagramKindsFor(String categoryId) {
- return selectDiagramKindPage.getCreationCommands(categoryId);
+ protected List<ViewPrototype> getPrototypesFor(String categoryId) {
+ return selectDiagramKindPage.getSelectedPrototypes(categoryId);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/NewPapyrusProjectWithMultiModelsWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/NewPapyrusProjectWithMultiModelsWizard.java index 6576071f499..dcf7560a705 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/NewPapyrusProjectWithMultiModelsWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/NewPapyrusProjectWithMultiModelsWizard.java @@ -79,7 +79,7 @@ public class NewPapyrusProjectWithMultiModelsWizard extends NewPapyrusProjectWiz return false;
}
for (String category: getDiagramCategoryIds()) {
- if (myDoNotCreateModelForNoDiagrams && getDiagramKindsFor(category).isEmpty()){
+ if (myDoNotCreateModelForNoDiagrams && getPrototypesFor(category).isEmpty()){
// don't create model
continue;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java index bb4e472ae95..38d71b647c2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java @@ -14,32 +14,51 @@ package org.eclipse.papyrus.uml.diagram.wizards.kind;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.commands.ICreationCommandRegistry;
+import org.eclipse.papyrus.infra.viewpoints.configuration.Category;
+import org.eclipse.papyrus.infra.viewpoints.configuration.ModelRule;
+import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.uml2.uml.UMLPackage;
/**
* The ContentProvider for DiagramCategory table.
- * Returns available diagram kinds for the giben diagram category(ies).
+ * Returns available diagram kinds for the given diagram category(ies).
*/
public class DiagramKindContentProvider implements IStructuredContentProvider {
- /** The creation command registry. */
- private final ICreationCommandRegistry creationCommandRegistry;
-
+ private final Map<String, Collection<ViewPrototype>> prototypes;
/**
* Instantiates a new diagram kind content provider.
*
- * @param creationCommandRegistry the creation command registry
*/
- public DiagramKindContentProvider(ICreationCommandRegistry creationCommandRegistry) {
- this.creationCommandRegistry = creationCommandRegistry;
+ public DiagramKindContentProvider() {
+ Collection<ViewPrototype> vps = PolicyChecker.getCurrent().getAllPrototypes();
+ this.prototypes = new HashMap<String, Collection<ViewPrototype>>();
+ for (ViewPrototype vp : vps)
+ for (Category category : vp.getCategories())
+ cache(category.getName(), vp);
+ }
+
+ /**
+ * Stores the given diagram prototype in the cache
+ * @param prototype The prototype to cache
+ */
+ private void cache(String category, ViewPrototype prototype) {
+ if (!prototypes.containsKey(category))
+ prototypes.put(category, new ArrayList<ViewPrototype>());
+ prototypes.get(category).add(prototype);
}
@@ -49,6 +68,7 @@ public class DiagramKindContentProvider implements IStructuredContentProvider { * @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
+ prototypes.clear();
}
/**
@@ -71,16 +91,16 @@ public class DiagramKindContentProvider implements IStructuredContentProvider { */
public Object[] getElements(Object inputElement) {
if(inputElement instanceof Object[]) {
- List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
+ List<ViewPrototype> result = new ArrayList<ViewPrototype>();
for (Object next: (Object[])inputElement) {
if (next instanceof String) {
String diagramCategory = (String)next;
- result.addAll(getCreationCommands(diagramCategory));
+ result.addAll(getPrototypes(diagramCategory));
}
}
- Collections.sort(result, new Comparator<CreationCommandDescriptor>() {
+ Collections.sort(result, new Comparator<ViewPrototype>() {
- public int compare(CreationCommandDescriptor o1, CreationCommandDescriptor o2) {
+ public int compare(ViewPrototype o1, ViewPrototype o2) {
return o1.getLabel().compareTo(o2.getLabel());
}
});
@@ -88,7 +108,7 @@ public class DiagramKindContentProvider implements IStructuredContentProvider { }
if(inputElement instanceof String) {
String diagramCategory = (String)inputElement;
- List<CreationCommandDescriptor> result = getCreationCommands(diagramCategory);
+ List<ViewPrototype> result = getPrototypes(diagramCategory);
return result.toArray(new Object[result.size()]);
}
return null;
@@ -100,22 +120,46 @@ public class DiagramKindContentProvider implements IStructuredContentProvider { * @param diagramCategory the diagram category
* @return the creation commands
*/
- protected List<CreationCommandDescriptor> getCreationCommands(String diagramCategory) {
- List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
- for(CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
- if(diagramCategory != null && diagramCategory.equals(desc.getLanguage())) {
- result.add(desc);
+ protected List<ViewPrototype> getPrototypes(String diagramCategory) {
+ List<ViewPrototype> result = new ArrayList<ViewPrototype>();
+ if (!prototypes.containsKey(diagramCategory))
+ return result;
+ EClass rootType = getExpectedRootType(diagramCategory);
+ for(ViewPrototype proto : prototypes.get(diagramCategory))
+ if (isAllowedOn(proto, rootType))
+ result.add(proto);
+ return result;
+ }
+
+ private EClass getExpectedRootType(String category) {
+ if ("profile".equals(category))
+ return UMLPackage.eINSTANCE.getProfile();
+ return UMLPackage.eINSTANCE.getModel();
+ }
+
+ private boolean isAllowedOn(ViewPrototype prototype, EClass clazz) {
+ PapyrusView current = prototype.getConfiguration();
+ while (current != null) {
+ for (ModelRule rule : current.getModelRules()) {
+ int result = allows(rule, clazz);
+ if (result == -1)
+ return false;
+ if (result == 1)
+ return true;
}
+ current = current.getParent();
}
- return result;
+ return false;
}
- /**
- * Gets the creation command registry.
- *
- * @return the creation command registry
- */
- private ICreationCommandRegistry getCreationCommandRegistry() {
- return creationCommandRegistry;
+ private int allows(ModelRule rule, EClass owner) {
+ EClass c = rule.getElement();
+ if (c == null || c.isSuperTypeOf(owner)) {
+ // matching type => check the application of the required stereotypes
+ return rule.isPermit() ? 1 : -1;
+ } else {
+ // type is not matching => unknown
+ return 0;
+ }
}
}
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindLabelProvider.java index c4e68a459b7..05ceb4c43cf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindLabelProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindLabelProvider.java @@ -13,10 +13,9 @@ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.wizards.kind;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.papyrus.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.uml.diagram.wizards.Messages;
import org.eclipse.swt.graphics.Image;
@@ -33,13 +32,9 @@ public class DiagramKindLabelProvider implements ILabelProvider { * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
public Image getImage(Object element) {
- // TODO use ImageRegistry to store images
- if(element instanceof CreationCommandDescriptor) {
- ImageDescriptor image = ((CreationCommandDescriptor)element).getIcon();
- // image is an optional attribute
- if(image != null) {
- return new Image(null, image.getImageData());
- }
+ if(element instanceof ViewPrototype) {
+ ViewPrototype proto = (ViewPrototype)element;
+ return proto.getIcon();
}
return null;
}
@@ -48,8 +43,9 @@ public class DiagramKindLabelProvider implements ILabelProvider { * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
public String getText(Object element) {
- if(element instanceof CreationCommandDescriptor) {
- return ((CreationCommandDescriptor)element).getLabel();
+ if(element instanceof ViewPrototype) {
+ ViewPrototype proto = (ViewPrototype)element;
+ return proto.getLabel();
}
return UNDEFINED_ELEMENT;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java index 331f1f51180..56151256f06 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java @@ -12,8 +12,6 @@ *******************************************************************************/ package org.eclipse.papyrus.uml.diagram.wizards.pages; -import static org.eclipse.papyrus.uml.diagram.wizards.Activator.log; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -27,8 +25,9 @@ import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.papyrus.commands.CreationCommandDescriptor; import org.eclipse.papyrus.commands.CreationCommandRegistry; -import org.eclipse.papyrus.commands.ICreationCommand; import org.eclipse.papyrus.commands.ICreationCommandRegistry; +import org.eclipse.papyrus.infra.viewpoints.configuration.Category; +import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.wizards.Messages; import org.eclipse.papyrus.uml.diagram.wizards.SettingsHelper; import org.eclipse.papyrus.uml.diagram.wizards.kind.DiagramKindContentProvider; @@ -267,61 +266,21 @@ public class SelectDiagramKindPage extends WizardPage { } /** - * Gets the creation commands. - * - * @return the creation command - */ - public List<ICreationCommand> getCreationCommands() { - CreationCommandDescriptor[] selected = getSelectedDiagramKindDescriptors(); - List<ICreationCommand> commands = new ArrayList<ICreationCommand>(); - for(int i = 0; i < selected.length; i++) { - - ICreationCommand command; - try { - command = (selected[i]).getCommand(); - commands.add(command); - } catch (Exception e) { - log.error(e); - } - } - return commands; - } - - /** - * Gets the creation commands. - * - * @param categoryId - * the category id - * @return the creation commands - */ - public List<ICreationCommand> getCreationCommands(String categoryId) { - List<CreationCommandDescriptor> selected = getSelectedCommandDescriptors(categoryId); - List<ICreationCommand> commands = new ArrayList<ICreationCommand>(); - for(CreationCommandDescriptor next : selected) { - ICreationCommand command; - try { - command = next.getCommand(); - commands.add(command); - } catch (Exception e) { - log.error(e); - } - } - return commands; - } - - /** * Gets the selected command descriptors. * * @param categoryId * the category id * @return the selected command descriptors */ - protected List<CreationCommandDescriptor> getSelectedCommandDescriptors(String categoryId) { - CreationCommandDescriptor[] selected = getSelectedDiagramKindDescriptors(); - List<CreationCommandDescriptor> commands = new ArrayList<CreationCommandDescriptor>(); + public List<ViewPrototype> getSelectedPrototypes(String categoryId) { + ViewPrototype[] selected = getSelectedPrototypes(); + List<ViewPrototype> commands = new ArrayList<ViewPrototype>(); for(int i = 0; i < selected.length; i++) { - if(selected[i].getLanguage().equals(categoryId)) { - commands.add(selected[i]); + for (Category category : selected[i].getCategories()) { + if (category.getName().equals(categoryId)) { + commands.add(selected[i]); + break; + } } } return commands; @@ -380,7 +339,7 @@ public class SelectDiagramKindPage extends WizardPage { } }); diagramKindTableViewer = new CheckboxTableViewer(diagramKindTable); - diagramKindTableViewer.setContentProvider(new DiagramKindContentProvider(getCreationCommandRegistry())); + diagramKindTableViewer.setContentProvider(new DiagramKindContentProvider()); diagramKindTableViewer.setLabelProvider(createDiagramKindLabelProvider()); } @@ -504,12 +463,7 @@ public class SelectDiagramKindPage extends WizardPage { * @return the selected diagram kinds */ public String[] getSelectedDiagramKinds(String categoryId) { - List<CreationCommandDescriptor> descriptors = getSelectedCommandDescriptors(categoryId); - String[] result = new String[descriptors.size()]; - for(int i = 0; i < descriptors.size(); i++) { - result[i] = descriptors.get(i).getCommandId(); - } - return result; + return new String[0]; } /** @@ -517,10 +471,10 @@ public class SelectDiagramKindPage extends WizardPage { * * @return the selected diagram kind descriptors */ - protected CreationCommandDescriptor[] getSelectedDiagramKindDescriptors() { + protected ViewPrototype[] getSelectedPrototypes() { Object[] checked = diagramKindTableViewer.getCheckedElements(); // as Object is not a subclass of String we cannot cast Object[] to String[] - CreationCommandDescriptor[] result = Arrays.asList(checked).toArray(new CreationCommandDescriptor[checked.length]); + ViewPrototype[] result = Arrays.asList(checked).toArray(new ViewPrototype[checked.length]); return result; } diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/META-INF/MANIFEST.MF b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/META-INF/MANIFEST.MF index 073620de703..dae3136a11c 100644 --- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/META-INF/MANIFEST.MF @@ -1,36 +1,43 @@ Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.modelexplorer,org.eclipse.papy
- rus.uml.modelexplorer.factory,org.eclipse.papyrus.uml.modelexplorer.h
- andler,org.eclipse.papyrus.uml.modelexplorer.queries,org.eclipse.papy
- rus.uml.modelexplorer.util
+Export-Package: org.eclipse.papyrus.uml.modelexplorer,
+ org.eclipse.papyrus.uml.modelexplorer.factory,
+ org.eclipse.papyrus.uml.modelexplorer.handler,
+ org.eclipse.papyrus.uml.modelexplorer.queries,
+ org.eclipse.papyrus.uml.modelexplorer.util
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,bin/
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,org.eclipse.pa
- pyrus.views.modelexplorer;bundle-version="1.0.0",org.eclipse.ui.navig
- ator;bundle-version="3.4.0",org.eclipse.emf.transaction;bundle-versio
- n="1.4.0",org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",org.ecli
- pse.gmf.runtime.notation;bundle-version="1.5.0",org.eclipse.papyrus.i
- nfra.emf;bundle-version="1.0.0",com.google.guava;bundle-version="11.0
- .0",org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",org.ecl
- ipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",org.eclips
- e.ui.views.properties.tabbed;bundle-version="3.5.300",org.eclipse.ui.
- ide;bundle-version="3.8.0",org.eclipse.uml2.uml;bundle-version="4.0.0
- ",org.eclipse.papyrus.infra.core;bundle-version="1.0.0",org.eclipse.p
- apyrus.infra.widgets;bundle-version="1.0.0",org.eclipse.papyrus.uml.t
- ools;bundle-version="1.0.0",org.eclipse.papyrus.uml.service.types;bun
- dle-version="1.0.0",org.eclipse.papyrus.infra.services.edit;bundle-ve
- rsion="1.0.0",org.eclipse.papyrus.emf.facet.custom.metamodel,org.ecli
- pse.papyrus.emf.facet.query.java.core,org.eclipse.emf.ecore,org.eclip
- se.papyrus.emf.facet.efacet.core
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="1.0.0",
+ org.eclipse.ui.navigator;bundle-version="3.4.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
+ org.eclipse.papyrus.emf.facet.custom.metamodel,
+ org.eclipse.papyrus.emf.facet.query.java.core,
+ org.eclipse.emf.ecore,
+ org.eclipse.papyrus.emf.facet.efacet.core,
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.uml.modelexplorer.Activator
Import-Package: org.eclipse.papyrus.emf.facet.custom.core
-Bundle-SymbolicName: org.eclipse.papyrus.uml.modelexplorer;singleton:=
- true
-
+Bundle-SymbolicName: org.eclipse.papyrus.uml.modelexplorer;singleton:=true
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml index 075026e20b9..2fde88e0772 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml @@ -4,7 +4,8 @@ <extension
point="org.eclipse.papyrus.infra.nattable.configuration">
<configuration
- file="configs/generic.nattableconfiguration">
+ file="configs/generic.nattableconfiguration"
+ type="PapyrusGenericTable">
</configuration>
</extension>
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic/plugin.xml index 57d0754afcf..d3c99e240cd 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic/plugin.xml @@ -1,7 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
- <extension
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.configuration">
+ <configuration
+ file="configs/generic.nattableconfiguration"
+ type="PapyrusGenericTable">
+ </configuration>
+ </extension>
+ <extension
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.papyrus.editor.category"
@@ -11,62 +18,6 @@ </command>
</extension>
<extension
- id="create.table.menus"
- name="Create Table Menus"
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.popupmenu.createnattable">
- <command
- commandId="org.eclipse.papyrus.uml.nattable.generic.create.command"
- mnemonic="&G"
- style="push">
- <visibleWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="menu:org.eclipse.papyrus.infra.nattable.menu.createnattable">
- <command
- commandId="org.eclipse.papyrus.uml.nattable.generic.create.command"
- mnemonic="&G"
- style="push">
- <visibleWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="toolbar:org.eclipse.papyrus.infra.nattable.toolbar.createnattable">
- <command
- commandId="org.eclipse.papyrus.uml.nattable.generic.create.command"
- mnemonic="&G"
- style="push">
- <visibleWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
point="org.eclipse.ui.handlers">
<handler
commandId="org.eclipse.papyrus.uml.nattable.generic.create.command">
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF index 79c424569c1..7aba328d79f 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
com.google.guava;bundle-version="11.0.0",
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.4.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0"
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="0.4.0",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.profile,
org.eclipse.papyrus.uml.profile.constraints,
org.eclipse.papyrus.uml.profile.definition,
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml index a9d6d447afd..e0c8c8dcb98 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/plugin.xml @@ -164,5 +164,11 @@ provider="org.eclipse.papyrus.uml.profile.providers.ProfileDefinitionLabelProvider">
</labelProvider>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.viewpoints.policy.profilehelper">
+ <helper
+ class="org.eclipse.papyrus.uml.profile.UMLProfileHelper">
+ </helper>
+ </extension>
</plugin>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/UMLProfileHelper.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/UMLProfileHelper.java new file mode 100755 index 00000000000..ae0bd2aa74d --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/UMLProfileHelper.java @@ -0,0 +1,67 @@ +/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.profile;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.papyrus.infra.viewpoints.policy.IProfileHelper;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+
+
+/**
+ * Implementation of the IProfileHelper interface for UML profiles
+ * @author Laurent Wouters
+ */
+public class UMLProfileHelper implements IProfileHelper {
+
+ /**
+ * @see org.eclipse.papyrus.infra.viewpoints.policy.IProfileHelper#getAppliedProfiles(org.eclipse.emf.ecore.EObject)
+ */
+ public Collection<EPackage> getAppliedProfiles(EObject model) {
+ ArrayList<EPackage> result = new ArrayList<EPackage>();
+ if (!(model instanceof Element))
+ return result;
+ Element element = (Element)model;
+ Package p = element.getNearestPackage();
+ if (p == null)
+ return result;
+ for (Profile profile : p.getAllAppliedProfiles()) {
+ if (!result.contains(profile.getDefinition()))
+ result.add(profile.getDefinition());
+ }
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.viewpoints.policy.IProfileHelper#getAppliedStereotypes(org.eclipse.emf.ecore.EObject)
+ */
+ public Collection<EClass> getAppliedStereotypes(EObject object) {
+ ArrayList<EClass> result = new ArrayList<EClass>();
+ if (!(object instanceof Element))
+ return result;
+ Element element = (Element)object;
+ for (EObject app : element.getStereotypeApplications()) {
+ if (!result.contains(app.eClass()))
+ result.add(app.eClass());
+ }
+ return result;
+ }
+}
|