コード例 #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);
  }
コード例 #2
0
 /** @generated */
 public boolean canExecute() {
   SingleQueuedUnit container = (SingleQueuedUnit) getElementToEdit();
   if (container.getRefactoringUnit() != null) {
     return false;
   }
   return true;
 }