/**
   * 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 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();
 }
  /**
   * {@inheritDoc}
   *
   * @see org.eclipse.sirius.viewpoint.impl.DDiagramElementContainerImpl#refresh()
   */
  @Override
  public void refresh() {
    IInterpreter interpreter =
        SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(this);
    new ContainerMappingHelper(interpreter)
        .updateContainer((IContainerMappingExt) getActualMapping(), this);
    for (DNodeListElement iterElement : this.getOwnedElements()) {
      iterElement.refresh();
    }

    AbstractDNodeSpecOperations.refreshBorderNodes(this);
  }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.sirius.diagram.business.internal.metamodel.description.spec.ContainerMappingSpec#getBestStyle(org.eclipse.emf.ecore.EObject,
  *     org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
  */
 @Override
 public ContainerStyle getBestStyle(
     final EObject modelElement, final EObject viewVariable, final EObject containerVariable) {
   StyleHelper sHelper =
       new StyleHelper(
           SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(modelElement));
   final ContainerStyle result = sHelper.createContainerStyle(getStyle());
   if (result == null && getImportedMapping() != null && getImportedMapping() != this) {
     /*
      * Here if you are importing a node and if we did not used custom
      * styles, then we want to re-use it's styles.
      */
     return getImportedMapping().getBestStyle(modelElement, viewVariable, containerVariable);
   }
   return result;
 }
 private static EObject tryToInstanciateType(
     TreeItemCreationTool createTool, EObject created, String map) {
   EObject result = created;
   if (!StringUtil.isEmpty(map)) {
     try {
       final EObject anInstance =
           SiriusPlugin.getDefault()
               .getModelAccessorRegistry()
               .getModelAccessor(createTool)
               .createInstance(map);
       result = anInstance;
     } catch (final MetaClassNotFoundException e) {
       /*
        * silent catch, it's just a bit more magic, if we're able to
        * retrieve the right type then we'll do.
        */
     }
   }
   return result;
 }
 private IPermissionAuthority getPermissionAuthority() {
   final ModelAccessor accessor =
       SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(diagram);
   return accessor.getPermissionAuthority();
 }