Package org.eclipse.emf.common.command

Examples of org.eclipse.emf.common.command.CommandStack


  @Override
  public void setDocument(IDocument document,
      IAnnotationModel annotationModel, int modelRangeOffset,
      int modelRangeLength) {
    if (getDocument() instanceof IStructuredDocument) {
      CommandStack commandStack = ((IStructuredDocument) getDocument())
          .getUndoManager().getCommandStack();
      if (commandStack instanceof BasicCommandStack) {
        commandStack
            .addCommandStackListener(getInternalCommandStackListener());
      }
    }
    super.setDocument(document, annotationModel, modelRangeOffset,
        modelRangeLength);
    if (getDocument() instanceof IStructuredDocument) {
      CommandStack commandStack = ((IStructuredDocument) getDocument())
          .getUndoManager().getCommandStack();
      if (commandStack instanceof BasicCommandStack) {
        commandStack
            .addCommandStackListener(getInternalCommandStackListener());
      }
    }
  }
View Full Code Here


   * .IProgressMonitor)
   */
  @Override
  public void doSave(IProgressMonitor progressMonitor) {
    if (getDocument() instanceof IStructuredDocument) {
      CommandStack commandStack = ((IStructuredDocument) getDocument())
          .getUndoManager().getCommandStack();
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322529
      ((IStructuredDocument) getDocument()).getUndoManager()
          .forceEndOfPendingCommand(null,
              getViewer().getSelectedRange().x,
View Full Code Here

    boolean result = super.isDirty();
    if (!result) {
      return result;
    }
    if (getDocument() instanceof IStructuredDocument) {
      CommandStack commandStack = ((IStructuredDocument) getDocument())
          .getUndoManager().getCommandStack();
      if (commandStack instanceof BasicCommandStack) {
        BasicCommandStack bcs = (BasicCommandStack) commandStack;
        return bcs.isSaveNeeded();
      }
View Full Code Here

    // Create a resource set and EditingDomain
    final TransactionalEditingDomain editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
    final ResourceSet resourceSet = editingDomain.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);
        resource.getContents().add(diagram);
View Full Code Here

      //Activator.log.error(ex);
      return null;
    }

    final ModelSet papyrus = modelSet;
    CommandStack stack = modelSet.getTransactionalEditingDomain().getCommandStack();
    stack.execute(new AbstractCommand() {
      @Override
      public boolean canExecute() {
        return true;
      }
View Full Code Here

      resourceSet = diagramEditor.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);
View Full Code Here

  @Inject
  ContactsManager contactsManager;

  @CanExecute
  public boolean canUndo() {
    CommandStack commandStack = contactsManager.getEditingDomain().getCommandStack();
    return commandStack.canRedo();
  }
View Full Code Here

    return commandStack.canRedo();
  }

  @Execute
  public void undo() {
    CommandStack commandStack = contactsManager.getEditingDomain().getCommandStack();
    if (commandStack.canRedo())
      commandStack.redo();
  }
View Full Code Here

  @Inject
  ContactsManager contactsManager;
 
  @CanExecute
  public boolean canUndo() {
    CommandStack commandStack = contactsManager.getEditingDomain().getCommandStack();
    return commandStack.canUndo();
  }
View Full Code Here

    return commandStack.canUndo();
  }

  @Execute
  public void undo() {
    CommandStack commandStack = contactsManager.getEditingDomain().getCommandStack();
    if (commandStack.canUndo())
      commandStack.undo();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.common.command.CommandStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.