diff --git a/src/main/java/org/jabref/gui/undo/CountingUndoManager.java b/src/main/java/org/jabref/gui/undo/CountingUndoManager.java index 1e4eaa8981d..6a0c4a557e5 100644 --- a/src/main/java/org/jabref/gui/undo/CountingUndoManager.java +++ b/src/main/java/org/jabref/gui/undo/CountingUndoManager.java @@ -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); @@ -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() {