List of usage examples for javax.swing.undo UndoManager canRedo
public synchronized boolean canRedo()
From source file:org.pmedv.blackboard.commands.UndoCommand.java
@Override public void execute(ActionEvent e) { ApplicationContext ctx = AppContext.getContext(); ApplicationWindow win = ctx.getBean(ApplicationWindow.class); BoardEditor editor = EditorUtils.getCurrentActiveEditor(); UndoManager undoManager = editor.getUndoManager(); try {//from w ww .j av a 2 s .c om try { undoManager.undo(); } catch (CannotUndoException c) { JOptionPane.showMessageDialog(win, resources.getResourceByKey("msg.cantundo"), resources.getResourceByKey("msg.error"), JOptionPane.ERROR_MESSAGE); } } catch (CannotUndoException e1) { log.warn("Cannot undo."); e1.printStackTrace(); } ctx.getBean(RedoCommand.class).setEnabled(undoManager.canRedo()); ctx.getBean(UndoCommand.class).setEnabled(undoManager.canUndo()); }