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