Search in sources :

Example 1 with SwingUndoSupport

use of org.cytoscape.work.swing.undo.SwingUndoSupport in project cytoscape-impl by cytoscape.

the class UndoAction method menuSelected.

/**
 * Called when the menu that contains this action is clicked on.
 * @param e The menu event that triggers this method call.
 */
@Override
public void menuSelected(MenuEvent e) {
    final SwingUndoSupport undo = serviceRegistrar.getService(SwingUndoSupport.class);
    if (undo.getUndoManager().canUndo()) {
        setEnabled(true);
        putValue(Action.NAME, undo.getUndoManager().getUndoPresentationName());
    } else {
        setEnabled(false);
        putValue(Action.NAME, "Undo");
    }
}
Also used : SwingUndoSupport(org.cytoscape.work.swing.undo.SwingUndoSupport)

Example 2 with SwingUndoSupport

use of org.cytoscape.work.swing.undo.SwingUndoSupport in project cytoscape-impl by cytoscape.

the class RedoAction method menuSelected.

/**
 * Called when the menu that contains this action is clicked on.
 * @param e The menu event that triggers this method call.
 */
@Override
public void menuSelected(MenuEvent e) {
    final SwingUndoSupport undo = serviceRegistrar.getService(SwingUndoSupport.class);
    if (undo.getUndoManager().canRedo()) {
        setEnabled(true);
        putValue(Action.NAME, undo.getUndoManager().getRedoPresentationName());
    } else {
        setEnabled(false);
        putValue(Action.NAME, "Redo");
    }
}
Also used : SwingUndoSupport(org.cytoscape.work.swing.undo.SwingUndoSupport)

Aggregations

SwingUndoSupport (org.cytoscape.work.swing.undo.SwingUndoSupport)2