Esempio n. 1
0
 private void packComposedAction() {
   ComposedAction action = composedAction;
   composedAction = null;
   if (!action.isEmpty()) {
     addAction(action);
   }
 }
Esempio n. 2
0
  /**
   * 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();
  }