@Override
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {

    for (Data data : datas) {

      if (data.isTransient()) {
        data.setTransient(false); // transient data not supported on
        // process
      }
      boolean exists = false;
      for (Data d : target.getData()) {
        if (d.getName().equals(data.getName())) {
          exists = true;
        }
      }
      if (!exists) {
        container.getData().remove(data);
        target.getData().add(data);
      } else {
        dataNotMoved.add(data);
      }
    }
    if (dataNotMoved.isEmpty()) {
      return CommandResult.newOKCommandResult();
    } else {
      return CommandResult.newWarningCommandResult("Some Data cannot be moved", dataNotMoved);
    }
  }
  /** @generated */
  @Override
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {

    Enumeration newElement = UMLFactory.eINSTANCE.createEnumeration();

    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 {

        Class qualifiedTarget = (Class) target;
        qualifiedTarget.getNestedClassifiers().add(newElement);
      }
    } else {
      return CommandResult.newErrorCommandResult(
          "The active policy restricts the addition of this element");
    }

    ElementInitializers.getInstance().init_Enumeration_3052(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
Example #3
0
  /**
   * Create a MessageOccurenceSpecification and the call event when a message is created
   *
   * @generated NOT
   */
  @Override
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    if (!canExecute()) {
      throw new ExecutionException("Invalid arguments in create link command"); // $NON-NLS-1$
    }
    InteractionFragment sourceContainer =
        (InteractionFragment)
            getRequest().getParameters().get(SequenceRequestConstant.SOURCE_MODEL_CONTAINER);
    InteractionFragment targetContainer =
        (InteractionFragment)
            getRequest().getParameters().get(SequenceRequestConstant.TARGET_MODEL_CONTAINER);

    Message message =
        CommandHelper.doCreateMessage(
            container,
            MessageSort.SYNCH_CALL_LITERAL,
            getSource(),
            getTarget(),
            sourceContainer,
            targetContainer);
    if (message != null) {
      doConfigure(message, monitor, info);
      ((CreateElementRequest) getRequest()).setNewElement(message);
      return CommandResult.newOKCommandResult(message);
    }

    return CommandResult.newErrorCommandResult(
        "There is now valid container for events"); //$NON-NLS-1$
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.papyrus.commands.ICreationCommand#createDiagram(org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.EObject,
   * org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype, java.lang.String)
   */
  @Override
  public final Diagram createDiagram(
      ModelSet modelSet, EObject owner, EObject element, ViewPrototype prototype, String name) {
    ICommand createCmd = getCreateDiagramCommand(modelSet, owner, element, prototype, name);
    TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain();
    CompositeCommand cmd = new CompositeCommand("Create diagram");
    cmd.add(createCmd);
    cmd.add(new OpenDiagramCommand(dom, createCmd));

    try {

      IStatus status =
          CheckedOperationHistory.getInstance().execute(cmd, new NullProgressMonitor(), null);
      if (status.isOK()) {
        CommandResult result = cmd.getCommandResult();
        Object returnValue = result.getReturnValue();

        // CompositeCommands should always return a collection
        if (returnValue instanceof Collection<?>) {
          for (Object returnElement : (Collection<?>) returnValue) {
            if (returnElement instanceof Diagram) {
              return (Diagram) returnElement;
            }
          }
        }
      } else if (status.getSeverity() != IStatus.CANCEL) {
        StatusManager.getManager().handle(status, StatusManager.SHOW);
      }
    } catch (ExecutionException ex) {
      Activator.log.error(ex);
    }

    return null;
  }
 /** @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);
 }
 @Override
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   if (!getEditPartFromEditPartAdapter()) {
     if (!allChildren.isEmpty()) {
       getEditPartFromViewAdapter(allChildren.get(0));
     }
   }
   if (mainEditPart != null) {
     createdNotificationConfigurator = new ArrayList<ChooseChildrenNotificationConfigurator>();
     NotificationConfigurator configurator =
         PendingGroupNotificationsManager.getInstanceForDiagram(diagramPart)
             .getChooseChildrenPendingNotification(mainEditPart);
     ChooseChildrenNotificationConfigurator notificationConfigurator = null;
     if (configurator == null) {
       // If there is no a pending notification for this main edit part then it create one
       if (!allChildren.isEmpty() && isChildrenToChoose()) {
         notificationConfigurator =
             new ChooseChildrenNotificationConfigurator(
                 mainEditPart, allChildren, automaticChildren, host, manager);
         notificationConfigurator.runConfigurator();
       }
     } else {
       // Else update the old one if needed TODO TODO
       // 1 - Compare if there is any modification TODO
       if (configurator instanceof ChooseChildrenNotificationConfigurator) {
         notificationConfigurator = (ChooseChildrenNotificationConfigurator) configurator;
         if (notificationConfigurator.isThereAnyModification(
             mainEditPart, allChildren, automaticChildren, host)) {
           // 2 - There are some update the old notification TODO
           notificationConfigurator.closeNotification();
           if (!allChildren.isEmpty() && isChildrenToChoose()) {
             notificationConfigurator =
                 new ChooseChildrenNotificationConfigurator(
                     mainEditPart, allChildren, automaticChildren, host, manager);
             notificationConfigurator.runConfigurator();
           }
         }
       }
     }
     if (notificationConfigurator != null) {
       createdNotificationConfigurator.add(notificationConfigurator);
     }
     return CommandResult.newOKCommandResult();
   }
   return CommandResult.newErrorCommandResult(
       "The editPart of the adaptable element has not been found"); //$NON-NLS-1$
 }
  /** @generated NOT */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    /*
     * changes: Liest aus einem Request die ID des Helpers und
     * erstellt anhand dessen die HelperUnit
     */
    CreateElementRequest request = ((CreateElementRequest) getRequest());
    String helperId =
        (String) request.getParameters().get(comrel.diagram.part.ComrelPaletteFactory.UNIT_ID);
    comrel.ComrelFactory factory = comrel.ComrelFactory.eINSTANCE;
    EObject container = ((CreateElementRequest) getRequest()).getContainer();
    while (container.eContainer() != null) {
      container = container.eContainer();
    }
    CompositeRefactoring cr = (CompositeRefactoring) container;
    comrel.MultiFilterHelper helper = cr.getMultiFilterHelper(helperId);
    if (helper != null && !cr.getHelper().contains(helper)) {
      cr.getHelper().add(helper);
    }
    comrel.MultiFilterUnit newElement;
    if (helper != null) {
      newElement = factory.createMultiFilterUnit(helper);
    } else {
      newElement = factory.createMultiFilterUnit();
    }
    /* end of change */

    CartesianQueuedUnit owner = (CartesianQueuedUnit) getElementToEdit();
    owner.getHelperUnits().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** {@inheritDoc} */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    // / get the factory of the viewer
    // Dependency2ViewFactory factory = new Dependency2ViewFactory();
    // creation of the element
    // this.node = factory.createView(semanticApdater, this.containerView,
    // ((IHintedType) UMLElementTypes.Dependency_2014)
    // .getSemanticHint(), -1, true, preferenceHint);
    UMLViewProvider viewProvider = new UMLViewProvider();
    this.node =
        viewProvider.createAssociation_2015(
            ((EObject) semanticApdater.getAdapter(EObject.class)),
            this.containerView,
            -1,
            true,
            preferenceHint);

    // put to the good position
    Location notationLocation = NotationFactory.eINSTANCE.createLocation();
    notationLocation.setX(location.x);
    notationLocation.setY(location.y);
    ((Node) this.node).setLayoutConstraint(notationLocation);
    semanticApdater.setView(this.node);
    return CommandResult.newOKCommandResult(semanticApdater);
  }
  /** Execution of the command */
  @Override
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {

    View view = getView();

    List<Edge> sourceList = ViewUtil.getSourceConnections(view);
    List<Edge> targetList = ViewUtil.getTargetConnections(view);

    for (Edge edge : sourceList) {
      IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
      if (anchor != null) {
        anchor.setId(getNewIdStr(anchor));
      }
    }

    for (Edge edge : targetList) {
      IdentityAnchor anchor = (IdentityAnchor) edge.getTargetAnchor();
      if (anchor != null) {
        anchor.setId(getNewIdStr(anchor));
      }
    }

    return CommandResult.newOKCommandResult();
  }
  /** @generated NOT */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    /*
     * changes: Liest aus einem Request die ID des ModelRefactorings und
     * erstellt anhand dessen die AtomicUnit
     */
    CreateElementRequest request = ((CreateElementRequest) getRequest());
    String refId =
        (String) request.getParameters().get(comrel.diagram.part.ComrelPaletteFactory.UNIT_ID);
    comrel.ComrelFactory factory = ComrelFactory.eINSTANCE;
    EObject container = ((CreateElementRequest) getRequest()).getContainer();
    while (container.eContainer() != null) {
      container = container.eContainer();
    }
    CompositeRefactoring cr = (CompositeRefactoring) container;
    comrel.ModelRefactoring refactoring = cr.getEmfRefactoringAsModelRefactoring(refId);
    if (refactoring != null && !cr.getModelRefactorings().contains(refactoring)) {
      cr.getModelRefactorings().add(refactoring);
    }
    comrel.AtomicUnit newElement = factory.createAtomicUnit(refactoring);
    /* end of change */

    SingleQueuedUnit owner = (SingleQueuedUnit) getElementToEdit();
    owner.setRefactoringUnit(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /**
   * @see
   *     org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
   *     org.eclipse.core.runtime.IAdaptable)
   * @param arg0
   * @param arg1
   * @return
   * @throws ExecutionException
   */
  @SuppressWarnings("unchecked")
  @Override
  protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1)
      throws ExecutionException {
    Object createdElement = elementAdapter.getAdapter(EObject.class);
    if (createdElement instanceof EObject) {
      EObject eObjectCreatedElement = (EObject) createdElement;
      for (IGraphicalEditPart parent : graphicalParent) {
        EObject eObjectSourceReference = parent.resolveSemanticElement();
        AbstractContainerNodeDescriptor desc =
            GroupContainmentRegistry.getContainerDescriptor(parent);
        List<EReference> refs = desc.getReferenceFor(eObjectCreatedElement.eClass());
        for (EReference ref : refs) {
          if (ref != null && ref.isMany()) {
            Collection<EObject> collection = (Collection<EObject>) eObjectSourceReference.eGet(ref);
            if (!collection.contains(eObjectCreatedElement)) {
              collection.add(eObjectCreatedElement);
            }
          } else if (ref != null && !ref.isMany()) {
            eObjectSourceReference.eSet(ref, eObjectCreatedElement);
          }
        }
      }
    }

    return CommandResult.newOKCommandResult();
  }
    /** {@inheritDoc} */
    @Override
    protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)
        throws ExecutionException {
      // Remove elements whose container is getting copied.
      // ClipboardSupportUtil.getCopyElements(getObjectsToBeDuplicated());

      // Perform the copy and update the references.
      EcoreUtil.Copier copier = new TableCopier(getAllDuplicatedObjectsMap());
      copier.copy(TableToDuplicate);
      copier.copyReferences();

      EObject duplicateTable = copier.get(TableToDuplicate);
      Resource targetResource =
          getNotationResourceForTable(((Table) duplicateTable).getContext(), getEditingDomain());
      Resource diTargetResource =
          getDiResourceForTable(((Table) duplicateTable).getContext(), getEditingDomain());

      if (targetResource != null) {
        targetResource.getContents().add(duplicateTable);

        if (diTargetResource != null) {
          try {
            IPageManager pageManager =
                ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
            pageManager.addPage(duplicateTable);
          } catch (ServiceException e) {
            Activator.log.error(e);
          }
        } else {
          Activator.log.error(
              "It was not possible to find the di resource where to add the Table page",
              null); //$NON-NLS-1$
        }
      } else {
        Activator.log.warn(
            "It was not possible to find the Resource with the target EObject"); //$NON-NLS-1$
        targetResource = TableToDuplicate.eResource();
        if (targetResource != null) {
          Activator.log.error(
              "It was not possible to find the Resource with the source Table",
              null); //$NON-NLS-1$
          targetResource.getContents().add(duplicateTable);
          if (diTargetResource != null) {
            try {
              IPageManager pageManager =
                  ServiceUtilsForResource.getInstance().getIPageManager(diTargetResource);
              pageManager.addPage(duplicateTable);
            } catch (ServiceException e) {
              Activator.log.error(e);
            }
          } else {
            Activator.log.error(
                "It was not possible to find the di resource where to add the Table page",
                null); //$NON-NLS-1$
          }
        }
      }
      return CommandResult.newOKCommandResult(getAllDuplicatedObjectsMap());
    }
Example #13
0
  @Override
  protected CommandResult doExecuteWithResult(
      IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info)
      throws ExecutionException {
    CommandResult cmdResult = super.doExecuteWithResult(progressMonitor, info);
    if (!cmdResult.getStatus().isOK()) {
      if (cmdResult.getStatus().getSeverity() != IStatus.CANCEL) {
        Activator.log.error(cmdResult.getStatus().getException());
      }
      return cmdResult;
    }

    Object returnValue = cmdResult.getReturnValue();
    if (returnValue instanceof List<?>) {
      _selectedCmd =
          (Command)
              ((List<?>) returnValue)
                  .get(((List<?>) returnValue).size() - 1); // Returns the last command
    } else {
      _selectedCmd = (Command) cmdResult.getReturnValue();
    }
    Assert.isTrue(_selectedCmd != null && _selectedCmd.canExecute());
    _selectedCmd.execute();

    return CommandResult.newOKCommandResult();
  }
      protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)
          throws ExecutionException {

        if (null == viewAdapter || null == newValue)
          return CommandResult.newCancelledCommandResult();

        View view = (View) viewAdapter.getAdapter(View.class);
        Point p = (Point) newValue.getAdapter(IPropertyValueDeferred.class);
        ViewUtil.setStructuralFeatureValue(
            view, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(p.x));
        ViewUtil.setStructuralFeatureValue(
            view, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(p.y));

        // clear for garbage collection
        viewAdapter = null;
        newValue = null;
        return CommandResult.newOKCommandResult();
      }
 /** @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 */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   Interface newElement = UMLFactory.eINSTANCE.createInterface();
   Class owner = (Class) getElementToEdit();
   owner.getNestedClassifiers().add(newElement);
   ElementInitializers.getInstance().init_Interface_3036(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);
 }
 private EObject create(EObject origin, EReference reference, String typeID) {
   IElementType itype = ElementTypeRegistry.getInstance().getType(typeID);
   CreateElementRequest request = new CreateElementRequest(origin, itype, reference);
   ICommand command = service.getEditCommand(request);
   IStatus status = null;
   try {
     status = command.execute(null, null);
   } catch (ExecutionException e) {
     return null;
   }
   if (!status.isOK()) {
     return null;
   }
   CommandResult result = command.getCommandResult();
   if (result == null) {
     return null;
   }
   return (EObject) result.getReturnValue();
 }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    if (!canExecute()) {
      throw new ExecutionException("Invalid arguments in create link command"); // $NON-NLS-1$
    }

    if (getSource() != null && getTarget() != null) {
      getSource().getRegister().add(getTarget());
    }
    return CommandResult.newOKCommandResult();
  }
 /** @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);
 }
  @Override
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    parentTreeNodeEditPart.getParent().refresh();
    final List<IGraphicalEditPart> treeChildren =
        TreeLayoutUtil.getOrderedTreeChildren(parentTreeNodeEditPart);
    treeChildren.remove(UIUtils.getEditPart(request.getElementToDestroy()));
    TreeLayoutUtil.setTreeNodesPositionAnnotation(TreeLayoutUtil.getViews(treeChildren));

    return CommandResult.newOKCommandResult();
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Assign newElement = BPELFactory.eINSTANCE.createAssign();

    If owner = (If) getElementToEdit();
    owner.setActivity(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Open newElement = CrystalFactory.eINSTANCE.createOpen();

    AnonymousBlock owner = (AnonymousBlock) getElementToEdit();
    owner.getExecutablePart().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Distribution newElement = ActionsFactory.eINSTANCE.createDistribution();

    AtomicActionResult owner = (AtomicActionResult) getElementToEdit();
    owner.getHasCostDistribution().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    OpaqueActivity newElement = BPELFactory.eINSTANCE.createOpaqueActivity();

    Sequence owner = (Sequence) getElementToEdit();
    owner.getActivities().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    IndividualID newElement = SwrlFactory.eINSTANCE.createIndividualID();

    IndividualPropertyAtom owner = (IndividualPropertyAtom) getElementToEdit();
    owner.setArgument2(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    OutNode newElement = DataMapperFactory.eINSTANCE.createOutNode();

    Attribute owner = (Attribute) getElementToEdit();
    owner.setOutNode(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
Example #28
0
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Variable newElement = StatechartFactory.eINSTANCE.createVariable();

    Model owner = (Model) getElementToEdit();
    owner.getVariables().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Claim newElement = ArmFactory.eINSTANCE.createClaim();

    Case owner = (Case) getElementToEdit();
    owner.getContains().add(newElement);

    doConfigure(newElement, monitor, info);

    ((CreateElementRequest) getRequest()).setNewElement(newElement);
    return CommandResult.newOKCommandResult(newElement);
  }
  /** @generated */
  protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
      throws ExecutionException {
    Area newElement = WebmlFactory.eINSTANCE.createArea();

    Page owner = (Page) getElementToEdit();
    owner.getElement().add(newElement);

    doConfigure(newElement, monitor, info);

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