Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into acm
Browse files Browse the repository at this point in the history
* upstream/master:
  Fix NPE in search bar (#3497)
  • Loading branch information
Siedlerchr committed Dec 9, 2017
2 parents 640fd3f + c51ecbe commit 66db288
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.gui.search;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
Expand Down Expand Up @@ -59,11 +58,6 @@

public class GlobalSearchBar extends JPanel {

private static final Color NEUTRAL_COLOR = Color.WHITE;
private static final Color NO_RESULTS_COLOR = new Color(232, 202, 202);
private static final Color RESULTS_FOUND_COLOR = new Color(217, 232, 202);
private static final Color ADVANCED_SEARCH_COLOR = new Color(102, 255, 255);

private static final PseudoClass CLASS_NO_RESULTS = PseudoClass.getPseudoClass("emptyResult");
private static final PseudoClass CLASS_RESULTS_FOUND = PseudoClass.getPseudoClass("emptyResult");

Expand Down Expand Up @@ -192,10 +186,10 @@ public void actionPerformed(ActionEvent e) {

container = OS.LINUX ? new CustomJFXPanel() : new JFXPanel();
DefaultTaskExecutor.runInJavaFXThread(() -> {
container.setScene(new Scene(searchField));
container.getScene().getStylesheets().add(GlobalSearchBar.class.getResource("../Main.css").toExternalForm());
Scene scene = new Scene(searchField);
scene.getStylesheets().add(GlobalSearchBar.class.getResource("../Main.css").toExternalForm());
container.setScene(scene);
container.addKeyListener(new SearchKeyAdapter());

});

setLayout(new FlowLayout(FlowLayout.RIGHT));
Expand Down Expand Up @@ -247,7 +241,7 @@ private void openLocalFindingsInExternalPanel() {

SearchResultFrame searchDialog = new SearchResultFrame(currentBasePanel.frame(),
Localization.lang("Search results in library %0 for %1", currentBasePanel.getBibDatabaseContext()
.getDatabaseFile().map(File::getName).orElse(GUIGlobals.UNTITLED_TITLE),
.getDatabaseFile().map(File::getName).orElse(GUIGlobals.UNTITLED_TITLE),
this.getSearchQuery().localize()),
getSearchQuery(), false);
List<BibEntry> entries = currentBasePanel.getDatabase().getEntries().stream()
Expand Down Expand Up @@ -369,7 +363,6 @@ public void setAutoCompleter(AutoCompleteSuggestionProvider<Author> searchComple
searchCompleter,
new PersonNameStringConverter(false, false, AutoCompleteFirstNameMode.BOTH),
new AppendPersonNamesStrategy());

}

public SearchQueryHighlightObservable getSearchQueryHighlightObservable() {
Expand Down Expand Up @@ -415,7 +408,6 @@ public void setSearchTerm(String searchTerm) {

setDontSelectSearchBar();
DefaultTaskExecutor.runInJavaFXThread(() -> searchField.setText(searchTerm));

}

public void setDontSelectSearchBar() {
Expand Down

0 comments on commit 66db288

Please sign in to comment.