diff --git a/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java b/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java index 8bd97ec3b02..30ae74eff49 100644 --- a/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java +++ b/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java @@ -33,6 +33,8 @@ import javafx.util.Callback; import javafx.util.StringConverter; +import org.jabref.gui.util.DefaultTaskExecutor; + import org.controlsfx.control.textfield.AutoCompletionBinding; /** @@ -51,7 +53,7 @@ public class AutoCompletionTextInputBinding extends AutoCompletionBinding private AutoCompletionStrategy inputAnalyzer; private final ChangeListener textChangeListener = (obs, oldText, newText) -> { if (getCompletionTarget().isFocused()) { - setUserInputText(newText); + DefaultTaskExecutor.runInJavaFXThread(() -> setUserInputText(newText)); //we need to wrap this as it is called from a non fx thread in autosave } }; private boolean showOnFocus; @@ -73,9 +75,9 @@ private AutoCompletionTextInputBinding(final TextInputControl textInputControl, Callback> suggestionProvider) { this(textInputControl, - suggestionProvider, - AutoCompletionTextInputBinding.defaultStringConverter(), - new ReplaceStrategy()); + suggestionProvider, + AutoCompletionTextInputBinding.defaultStringConverter(), + new ReplaceStrategy()); } private AutoCompletionTextInputBinding(final TextInputControl textInputControl, @@ -99,6 +101,7 @@ private AutoCompletionTextInputBinding(final TextInputControl textInputControl, private static StringConverter defaultStringConverter() { return new StringConverter() { + @Override public String toString(T t) { return t == null ? null : t.toString();