/** @generated */
 @Override
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   CallOperationAction newElement = UMLFactory.eINSTANCE.createCallOperationAction();
   EObject target = getElementToEdit();
   ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
   if (data.isPermitted()) {
     if (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);
   return CommandResult.newOKCommandResult(newElement);
 }
 /** @generated */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   InputPin newElement = UMLFactory.eINSTANCE.createInputPin();
   LoopNode owner = (LoopNode) getElementToEdit();
   owner.getLoopVariableInputs().add(newElement);
   ElementInitializers.getInstance().init_InputPin_3105(newElement);
   doConfigure(newElement, monitor, info);
   ((CreateElementRequest) getRequest()).setNewElement(newElement);
   return CommandResult.newOKCommandResult(newElement);
 }
 /** @generated */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
   Action owner = (Action) getElementToEdit();
   owner.getLocalPostconditions().add(newElement);
   ElementInitializers.getInstance().init_DurationConstraint_3035(newElement);
   doConfigure(newElement, monitor, info);
   ((CreateElementRequest) getRequest()).setNewElement(newElement);
   return CommandResult.newOKCommandResult(newElement);
 }
 /** @generated NOT do not set new element which may change after validation */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   ValuePin newElement = UMLFactory.eINSTANCE.createValuePin();
   OpaqueAction owner = (OpaqueAction) getElementToEdit();
   owner.getInputValues().add(newElement);
   ElementInitializers.getInstance().init_ValuePin_3015(newElement);
   doConfigure(newElement, monitor, info);
   // do not set new element which may change after validation
   // ((CreateElementRequest)getRequest()).setNewElement(newElement);
   return CommandResult.newOKCommandResult(); // newElement);
 }
Пример #5
0
 /** @generated NOT set appropriate parents */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   DecisionNode newElement = UMLFactory.eINSTANCE.createDecisionNode();
   // set appropriate parents
   if (!CreateCommandUtil.setNodeParents(newElement, getRequest(), getElementToEdit())) {
     return CommandResult.newCancelledCommandResult();
   }
   //		Activity owner = (Activity)getElementToEdit();
   //		owner.getNodes().add(newElement);
   ElementInitializers.getInstance().init_DecisionNode_3038(newElement);
   doConfigure(newElement, monitor, info);
   ((CreateElementRequest) getRequest()).setNewElement(newElement);
   return CommandResult.newOKCommandResult(newElement);
 }
 /** @generated */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   if (!canExecute()) {
     throw new ExecutionException("Invalid arguments in create link command"); // $NON-NLS-1$
   }
   ObjectFlow newElement = UMLFactory.eINSTANCE.createObjectFlow();
   getContainer().getEdges().add(newElement);
   newElement.setSource(getSource());
   newElement.setTarget(getTarget());
   ElementInitializers.getInstance().init_ObjectFlow_4003(newElement);
   doConfigure(newElement, monitor, info);
   ((CreateElementRequest) getRequest()).setNewElement(newElement);
   return CommandResult.newOKCommandResult(newElement);
 }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {

    ExpansionNode newElement = UMLFactory.eINSTANCE.createExpansionNode();

    StructuredActivityNode owner = (StructuredActivityNode) getElementToEdit();
    owner.getNodes().add(newElement);
    ExpansionRegion childHolder = (ExpansionRegion) getElementToEdit();
    childHolder.getInputElements().add(newElement);

    ElementInitializers.getInstance().init_ExpansionNode_3074(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }