コード例 #1
0
ファイル: UndoManager.java プロジェクト: epicsdeb/visualdct
  /**
   * This method was created in VisualAge.
   *
   * @param action epics.undo.ActionObject
   */
  public void addAction(ActionObject action) {

    if (!monitor) return;

    if (composedAction != null) {
      composedAction.addAction(action);
      // System.out.println("Composing: "+action.getDescription());
      return;
    }

    if (actionsAfterSave >= 0 && actionsAfterSave <= bufferSize) {
      actionsAfterSave++;
      if (actionsAfterSave >= bufferSize) bufferSizeReached = true;
    } else {
      bufferSizeReached = true;
    }

    // System.out.println("New action: "+action.getDescription());
    DsManager.getDrawingSurface(dsId).setModified(true);

    if (pos == lowerbound) pos = last = increment(pos);
    else {
      pos = last = increment(pos);
      if (last == first) first = increment(first); // lose first (the "oldest" action)
    }
    actions[pos] = action;

    int np = increment(last); // clear lost actions -> finalization!
    while (np != first) {
      actions[np] = null;
      np = increment(np);
    }

    updateMenuItems();
  }
コード例 #2
0
ファイル: UndoManager.java プロジェクト: epicsdeb/visualdct
  /** This method was created in VisualAge. */
  public void undo() {

    if (composedAction != null) {
      Console.getInstance().println("Warning: UndoManager: undo(): macro action in progress.");
      packComposedAction();
    }

    if (pos != lowerbound) {
      boolean m = monitor;
      monitor = false;

      fireMacroActionStart();
      actions[pos].undo();
      fireMacroActionStop();

      // System.out.println("Undo: "+actions[pos].getDescription());
      pos = decrement(pos);
      DsManager.getDrawingSurface(dsId).setModified(true);
      updateMenuItems();
      monitor = m;
      setModification();
      actionsAfterSave--;
    }
  }
コード例 #3
0
ファイル: UndoManager.java プロジェクト: epicsdeb/visualdct
 /**
  * Sets the modified tag according to the state of the opened template. If the template has (by
  * undoing) became the same as the one that is saved tag is turned to false or else it is true.
  */
 private void setModification() {
   DsManager.getDrawingSurface(dsId).setModified(pos != savedOnPos || bufferSizeReached);
 }