Examples of CommandStack


Examples of org.eclipse.gef.commands.CommandStack

            selectedPart = (EditPart) object;
        }
    }

    protected void executeCommand(Command command) {
        CommandStack commandStack;
        if (targetPart instanceof GraphicalEditor) {
            commandStack = (CommandStack) ((GraphicalEditor) targetPart).getAdapter(CommandStack.class);
        } else {
            commandStack = ((OutlineViewer) ((ContentOutline) targetPart).getCurrentPage()).getCommandStack();
        }
        commandStack.execute(command);
    }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

            if (editor != null) {
                Work work = openEditor(editor, workDefinition);
                if (work != null) {
                    SetWorkCommand setCommand = new SetWorkCommand();
                    setCommand.setPropertyValue(work);
                    CommandStack stack = getViewer().getEditDomain().getCommandStack();
                    stack.execute(setCommand);
                }
            }
        }
    }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

   * Executes the given command.
   *
   * @param command
   */
  public void executeCommand(Command command) {
    CommandStack stack = getEditDomain().getCommandStack();
    stack.execute(command);
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

    {
      eraseFeedback();
      String newValue = (String)this.comboCellEditor.getValue();
      if (newValue != null && !newValue.equals(this.initialValue))
      {
        CommandStack stack = getEditPart().getViewer().getEditDomain()
            .getCommandStack();
        stack.execute(getEditPart().getCommand(getDirectEditRequest()));
      }     
    }
    finally
    {
      bringDown();
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

    return this.textPart;
  }
 
  private void internalCommit()
  {
    CommandStack stack = getEditPart().getViewer().getEditDomain()
        .getCommandStack();
    stack.execute(getEditPart().getCommand(getDirectEditRequest()));           
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

      MessageDialog.openWarning(getSite().getShell(), EditorMessages.saveModifiedTextFailedTitle, message);
    }
  }

  public void markXmlSaved() {
    CommandStack stack = getCommandStack();
    if (stack == null) {
      Activator.getLogger().warning("No command stack available when trying to save document!");
    } else {
      stack.markSaveLocation();
    }
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

            if (editor != null) {
                Work work = openEditor(editor, workDefinition);
                if (work != null) {
                    SetWorkCommand setCommand = new SetWorkCommand();
                    setCommand.setPropertyValue(work);
                    CommandStack stack = getViewer().getEditDomain().getCommandStack();
                    stack.execute(setCommand);
                }
            }
        }
    }
View Full Code Here

Examples of org.eclipse.gef.commands.CommandStack

      // If leaving a graph page, clear the GEF command stack. This
      // ensures that graph pages can only undo/redo recent edits that
      // were performed in the page itself. All XML edits should remain
      // undo/redoable from the source and form pages.
      AbstractConfigGraphicalEditor editor = (AbstractConfigGraphicalEditor) activeEditorPart;
      CommandStack stack = (CommandStack) editor.getAdapter(CommandStack.class);
      stack.flush();
    }
    activeEditorPart = part;

    if (part instanceof StructuredTextEditor) {
      sourceViewerActionContributor.setActiveEditor(part);
View Full Code Here

Examples of org.gdbms.engine.data.command.CommandStack

import junit.framework.TestCase;


public class CommandStackTests extends TestCase {
    public void testNormal() throws Exception {
        CommandStack cs = new CommandStack();
        cs.setLimit(3);
        cs.setUseLimit(true);
       
        assertTrue(!cs.canRedo());
        assertTrue(!cs.canUndo());
       
        cs.put(new C());
        assertTrue(!cs.canRedo());
        assertTrue(cs.canUndo());
       
        cs.put(new C());
        cs.put(new C());
        assertTrue(!cs.canRedo());
        assertTrue(cs.canUndo());

        cs.undo();
        assertTrue(cs.canRedo());
        assertTrue(cs.canUndo());
        cs.undo();
        assertTrue(cs.canRedo());
        assertTrue(cs.canUndo());
        cs.undo();
        assertTrue(cs.canRedo());
        assertTrue(!cs.canUndo());
    }
View Full Code Here

Examples of org.gdbms.engine.data.command.CommandStack

        assertTrue(cs.canRedo());
        assertTrue(!cs.canUndo());
    }
   
    public void testLimit() throws Exception {
        CommandStack cs = new CommandStack();
        cs.setLimit(2);
        cs.setUseLimit(true);
       
        cs.put(new C(1));
        cs.put(new C(2));
        cs.put(new C(3));
        assertTrue(cs.undo().equals(new C(3)));
        assertTrue(cs.undo().equals(new C(2)));
        assertTrue(cs.canRedo());
        assertTrue(!cs.canUndo());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.