Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix field formatter save actions throwing exception on autosave #5010

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import javafx.util.Callback;
import javafx.util.StringConverter;

import org.jabref.gui.util.DefaultTaskExecutor;

import org.controlsfx.control.textfield.AutoCompletionBinding;

/**
Expand All @@ -51,7 +53,7 @@ public class AutoCompletionTextInputBinding<T> extends AutoCompletionBinding<T>
private AutoCompletionStrategy inputAnalyzer;
private final ChangeListener<String> 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;
Expand All @@ -73,9 +75,9 @@ private AutoCompletionTextInputBinding(final TextInputControl textInputControl,
Callback<ISuggestionRequest, Collection<T>> suggestionProvider) {

this(textInputControl,
suggestionProvider,
AutoCompletionTextInputBinding.defaultStringConverter(),
new ReplaceStrategy());
suggestionProvider,
AutoCompletionTextInputBinding.defaultStringConverter(),
new ReplaceStrategy());
}

private AutoCompletionTextInputBinding(final TextInputControl textInputControl,
Expand All @@ -99,6 +101,7 @@ private AutoCompletionTextInputBinding(final TextInputControl textInputControl,

private static <T> StringConverter<T> defaultStringConverter() {
return new StringConverter<T>() {

@Override
public String toString(T t) {
return t == null ? null : t.toString();
Expand Down