Example usage for javax.swing.undo UndoManager getUndoPresentationName

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

Introduction

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

Prototype

public synchronized String getUndoPresentationName() 

Source Link

Document

Returns a description of the undoable 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 ww  .jav a 2  s. c  o 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);
    }
}