Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/RectangleInterfaceCreateCommand.java14
1 files changed, 13 insertions, 1 deletions
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 044c1dcf700..7a032dab577 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
@@ -68,9 +68,12 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInterface());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Interface newElement = UMLFactory.eINSTANCE.createInterface();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class RectangleInterfaceCreateCommand extends EditElementCommand {
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);
+ 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);
return CommandResult.newOKCommandResult(newElement);
}

Back to the top