Skip to content

Commit

Permalink
fix not on fx thread
Browse files Browse the repository at this point in the history
Fixes #11966
  • Loading branch information
Siedlerchr committed Oct 15, 2024
1 parent 0e08b24 commit 928f841
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 928f841

Please sign in to comment.