Skip to content

Commit

Permalink
fix not on fx thread (JabRef#11974)
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr authored and ExrosZ-Alt committed Oct 17, 2024
1 parent e12b61b commit f79614d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/jabref/gui/undo/CountingUndoManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;

import org.jabref.gui.util.UiTaskExecutor;

public class CountingUndoManager extends UndoManager {

private int unchangedPoint;

/**
* Indicates the number of edits aka balance of edits on the stack +1 when an edit is added/redone and -1 when an edit is undoed.
* */
*/
private final IntegerProperty balanceProperty = new SimpleIntegerProperty(0);
private final BooleanProperty undoableProperty = new SimpleBooleanProperty(false);
private final BooleanProperty redoableProperty = new SimpleBooleanProperty(false);
Expand Down Expand Up @@ -67,11 +69,11 @@ private void decrementBalance() {
}

private void updateUndoableStatus() {
undoableProperty.setValue(canUndo());
UiTaskExecutor.runInJavaFXThread(() -> undoableProperty.setValue(canUndo()));
}

private void updateRedoableStatus() {
redoableProperty.setValue(canRedo());
UiTaskExecutor.runInJavaFXThread(() -> redoableProperty.setValue(canRedo()));
}

public ReadOnlyBooleanProperty getUndoableProperty() {
Expand Down

0 comments on commit f79614d

Please sign in to comment.