Skip to content

Commit

Permalink
Disable fulltext search button when disabled in prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
calixtus committed Jan 3, 2023
1 parent 9b7df2c commit 0672bc4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.SetChangeListener;
import javafx.css.PseudoClass;
import javafx.event.Event;
import javafx.geometry.Insets;
Expand Down Expand Up @@ -65,6 +64,7 @@
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.SearchPreferences;

import com.tobiasdiez.easybind.EasyBind;
import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator;
import de.saxsys.mvvmfx.utils.validation.ValidationMessage;
import de.saxsys.mvvmfx.utils.validation.Validator;
Expand Down Expand Up @@ -222,13 +222,9 @@ private void initSearchModifierButtons() {
});

fulltextButton.setSelected(searchPreferences.isFulltext());
searchPreferences.getObservableSearchFlags().addListener((SetChangeListener<SearchRules.SearchFlags>) c -> {
fulltextButton.setManaged(searchPreferences.isFulltext());
});
fulltextButton.setManaged(searchPreferences.isFulltext());

fulltextButton.setTooltip(new Tooltip(Localization.lang("Fulltext search")));
initSearchModifierButton(fulltextButton);
EasyBind.subscribe(preferencesService.getFilePreferences().fulltextIndexLinkedFilesProperty(), value -> fulltextButton.setDisable(!value));
fulltextButton.setOnAction(event -> {
searchPreferences.setSearchFlag(SearchRules.SearchFlags.FULLTEXT, fulltextButton.isSelected());
performSearch();
Expand Down

0 comments on commit 0672bc4

Please sign in to comment.