public void resetInputTreeFromFile(String filePath) {
    EObject parentContainer =
        ((org.eclipse.gmf.runtime.notation.impl.NodeImpl) (this).getModel()).getElement();
    InputImpl iip = (InputImpl) parentContainer;

    DeleteCommand deleteComand = new DeleteCommand(getEditingDomain(), iip.getTreeNode());
    if (deleteComand.canExecute()) {
      getEditingDomain().getCommandStack().execute(deleteComand);
    }

    TreeNode treeNode = DataMapperFactory.eINSTANCE.createTreeNode();
    Tree tree = TreeFromAVSC.generateInputTreeFromFile(filePath);
    // funcFillTree(tree, element);
    convertTree(tree, treeNode);

    AddCommand addTreeNodeCmd2 =
        new AddCommand(
            getEditingDomain(),
            parentContainer,
            DataMapperPackage.Literals.INPUT__TREE_NODE,
            treeNode);
    if (addTreeNodeCmd2.canExecute()) {
      getEditingDomain().getCommandStack().execute(addTreeNodeCmd2);
    }
    getPrimaryShape().setPreferredSize(250, 15);
  }
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionListener#firePropertiesChanged(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
   */
  public void firePropertiesChanged(IPropertiesEditionEvent event) {
    if (!isInitializing()) {
      Diagnostic valueDiagnostic = validateValue(event);
      if (PropertiesEditionEvent.COMMIT == event.getState()
          && IPropertiesEditionComponent.LIVE_MODE.equals(editing_mode)
          && valueDiagnostic.getSeverity() == Diagnostic.OK) {
        CompoundCommand command = new CompoundCommand();
        if (TarotViewsRepository.GamePlayers.players == event.getAffectedEditor()) {
          if (PropertiesEditionEvent.SET == event.getKind()) {
            Player oldValue = (Player) event.getOldValue();
            Player newValue = (Player) event.getNewValue();
            // TODO: Complete the game update command
            for (EStructuralFeature feature : newValue.eClass().getEAllStructuralFeatures()) {
              if (feature.isChangeable()
                  && !(feature instanceof EReference && ((EReference) feature).isContainer())) {
                command.append(
                    SetCommand.create(
                        liveEditingDomain, oldValue, feature, newValue.eGet(feature)));
              }
            }
          } else if (PropertiesEditionEvent.ADD == event.getKind())
            command.append(
                AddCommand.create(
                    liveEditingDomain,
                    game,
                    TarotPackage.eINSTANCE.getGame_Players(),
                    event.getNewValue()));
          else if (PropertiesEditionEvent.REMOVE == event.getKind())
            command.append(DeleteCommand.create(liveEditingDomain, event.getNewValue()));
          else if (PropertiesEditionEvent.MOVE == event.getKind())
            command.append(
                MoveCommand.create(
                    liveEditingDomain,
                    game,
                    TarotPackage.eINSTANCE.getPlayer(),
                    event.getNewValue(),
                    event.getNewIndex()));
        }

        if (!command.isEmpty() && !command.canExecute()) {
          EEFRuntimePlugin.getDefault().logError("Cannot perform model change command.", null);
        } else {
          liveEditingDomain.getCommandStack().execute(command);
        }
      }
      if (valueDiagnostic.getSeverity() != Diagnostic.OK
          && valueDiagnostic instanceof BasicDiagnostic)
        super.firePropertiesChanged(new PropertiesValidationEditionEvent(event, valueDiagnostic));
      else {
        Diagnostic validate = validate();
        super.firePropertiesChanged(new PropertiesValidationEditionEvent(event, validate));
      }
      super.firePropertiesChanged(event);
    }
  }
  /** Clear links */
  @SuppressWarnings({"rawtypes", "unchecked"})
  private static void clearLinks() {
    Collection values =
        getDiagramEditor().getDiagramGraphicalViewer().getEditPartRegistry().values();
    Iterator iterator = values.iterator();
    CompoundCommand ccModel = new CompoundCommand();
    org.eclipse.gef.commands.CompoundCommand ccView =
        new org.eclipse.gef.commands.CompoundCommand();

    while (iterator.hasNext()) {
      Object editPart = iterator.next();
      if (editPart instanceof EsbLinkEditPart) {
        EsbLinkEditPart linkEditPart = (EsbLinkEditPart) editPart;
        /*
         * We shouldn't remove EsbLinkEditParts if the target of the link is a AbstractEndpointInputConnectorEditPart.
         * Because these kind of links will not be get regenerated again according to the current implementation.
         */
        if (linkEditPart.getTarget() instanceof AbstractEndpointInputConnectorEditPart) {
          continue;
        }
        Collection linkCollection = new ArrayList();
        linkCollection.add(((ConnectorImpl) linkEditPart.getModel()).getElement());
        org.eclipse.emf.edit.command.DeleteCommand modelDeleteCommand =
            new org.eclipse.emf.edit.command.DeleteCommand(
                getDiagramEditor().getEditingDomain(), linkCollection);
        if (modelDeleteCommand.canExecute()) {
          ccModel.append(modelDeleteCommand);
        }
        DeleteCommand viewDeleteCommand = new DeleteCommand(linkEditPart.getNotationView());
        if (viewDeleteCommand.canExecute()) {
          ccView.add(new ICommandProxy(viewDeleteCommand));
        }
      }
    }

    if (ccModel.canExecute()) {
      getDiagramEditor().getEditingDomain().getCommandStack().execute(ccModel);
    }
    if (ccView.canExecute()) {
      getDiagramEditor().getDiagramEditDomain().getDiagramCommandStack().execute(ccView);
    }
  }
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#getPropertiesEditionCommand
  *     (org.eclipse.emf.edit.domain.EditingDomain)
  */
 public CompoundCommand getPropertiesEditionCommand(EditingDomain editingDomain) {
   CompoundCommand cc = new CompoundCommand();
   if ((game != null) && (gamePlayersPart != null)) {
     List playersToAddFromPlayers = gamePlayersPart.getPlayersToAdd();
     for (Iterator iter = playersToAddFromPlayers.iterator(); iter.hasNext(); )
       cc.append(
           AddCommand.create(
               editingDomain, game, TarotPackage.eINSTANCE.getGame_Players(), iter.next()));
     Map playersToRefreshFromPlayers = gamePlayersPart.getPlayersToEdit();
     for (Iterator iter = playersToRefreshFromPlayers.keySet().iterator(); iter.hasNext(); ) {
       Player nextElement = (Player) iter.next();
       Player players = (Player) playersToRefreshFromPlayers.get(nextElement);
       for (EStructuralFeature feature : nextElement.eClass().getEAllStructuralFeatures()) {
         if (feature.isChangeable()
             && !(feature instanceof EReference && ((EReference) feature).isContainer())) {
           cc.append(
               SetCommand.create(editingDomain, nextElement, feature, players.eGet(feature)));
         }
       }
     }
     List playersToRemoveFromPlayers = gamePlayersPart.getPlayersToRemove();
     for (Iterator iter = playersToRemoveFromPlayers.iterator(); iter.hasNext(); )
       cc.append(DeleteCommand.create(editingDomain, iter.next()));
     List playersToMoveFromPlayers = gamePlayersPart.getPlayersToMove();
     for (Iterator iter = playersToMoveFromPlayers.iterator(); iter.hasNext(); ) {
       org.eclipse.emf.eef.runtime.impl.utils.EMFListEditUtil.MoveElement moveElement =
           (org.eclipse.emf.eef.runtime.impl.utils.EMFListEditUtil.MoveElement) iter.next();
       cc.append(
           MoveCommand.create(
               editingDomain,
               game,
               TarotPackage.eINSTANCE.getPlayer(),
               moveElement.getElement(),
               moveElement.getIndex()));
     }
   }
   if (!cc.isEmpty()) return cc;
   cc.append(IdentityCommand.INSTANCE);
   return cc;
 }
 public ICommand delete(Object element) {
   return new EMFCommand(
       DeleteCommand.create(fEditDomain, EMFModel.getEMFObjectForModel(element)));
 }