// Update Undo/Redo Button State based on Undo Manager protected void updateHistoryButtons() { // The View Argument Defines the Context editor.mainToolBar.setActionEnabled( MainActions.ACTION_UNDO, undoManager.canUndo(graph.getGraphLayoutCache())); editor.mainToolBar.setActionEnabled( MainActions.ACTION_REDO, undoManager.canRedo(graph.getGraphLayoutCache())); }
/** 重做上一步 */ public void redo() { if (undoManager == null) return; try { undoManager.redo(graph.getGraphLayoutCache()); } catch (Exception ex) { System.err.println(ex); } finally { updateHistoryButtons(); } }