/** @generated */ public boolean canExecute() { ReadVariableAction container = (ReadVariableAction) getElementToEdit(); if (container.getResult() != null) { return false; } EObject target = getElementToEdit(); ModelAddData data = PolicyChecker.getCurrent() .getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin()); return data.isPermitted(); }
/** @generated */ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin(); EObject target = getElementToEdit(); ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); if (data.isPermitted()) { if (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); return CommandResult.newOKCommandResult(newElement); }