コード例 #1
0
  /** @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);
  }
  /** @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);
  }