List of usage examples for javax.swing.undo UndoManager undo
public void undo() throws CannotUndoException
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 {//w w w. j a v a 2s. c o m 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()); }