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");
}
}
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");
}
}
Aggregations