public ModelSpecificEvent findOrCreateMSE(EObject caller, String className, String methodName) {

    EOperation operation = findOperation(caller, className, methodName);

    // TODO Should be created somewhere before...
    // at some point didier had written some code to serialize it... I think
    if (_actionModel == null) {
      _actionModel =
          fr.inria.aoste.timesquare.ecl.feedback.feedback.FeedbackFactory.eINSTANCE
              .createActionModel();
    }

    if (_actionModel != null) {
      for (ModelSpecificEvent existingMSE : _actionModel.getEvents()) {
        if (existingMSE.getCaller().equals(caller)
            && ((existingMSE.getAction() != null && existingMSE.getAction().equals(operation))
                || (existingMSE.getAction() == null && operation == null))) {
          // no need to create one, we already have it
          return existingMSE;
        }
      }
    }
    // let's create a MSE
    final ModelSpecificEvent mse = FeedbackFactory.eINSTANCE.createModelSpecificEvent();
    mse.setCaller(caller);
    mse.setAction(operation);
    if (operation != null)
      mse.setName("MSE_" + caller.getClass().getSimpleName() + "_" + operation.getName());
    else mse.setName("MSE_" + caller.getClass().getSimpleName() + "_" + methodName);
    // and add it for possible reuse
    if (_actionModel != null) {

      if (_actionModel.eResource() != null) {
        TransactionUtil.getEditingDomain(_actionModel.eResource());
        RecordingCommand command =
            new RecordingCommand(
                TransactionUtil.getEditingDomain(_actionModel.eResource()), "Saving new MSE ") {
              @Override
              protected void doExecute() {
                _actionModel.getEvents().add(mse);
                try {
                  _actionModel.eResource().save(null);
                } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            };
        TransactionUtil.getEditingDomain(_actionModel.eResource())
            .getCommandStack()
            .execute(command);
      }
    } else {
      _actionModel.getEvents().add(mse);
    }
    return mse;
  }
  private void refreshLostDiagramElements(final DView view) {
    DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.REFRESH_LOST_ELEMENTS_KEY);
    TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(view);
    Command refreshLostDiagramElementsCommand =
        new IdentityCommand() {
          @Override
          public void execute() {
            for (final DSemanticDiagram diagram :
                Iterables.filter(view.getOwnedRepresentations(), DSemanticDiagram.class)) {
              final DiagramKey diagramKey = DiagramKey.createDiagramKey(diagram);

              final List<LostNodeData> lostNodes = lostNodesByDelete.get(diagramKey);
              final List<LostEdgeData> lostEdges = lostEdgesByDelete.get(diagramKey);
              final Iterable<LostElementDataWithMapping> allLostElements =
                  Iterables.concat(lostNodes, lostEdges);

              refreshLostElementsThenDiagram(diagram, allLostElements);
            }
          }

          @Override
          public boolean canUndo() {
            return false;
          }
        };
    new MigrationCommandExecutor()
        .execute(transactionalEditingDomain, refreshLostDiagramElementsCommand);

    DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.REFRESH_LOST_ELEMENTS_KEY);

    // displayWarningForRemainingLostElementData();
  }
  /**
   * Returns the {@link CrossReferenceAdapter} corresponding to the element to destroy.
   *
   * @param request the request
   * @param destructee the destroyed element
   * @return the cross reference adapter the {@link CrossReferenceAdapter} corresponding to this
   *     element
   */
  public static CrossReferenceAdapter getCrossReferenceAdapter(
      IEditCommandRequest request, EObject destructee) {

    CrossReferenceAdapter crossReferenceAdapter = null;
    @SuppressWarnings("rawtypes")
    Map cacheMaps =
        (Map) request.getParameter("Cache_Maps"); // $NON-NLS-1$ RequestCacheEntries.Cache_Maps
    if (cacheMaps != null) {
      crossReferenceAdapter =
          (CrossReferenceAdapter)
              cacheMaps.get("CrossRefAdapter"); // $NON-NLS-1$ RequestCacheEntries.CrossRefAdapter
    }

    if (crossReferenceAdapter == null) {
      crossReferenceAdapter = CrossReferenceAdapter.getExistingCrossReferenceAdapter(destructee);
      if (crossReferenceAdapter == null) {
        TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(destructee);
        if (domain != null) {
          crossReferenceAdapter =
              CrossReferenceAdapter.getCrossReferenceAdapter(domain.getResourceSet());
        }
      }
    }
    return crossReferenceAdapter;
  }
 /** @generated */
 protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
   if (request instanceof CreateConnectionRequestEx) {
     if (request.getStartCommand() == null || !request.getStartCommand().canExecute()) {
       return UnexecutableCommand.INSTANCE;
     }
     CreateConnectionRequestEx requestEx = (CreateConnectionRequestEx) request;
     if (!DiagramEditPart.MODEL_ID.equals(requestEx.getModelID())) {
       return null;
     }
     int[] visualIds = requestEx.getVisualIds();
     CompoundCommand result = new CompoundCommand();
     for (int i = 0; i < visualIds.length; i++) {
       int nextVisualId = visualIds[i];
       switch (nextVisualId) {
         case TransitionEditPart.VISUAL_ID:
           result.appendIfCanExecute(new CreateTransition4001Command(requestEx));
           break;
       }
     }
     if (result.getCommandList().size() != 1 || !result.canExecute()) {
       // Cannot create several connections at once.
       return UnexecutableCommand.INSTANCE;
     }
     return request
         .getStartCommand()
         .chain(
             new WrappingCommand(
                 TransactionUtil.getEditingDomain(
                     ((Node) getHost().getModel()).getDiagram().getElement()),
                 result));
   }
   return null;
 }
 /** @generated */
 public void activate() {
   super.activate();
   getTransactionalUpdateManager().addUpdatableEditPart(getDiagram().getElement(), this);
   installNotationModelRefresher();
   installLinkNotationModelRefresher();
   getTransactionalUpdateManager().install(TransactionUtil.getEditingDomain(getDiagram()));
 }
  private void updateCallBlock(final CallNode node, final ListEntry entry) {

    final TransactionalEditingDomain editingDomain =
        TransactionUtil.getEditingDomain(diagramEditPart.getModel());

    AbstractTransactionalCommand command =
        new AbstractTransactionalCommand(editingDomain, "Update CallNode", Collections.EMPTY_LIST) {
          protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
              throws ExecutionException {

            String startNode = entry.getMessage();
            ListEntry parent = entry.getParent();
            String callFlow = parent.getMessage() + "-" + startNode;
            node.setName(callFlow.substring(callFlow.lastIndexOf("-") + 1));
            node.setFlowName(callFlow);

            return CommandResult.newOKCommandResult();
          }
        };

    try {
      OperationHistoryFactory.getOperationHistory()
          .execute(command, new SubProgressMonitor(new NullProgressMonitor(), 1), null);
    } catch (ExecutionException e) {
      Neuro4jDiagramEditorPlugin.getInstance()
          .logError("Unable to update call node", e); // $NON-NLS-1$
    }
  }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @see junit.framework.TestCase#setUp()
  * @generated NOT
  */
 @Override
 protected void setUp() throws Exception {
   this.env = TestEnvirornment.getInstance();
   setFixture(this.env.getDomMgr().getEventChannels().get(0));
   Assert.assertNotNull(getFixture());
   Assert.assertNotNull(TransactionUtil.getEditingDomain(getFixture()));
 }
  /**
   * Builds the command which will execute the user-tasks specified operations to reorder an event.
   *
   * @param sequenceDDiagram the DRepresentation to use for the ModelOperations
   * @param reorderTool the user-defined reordering tool.
   * @param event the semantic element of the event which was moved.
   * @param startingEndPredecessor the event end immediately preceding the reordered event's
   *     starting end after the move.
   * @param finishingEndPredecessor the event end immediately preceding the reordered event's
   *     finishing end after the move.
   * @return a command which executes the user-specified operations with the appropriate variables
   *     set.
   */
  public static SiriusCommand buildReorderCommand(
      SequenceDDiagram sequenceDDiagram,
      ReorderTool reorderTool,
      EObject event,
      EventEnd startingEndPredecessor,
      EventEnd finishingEndPredecessor) {
    ModelAccessor modelAccessor =
        SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(event);
    TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(event);

    SiriusCommand result =
        new SiriusCommand(domain, new IdentifiedElementQuery(reorderTool).getLabel());
    if (reorderTool.getOnEventMovedOperation().getFirstModelOperations() != null) {
      result
          .getTasks()
          .add(
              ToolCommandBuilder.buildVariablesInitializationTask(
                  reorderTool, event, startingEndPredecessor, finishingEndPredecessor));
      TaskHelper taskHelper = new TaskHelper(modelAccessor, new EMFCommandFactoryUI());

      result
          .getTasks()
          .add(
              taskHelper.buildTaskFromModelOperation(
                  sequenceDDiagram,
                  event,
                  reorderTool.getOnEventMovedOperation().getFirstModelOperations()));
    }
    return result;
  }
  private Collaboration getOrCreateCollaboration() {
    final List<RootElement> rootElements = getDefinitions().getRootElements();

    for (RootElement element : rootElements) {
      if (element instanceof Collaboration) {
        return (Collaboration) element;
      }
    }
    TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
    final Collaboration collaboration = FACTORY.createCollaboration();
    //		collaboration.setId(EcoreUtil.generateUUID());
    ModelUtil.setID(collaboration, resource);
    if (domain != null) {
      domain
          .getCommandStack()
          .execute(
              new RecordingCommand(domain) {

                @Override
                protected void doExecute() {
                  addCollaborationToRootElements(rootElements, collaboration);
                }
              });
    }
    return collaboration;
  }
  void createDefinitionsIfMissing() {
    EList<EObject> contents = resource.getContents();

    if (contents.isEmpty() || !(contents.get(0) instanceof DocumentRoot)) {
      TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);

      if (domain != null) {
        final DocumentRoot docRoot = FACTORY.createDocumentRoot();
        final Definitions definitions = FACTORY.createDefinitions();
        //				definitions.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(definitions, resource);
        Collaboration collaboration = FACTORY.createCollaboration();
        //				collaboration.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(collaboration, resource);
        Participant participant = FACTORY.createParticipant();
        //				participant.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(participant, resource);
        participant.setName("Internal");
        collaboration.getParticipants().add(participant);
        definitions.getRootElements().add(collaboration);

        domain
            .getCommandStack()
            .execute(
                new RecordingCommand(domain) {
                  @Override
                  protected void doExecute() {
                    docRoot.setDefinitions(definitions);
                    resource.getContents().add(docRoot);
                  }
                });
        return;
      }
    }
  }
 /** @generated */
 protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
   if (request instanceof CreateConnectionRequestEx) {
     CreateConnectionRequestEx requestEx = (CreateConnectionRequestEx) request;
     if (!DiagramEditPart.MODEL_ID.equals(requestEx.getModelID())) {
       return null;
     }
     int[] visualIds = requestEx.getVisualIds();
     CompoundCommand result = new CompoundCommand();
     for (int i = 0; i < visualIds.length; i++) {
       int nextVisualId = visualIds[i];
       switch (nextVisualId) {
         case TransitionEditPart.VISUAL_ID:
           result.appendIfCanExecute(new CreateTransition4001StartCommand(requestEx));
           break;
       }
     }
     if (!result.canExecute()) {
       return null;
     }
     Command wrappedResult =
         new WrappingCommand(
             TransactionUtil.getEditingDomain(
                 ((Node) getHost().getModel()).getDiagram().getElement()),
             result);
     request.setStartCommand(wrappedResult);
     return wrappedResult;
   }
   return null;
 }
 private static Command getCommand(CommandBuilder builder, EObject dObject) {
   ModelAccessor accessor =
       SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(dObject);
   TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(dObject);
   EMFCommandFactoryUI uiCallback = new EMFCommandFactoryUI();
   builder.init(accessor, domain, uiCallback);
   return builder.buildCommand();
 }
 /**
  * Default constructor.
  *
  * @param dTableViewerManager the {@link DTableViewerManager} to update according to {@link
  *     DTable} model changes.
  * @param dRepresentation the {@link DRepresentation} for which we update the {@link DTreeViewer}
  */
 public TableUIUpdater(DTableViewerManager dTableViewerManager, DRepresentation dRepresentation) {
   super(new DRepresentationNotificationFilter(dRepresentation));
   this.dTableTreeViewer = (DTableTreeViewer) dTableViewerManager.getTreeViewer();
   this.dTableViewerManager = dTableViewerManager;
   TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(dRepresentation);
   if (domain != null) {
     domain.addResourceSetListener(this);
   }
 }
 /** @generated */
 private EObject getSemanticElement(IAdaptable semanticAdapter) {
   if (semanticAdapter == null) {
     return null;
   }
   EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
   if (eObject != null) {
     return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject);
   }
   return null;
 }
Exemplo n.º 15
0
 private void expressionButtonListener(final EObject context) {
   final ParameterWizardDialog parameterDialog =
       new ParameterWizardDialog(
           Display.getCurrent().getActiveShell(),
           new AddParameterWizard(
               ModelHelper.getParentProcess(context), TransactionUtil.getEditingDomain(context)));
   if (parameterDialog.open() == Dialog.OK) {
     fillViewerInput(context);
   }
 }
  private void runRevealCommand(
      final RootEditPart root, final DDiagramEditor editor, final DDiagramElement vpe) {

    final Object adapter = editor.getAdapter(IDiagramCommandFactoryProvider.class);
    final IDiagramCommandFactoryProvider cmdFactoryProvider =
        (IDiagramCommandFactoryProvider) adapter;
    final TransactionalEditingDomain transactionalEditingDomain =
        TransactionUtil.getEditingDomain(editor.getEditingDomain().getResourceSet());
    final IDiagramCommandFactory emfCommandFactory =
        cmdFactoryProvider.getCommandFactory(transactionalEditingDomain);
    final Command cmd = emfCommandFactory.buildRevealCommand(vpe);

    final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(vpe);

    CompoundCommand allInOne = new CompoundCommand(cmd.getLabel());
    allInOne.append(cmd);

    domain.getCommandStack().execute(allInOne);
  }
Exemplo n.º 17
0
 protected AdapterFactory getAdapterFactory(final Object object) {
   if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
     return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
   }
   final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
   if (editingDomain != null) {
     return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
   }
   return null;
 }
Exemplo n.º 18
0
  protected AdapterFactory getAdapterFactory(Object object) {
    if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
      return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
    }
    TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);

    if (editingDomain instanceof AdapterFactoryEditingDomain) {
      return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
    } else {
      return AdapterFactoryManager.getAdapterFactory();
    }
  }
Exemplo n.º 19
0
  /**
   * @param diagramResourceUri
   * @param diagram
   * @param diagramEditor
   * @param contentStream
   * @param resourceFile
   * @return
   */
  public static TransactionalEditingDomain createEmfFileForDiagram(
      final URI diagramResourceUri,
      final Diagram diagram,
      final ToscaDiagramEditor diagramEditor,
      final InputStream contentStream,
      final IFile resourceFile) {

    TransactionalEditingDomain editingDomain = null;
    ResourceSet resourceSet = null;

    if (diagramEditor == null /*|| diagramEditor.getEditingDomain().getResourceSet() == null*/
        || diagramEditor.getEditDomain() == null) {
      // nothing found, create a new one
      resourceSet = new ResourceSetImpl();

      // try to retrieve an editing domain for this resource set
      editingDomain = TransactionUtil.getEditingDomain(resourceSet);

      if (editingDomain == null) {
        // not existing yet, create a new one
        editingDomain =
            TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
      }
    } else {
      editingDomain = diagramEditor.getEditingDomain();
      resourceSet = diagramEditor.getEditingDomain().getResourceSet();
    }

    // Create a resource for this file.
    final Resource resource = resourceSet.createResource(diagramResourceUri);
    final CommandStack commandStack = editingDomain.getCommandStack();
    commandStack.execute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            resource.setTrackingModification(true);

            if (contentStream == null || resourceFile == null) {
              resource.getContents().add(diagram);
            } else {
              try {
                resourceFile.create(contentStream, true, null);
              } catch (CoreException exception) {
                exception.printStackTrace();
              }
            }
          }
        });

    save(editingDomain, Collections.<Resource, Map<?, ?>>emptyMap());
    return editingDomain;
  }
 /** @generated */
 protected Command createCommand() {
   TransactionalEditingDomain editingDomain =
       TransactionUtil.getEditingDomain(oldTarget.getDiagram().getElement());
   CompoundCommand result = new CompoundCommand();
   result.append(new ReconnectNotationalEdgeTargetCommand(edge, newTarget));
   result.append(
       SetCommand.create(
           editingDomain,
           edge.getElement(),
           imagindata.imagindataPackage.eINSTANCE.getTransition_End(),
           newTarget.getElement()));
   return result;
 }
Exemplo n.º 21
0
 private TransactionalEditingDomain getEditingDomain() {
   // If a transaction is already active, we want to run this
   // inside that transaction instead of creating a new one.
   if (resource == null) {
     resource = getResource(object);
     if (resource == null) return null;
   }
   TransactionalEditingDomainImpl domain =
       (TransactionalEditingDomainImpl) TransactionUtil.getEditingDomain(resource);
   if (domain.getActiveTransaction() != null && domain.getActiveTransaction().isActive())
     return null;
   return domain;
 }
  /**
   * Sets the DDiagram.
   *
   * @param dia The diagram
   */
  public void setDiagram(final DDiagram dia) {
    if (diagram == dia) {
      return;
    }

    if (domain == null) {
      domain = TransactionUtil.getEditingDomain(dia);
    }

    diagram = dia;
    removeSemanticListener();
    addSemanticListener();
    refresh(true);
  }
Exemplo n.º 23
0
 /** @generated */
 protected void refreshLinkNotationModel() {
   LinkNotationModelRefresher linkRefresher = getLinkNotationModelRefresher();
   if (!linkRefresher.isInstalled()) {
     return;
   }
   Command command = linkRefresher.buildRefreshNotationModelCommand();
   if (command == null) {
     return;
   }
   TransactionalEditingDomain domainModelEditDomain =
       TransactionUtil.getEditingDomain(getDiagram().getElement());
   getViewer()
       .getEditDomain()
       .getCommandStack()
       .execute(new WrappingCommand(domainModelEditDomain, command));
 }
Exemplo n.º 24
0
 /** @generated */
 protected ICommand getParseCommand(IAdaptable adapter, Object[] values, int flags) {
   if (values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
     return UnexecutableCommand.INSTANCE;
   }
   EObject element = (EObject) adapter.getAdapter(EObject.class);
   TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
   if (editingDomain == null) {
     return UnexecutableCommand.INSTANCE;
   }
   CompositeTransactionalCommand command =
       new CompositeTransactionalCommand(editingDomain, "Set Values"); // $NON-NLS-1$
   for (int i = 0; i < values.length; i++) {
     command.compose(getModificationCommand(element, editableFeatures[i], values[i]));
   }
   return command;
 }
    /** @generated */
    public StatusDecorator(IDecoratorTarget decoratorTarget) {
      super(decoratorTarget);
      try {
        final View view = (View) getDecoratorTarget().getAdapter(View.class);
        TransactionUtil.getEditingDomain(view)
            .runExclusive(
                new Runnable() {

                  public void run() {
                    StatusDecorator.this.viewId = view != null ? ViewUtil.getIdStr(view) : null;
                  }
                });
      } catch (Exception e) {
        GSN1DiagramEditorPlugin.getInstance().logError("ViewID access failure", e); // $NON-NLS-1$		
      }
    }
 public void save() {
   TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
   if (domain != null) {
     domain
         .getCommandStack()
         .execute(
             new RecordingCommand(domain) {
               @Override
               protected void doExecute() {
                 saveResource();
               }
             });
   } else {
     saveResource();
   }
 }
Exemplo n.º 27
0
  /** @generated */
  public void buildContextMenu(final IMenuManager menu) {
    getViewer().flush();
    try {
      TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel())
          .runExclusive(
              new Runnable() {

                public void run() {
                  ContributionItemService.getInstance()
                      .contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
                  menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
                }
              });
    } catch (Exception e) {
      UMLDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
    }
  }
    /** @was-generated */
    public StatusDecorator(IDecoratorTarget decoratorTarget) {
      super(decoratorTarget);
      try {
        final View view = (View) getDecoratorTarget().getAdapter(View.class);
        TransactionUtil.getEditingDomain(view)
            .runExclusive(
                new Runnable() {

                  @Override
                  public void run() {
                    StatusDecorator.this.viewId =
                        view != null ? SiriusGMFHelper.getViewId(view) : null;
                  }
                });
      } catch (Exception e) {
        DiagramPlugin.getDefault().logError(Messages.StatusDecorator_viewIdAccessFailureMsg, e);
      }
    }
 /** @generated */
 public ICommand getParseCommand(IAdaptable element, final String newString, int flags) {
   final EObject target = (EObject) element.getAdapter(EObject.class);
   if (!validateValues(target, newString)) {
     return UnexecutableCommand.INSTANCE;
   }
   TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(target);
   if (editingDomain == null) {
     return UnexecutableCommand.INSTANCE;
   }
   IFile affectedFile = WorkspaceSynchronizer.getFile(target.eResource());
   return new AbstractTransactionalCommand(
       editingDomain,
       "Set Values",
       affectedFile == null ? null : Collections.singletonList(affectedFile)) { // $NON-NLS-1$
     protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
         throws ExecutionException {
       return new CommandResult(updateValues(target, newString));
     }
   };
 }
  /** @generated */
  public void buildContextMenu(final IMenuManager menu) {
    getViewer().flush();
    try {
      TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel())
          .runExclusive(
              new Runnable() {

                public void run() {
                  ContributionItemService.getInstance()
                      .contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
                  menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
                  menu.appendToGroup("editGroup", deleteAction);
                }
              });
    } catch (Exception e) {
      edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
          .ClassDiagram_MAVODiagramEditorPlugin.getInstance()
          .logError("Error building context menu", e);
    }
  }