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

Add restart warning for auto complete settings #6564

Closed
wants to merge 5 commits 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 @@ -12,6 +12,7 @@
import org.jabref.gui.autocompleter.AutoCompleteFirstNameMode;
import org.jabref.gui.autocompleter.AutoCompletePreferences;
import org.jabref.gui.entryeditor.EntryEditorPreferences;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.preferences.PreferencesService;

Expand All @@ -37,6 +38,8 @@ public class EntryEditorTabViewModel implements PreferenceTabViewModel {
private final EntryEditorPreferences initialEntryEditorPreferences;
private final AutoCompletePreferences initialAutoCompletePreferences;

private List<String> restartWarnings = new ArrayList<>();

public EntryEditorTabViewModel(DialogService dialogService, PreferencesService preferencesService) {
this.dialogService = dialogService;
this.preferencesService = preferencesService;
Expand Down Expand Up @@ -107,6 +110,13 @@ public void storeSettings() {
firstNameMode = AutoCompleteFirstNameMode.ONLY_FULL;
}

if (initialAutoCompletePreferences.shouldAutoComplete() != enableAutoCompleteProperty.getValue()) {
if (enableAutoCompleteProperty.getValue()) {
restartWarnings.add(Localization.lang("Auto complete enable."));
newtypes9 marked this conversation as resolved.
Show resolved Hide resolved
} else {
restartWarnings.add(Localization.lang("Auto complete disable."));
newtypes9 marked this conversation as resolved.
Show resolved Hide resolved
}
}
preferencesService.storeAutoCompletePreferences(new AutoCompletePreferences(
enableAutoCompleteProperty.getValue(),
firstNameMode,
Expand All @@ -122,7 +132,7 @@ public boolean validateSettings() {

@Override
public List<String> getRestartWarnings() {
return new ArrayList<>();
return restartWarnings;
}

public BooleanProperty openOnNewEntryProperty() {
Expand Down