Example usage for javax.swing.undo UndoManager getRedoPresentationName

List of usage examples for javax.swing.undo UndoManager getRedoPresentationName

Introduction

In this page you can find the example usage for javax.swing.undo UndoManager getRedoPresentationName.

Prototype

public synchronized String getRedoPresentationName() 

Source Link

Document

Returns a description of the redoable form of this edit.

Usage

From source file:ee.ioc.cs.vsle.editor.Editor.java

/**
 * Updates Undo and Redo actions. When a new scheme tab is selected/opened
 * or an action that modifies the scheme is performed the undo and redo
 * action objects have to be updated to reflect the current state, this
 * includes presentation name and enabled/disabled status.
 *///from   w  w w  .  ja  va 2 s  . co m
public void refreshUndoRedo() {
    Canvas canvas = getCurrentCanvas();
    if (canvas != null) {
        UndoManager um = canvas.undoManager;
        undoAction.setEnabled(!canvas.isActionInProgress() && um.canUndo());
        redoAction.setEnabled(!canvas.isActionInProgress() && um.canRedo());
        undoAction.putValue(Action.NAME, um.getUndoPresentationName());
        redoAction.putValue(Action.NAME, um.getRedoPresentationName());
    } else {
        undoAction.setEnabled(false);
        redoAction.setEnabled(false);
        undoAction.putValue(Action.NAME, Menu.UNDO);
        redoAction.putValue(Action.NAME, Menu.REDO);
    }
}