Skip to content

Commit

Permalink
Cleaned up undo manager for context editor. Logically this should work
Browse files Browse the repository at this point in the history
now but the table is one bunch of crap…so it does not react to context
changes. Because there are that much issues open regarding the context
editor and my decision of a redesign I will tackle it all together in
time. See #33, #42, #43, #116
  • Loading branch information
blu2lz committed Jan 24, 2014
1 parent 6cca9c3 commit f95fe61
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,28 @@ public ContextEditorUndoManager(Conf conf) {
* UndoableEdit.
*/
public void makeRedoable() {
final Conf curConf = conf.copy(conf);
final Conf lastConf = conf.copy(conf.lastConf);
if (!undoRedoInProgress) {
UndoableEdit undoableEdit = new AbstractUndoableEdit() {
private static final long serialVersionUID = -4461145596327911434L;
final Conf curConf = conf.copy(conf);
final Conf lastConf = conf.copy(conf.lastConf);

// Method that is called when we must redo the undone action
public void redo() throws javax.swing.undo.CannotRedoException {
super.redo();
conf.context = curConf.context;
undoRedoInProgress = true;
conf.newContext(conf.context);
conf.newContext(curConf.context);
undoRedoInProgress = false;
// change undo/redo button state
MainToolbar.getRedoButton().setEnabled(canRedo());
MainToolbar.getUndoButton().setEnabled(canUndo());
}

public void undo() throws javax.swing.undo.CannotUndoException {
super.undo();
conf.context = lastConf.context;

undoRedoInProgress = true;
conf.newContext(conf.context);
conf.newContext(lastConf.context);
undoRedoInProgress = false;
// change undo/redo button state
MainToolbar.getRedoButton().setEnabled(canRedo());
MainToolbar.getUndoButton().setEnabled(canUndo());
}
Expand All @@ -67,7 +65,5 @@ public void undo() throws javax.swing.undo.CannotUndoException {
MainToolbar.getRedoButton().setEnabled(canRedo());
MainToolbar.getUndoButton().setEnabled(canUndo());
}
conf.lastConf = conf.copy(conf);

}
}

0 comments on commit f95fe61

Please sign in to comment.