Ejemplo n.º 1
0
  /** Undo the last change. */
  public synchronized void undo() {
    if (DEBUG) System.out.println("ChangeManager.undo()");
    super.undo();
    validated = false;

    fireStateChanged(new ChangeEvent(this));
  }
 public void undo() {
   if (undoManager.canUndo()) {
     undoManager.undo();
   }
   statusLine = "Undo";
   notifyObservers();
 }
Ejemplo n.º 3
0
 public void undo() {
   try {
     if (undo != null && undo.canUndo()) {
       undo.undo();
       refreshEnabledStatus();
     }
   } catch (CannotUndoException ignore) {
   }
 }
 @Action(enabledProperty = UNDO_ENABLED)
 public void undo() {
   try {
     undo.undo();
   } catch (CannotUndoException ex) {
     Logger.getLogger(ApplicationActions.class).error(ex);
     Toolkit.getDefaultToolkit().beep();
   }
   updateUndoActions();
 }
Ejemplo n.º 5
0
 public void actionPerformed(ActionEvent e) {
   UndoManager undo = menu.getCurScoreObject().manager;
   try {
     undo.undo();
     menu.setCurSaveFlag(false);
     p.repaint();
   } catch (CannotUndoException ex) {
     // System.out.println("Unable to undo: " + ex);
     // ex.printStackTrace();
   }
 }
Ejemplo n.º 6
0
 public void actionPerformed(ActionEvent e) {
   JMenuItem source = (JMenuItem) (e.getSource());
   if (source.getText().equals("元に戻す")) {
     if (undo.canUndo()) {
       undo.undo();
     }
   } else if (source.getText().equals("やり直し")) {
     if (undo.canRedo()) {
       undo.redo();
     }
   }
 }
  /**
   * If this UndoManager is inProgress, undo the last significant UndoableEdit before
   * indexOfNextAdd, and all insignificant edits back to it. Updates indexOfNextAdd accordingly.
   *
   * <p>If not inProgress, indexOfNextAdd is ignored and super's routine is called.
   */
  public synchronized void undo() throws CannotUndoException {
    //        System.out.println("appel a undo");
    if (this.isInProgress()) {
      UndoableEdit edit = editToBeUndone();

      //            System.out.println("\tedit to undone : " + edit);

      if (edit instanceof UndoManager) {
        UndoManager manager = (UndoManager) edit;
        //                System.out.println("\tindexOfNextAdd : " + indexOfNextAdd);

        while (manager.canUndo()) {
          manager.undo();
        }

        //            System.out.println("gogo affichage de edits : ");
        //            for (int i = 0; i < this.edits.size(); i++)
        //                System.out.println("\t" + this.edits.elementAt(i).getClass());
        //                System.out.println("\tindexOfNextAdd : " + indexOfNextAdd);
        indexOfNextAdd--;

        return;
      }
      if (edit == null) {
        throw new CannotUndoException();
      }
      undoTo(edit);

      //            System.out.println("gigi affichage de edits : ");
      //            for (int i = 0; i < this.edits.size(); i++)
      //                System.out.println("\t" + this.edits.elementAt(i).getClass());

    } else {
      super.undo();
    }
  }
Ejemplo n.º 8
0
  @Override()
  public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();

    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new Kerberos(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true);
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
      for (int i = 0; i < undoCounter.getCounter(); i++) {
        if (undoManager.canUndo()) {
          undoManager.undo();
        }
      }
    }

    model.removeUndoableEditListener(undoCounter);
  }
Ejemplo n.º 9
0
 @Override
 public synchronized void undo() throws CannotUndoException {
   super.undo();
   updateDirty();
 }