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/OperationForInterfaceCreateCommand.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.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/OperationForInterfaceCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/commands/OperationForInterfaceCreateCommand.java
index b9b5e37fefb..ce860519451 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
@@ -68,9 +68,12 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
public boolean canExecute() {
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOperation());
return data.isPermitted();
+
+
}
/**
@@ -78,7 +81,9 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
*/
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
EObject target = getElementToEdit();
ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
if (data.isPermitted()) {
@@ -87,14 +92,21 @@ public class OperationForInterfaceCreateCommand extends EditElementCommand {
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);
+ 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);
return CommandResult.newOKCommandResult(newElement);
}

Back to the top