From 22d135d2cd1866be858b0c947ba6f7336ec9eb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=A9ndez?= Date: Sat, 18 May 2019 19:03:53 +0200 Subject: [PATCH 01/10] Fix command line help text (#4979) * Fix command line help text * Replace magic number with constant --- CHANGELOG.md | 4 +- src/main/java/org/jabref/cli/JabRefCLI.java | 118 +++++++++---------- src/main/resources/l10n/JabRef_en.properties | 21 ++-- 3 files changed, 67 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 635a898e83a..5254da0d2e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +56,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added the ability to execute default action in dialog by using with Ctrl + Enter combination [#4496](https://github.com/JabRef/jabref/issues/4496) - We grouped and reordered the Main Menu (File, Edit, Library, Quality, Tools, and View tabs & icons). [#4666](https://github.com/JabRef/jabref/issues/4666) [#4667](https://github.com/JabRef/jabref/issues/4667) [#4668](https://github.com/JabRef/jabref/issues/4668) [#4669](https://github.com/JabRef/jabref/issues/4669) [#4670](https://github.com/JabRef/jabref/issues/4670) [#4671](https://github.com/JabRef/jabref/issues/4671) [#4672](https://github.com/JabRef/jabref/issues/4672) [#4673](https://github.com/JabRef/jabref/issues/4673) - We added additional modifiers (capitalize, titlecase and sentencecase) to the Bibtex key generator. [#1506](https://github.com/JabRef/jabref/issues/1506) -- We grouped the toolbar icons and changed the Open Library and Copy icons. [#4584](https://github.com/JabRef/jabref/issues/4584) +- We grouped the toolbar icons and changed the Open Library and Copy icons. [#4584](https://github.com/JabRef/jabref/issues/4584) - We added a browse button next to the path text field for aux-based groups. [#4586](https://github.com/JabRef/jabref/issues/4586) - We changed the title of Group Dialog to "Add subgroup" from "Edit group" when we select Add subgroup option. - We enable import button only if entries are selected. [#4755](https://github.com/JabRef/jabref/issues/4755) @@ -115,6 +115,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where the RIS import would overwite the article date with the value of the acessed date [#4816](https://github.com/JabRef/jabref/issues/4816) - We fixed an issue where an NullPointer exception was thrown when a referenced entry in an Open/Libre Office document was no longer present in the library. Now an error message with the reference marker of the missing entry is shown. [#4932](https://github.com/JabRef/jabref/issues/4932) - We fixed an issue where a database exception related to a missing timezone was too big. [#4827](https://github.com/JabRef/jabref/issues/4827) +- We fixed an issue where the command line help text had several errors, and arguments and descriptions have been rewritten to simplify and detail them better. [#4932](https://github.com/JabRef/jabref/issues/2016) + ### Removed - The feature to "mark entries" was removed and merged with the groups functionality. For migration, a group is created for every value of the `__markedentry` field and the entry is added to this group. diff --git a/src/main/java/org/jabref/cli/JabRefCLI.java b/src/main/java/org/jabref/cli/JabRefCLI.java index 83459c97e01..dc2edfe8984 100644 --- a/src/main/java/org/jabref/cli/JabRefCLI.java +++ b/src/main/java/org/jabref/cli/JabRefCLI.java @@ -4,7 +4,6 @@ import org.jabref.Globals; import org.jabref.logic.l10n.Localization; -import org.jabref.model.database.BibDatabaseMode; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.DefaultParser; @@ -17,27 +16,25 @@ public class JabRefCLI { + private static final int WIDTH = 100; // Number of characters per line private static final Logger LOGGER = LoggerFactory.getLogger(JabRefCLI.class); private final CommandLine cl; private List leftOver; public JabRefCLI(String[] args) { - Options options = getOptions(); - try { this.cl = new DefaultParser().parse(options, args); this.leftOver = cl.getArgList(); } catch (ParseException e) { LOGGER.warn("Problem parsing arguments", e); - this.printUsage(); throw new RuntimeException(); } } public static String getExportMatchesSyntax() { - return String.format("[%s]searchTerm,outputFile: %s[,%s]", + return String.format("[%s]searchTerm,outputFile:%s[,%s]", Localization.lang("field"), Localization.lang("file"), Localization.lang("exportFormat")); @@ -147,104 +144,97 @@ public String getExportMatches() { return cl.getOptionValue("exportMatches"); } - public boolean isGenerateBibtexKeys() { return cl.hasOption("generateBibtexKeys"); } + public boolean isGenerateBibtexKeys() { + return cl.hasOption("generateBibtexKeys"); + } - public boolean isAutomaticallySetFileLinks() { return cl.hasOption("automaticallySetFileLinks"); } + public boolean isAutomaticallySetFileLinks() { + return cl.hasOption("automaticallySetFileLinks"); + } private Options getOptions() { Options options = new Options(); // boolean options - options.addOption("v", "version", false, Localization.lang("Display version")); - options.addOption("n", "nogui", false, Localization.lang("No GUI. Only process command line options.")); options.addOption("h", "help", false, Localization.lang("Display help on command line options")); + options.addOption("n", "nogui", false, Localization.lang("No GUI. Only process command line options")); + options.addOption("asfl", "automaticallySetFileLinks", false, Localization.lang("Automatically set file links")); + options.addOption("g", "generateBibtexKeys", false, Localization.lang("Regenerate all keys for the entries in a BibTeX file")); options.addOption("b", "blank", false, Localization.lang("Do not open any files at startup")); + options.addOption("v", "version", false, Localization.lang("Display version")); options.addOption(null, "debug", false, Localization.lang("Show debug level messages")); // The "-console" option is handled by the install4j launcher - options.addOption(null, "console", false, Localization.lang("Show console output (only necessary when the launcher is used)")); + options.addOption(null, "console", false, Localization.lang("Show console output (only when the launcher is used)")); options.addOption(Option.builder("i"). longOpt("import"). - desc(String.format("%s: %s[,import format]", Localization.lang("Import file"), - Localization.lang("filename"))). + desc(String.format("%s: '%s'", Localization.lang("Import file"), "-i library.bib")). hasArg(). - argName("FILE").build()); + argName("FILE[,FORMAT]"). + build()); - options.addOption( - Option.builder("ib") - .longOpt("importBibtex") - .desc(String.format("%s: %s[,importBibtex bibtexString]", Localization.lang("Import") + " " + BibDatabaseMode.BIBTEX.getFormattedName(), Localization.lang("filename"))) - .hasArg() - .argName("FILE") - .build()); + options.addOption(Option.builder(). + longOpt("importToOpen"). + desc(Localization.lang("Same as --import, but will be imported to the opened tab")). + hasArg(). + argName("FILE[,FORMAT]"). + build()); - options.addOption(Option.builder("o"). - longOpt("output"). - desc(String.format("%s: %s[,export format]", Localization.lang("Output or export file"), - Localization.lang("filename"))). + options.addOption(Option.builder("ib"). + longOpt("importBibtex"). + desc(String.format("%s: '%s'", Localization.lang("Import BibTeX"), "-ib @article{entry}")). hasArg(). - argName("FILE"). + argName("BIBTEXT_STRING"). build()); - options.addOption(Option.builder("x"). - longOpt("prexp"). - desc(Localization.lang("Export preferences to file")). + options.addOption(Option.builder("o"). + longOpt("output"). + desc(String.format("%s: '%s'", Localization.lang("Export an input to a file"), "-i db.bib -o db.htm,html")). hasArg(). - argName("FILE"). + argName("FILE[,FORMAT]"). build()); - options.addOption(Option.builder("p"). - longOpt("primp"). - desc(Localization.lang("Import preferences from file")). + options.addOption(Option.builder("m"). + longOpt("exportMatches"). + desc(String.format("%s: '%s'", Localization.lang("Matching"), "-i db.bib -m author=Newton,search.htm,html")). hasArg(). - argName("FILE"). + argName("QUERY,FILE[,FORMAT]"). build()); - options.addOption(Option.builder("d"). - longOpt("prdef"). - desc(Localization.lang("Reset preferences (key1,key2,... or 'all')")). + + options.addOption(Option.builder("f"). + longOpt("fetch"). + desc(String.format("%s: '%s'", Localization.lang("Run fetcher"), "-f Medline/PubMed:cancer")). hasArg(). - argName("FILE"). + argName("FETCHER:QUERY"). build()); options.addOption(Option.builder("a"). longOpt("aux"). - desc(String.format("%s: %s[.aux],%s[.bib]", Localization.lang("Sublibrary from AUX"), - Localization.lang("file"), - Localization.lang("new"))). + desc(String.format("%s: '%s'", Localization.lang("Sublibrary from AUX to BibTeX"), "-a thesis.aux,new.bib")). hasArg(). - argName("FILE"). + argName("FILE[.aux],FILE[.bib] FILE"). build()); - options.addOption(Option.builder(). - longOpt("importToOpen"). - desc(Localization.lang("Import to open tab")). + options.addOption(Option.builder("x"). + longOpt("prexp"). + desc(String.format("%s: '%s'", Localization.lang("Export preferences to a file"), "-x prefs.xml")). hasArg(). - argName("FILE"). + argName("[FILE]"). build()); - options.addOption(Option.builder("f"). - longOpt("fetch"). - desc(Localization.lang("Run fetcher, e.g. \"--fetch=Medline:cancer\"")). + options.addOption(Option.builder("p"). + longOpt("primp"). + desc(String.format("%s: '%s'", Localization.lang("Import preferences from a file"), "-p prefs.xml")). hasArg(). - argName("FILE"). + argName("[FILE]"). build()); - options.addOption(Option.builder("m"). - longOpt("exportMatches"). - desc(JabRefCLI.getExportMatchesSyntax()). + options.addOption(Option.builder("d"). + longOpt("prdef"). + desc(String.format("%s: '%s'", Localization.lang("Reset preferences"), "-d mainFontSize,newline' or '-d all")). hasArg(). - argName("FILE"). - build()); - - options.addOption(Option.builder("g"). - longOpt("generateBibtexKeys"). - desc(Localization.lang("Regenerate all keys for the entries in a BibTeX file")) - .build()); - - options.addOption(Option.builder("asfl"). - longOpt("automaticallySetFileLinks"). - desc(Localization.lang("Automatically set file links")). + argName("KEY1[,KEY2][,KEYn] | all"). build()); return options; @@ -266,7 +256,7 @@ public void printUsage() { String footer = '\n' + importFormatsList + outFormatsList + "\nPlease report issues at https://github.com/JabRef/jabref/issues."; HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("jabref [OPTIONS] [BIBTEX_FILE]\n\nOptions:", header, getOptions(), footer, true); + formatter.printHelp(WIDTH, "jabref [OPTIONS] [BIBTEX_FILE]\n\nOptions:", header, getOptions(), footer, true); } private String getVersionInfo() { diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 418c62fa307..46610be5394 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -375,7 +375,6 @@ File\ directory\ is\ not\ set\ or\ does\ not\ exist\!=File directory is not set File\ exists=File exists File\ not\ found=File not found -filename=filename Files\ opened=Files opened @@ -470,8 +469,6 @@ Import\ preferences\ from\ file=Import preferences from file Import\ strings=Import strings -Import\ to\ open\ tab=Import to open tab - Import\ word\ selector\ definitions=Import word selector definitions Imported\ entries=Imported entries @@ -573,7 +570,6 @@ Name\ formatter=Name formatter Natbib\ style=Natbib style nested\ AUX\ files=nested AUX files -new=new New\ BibTeX\ sublibrary=New BibTeX sublibrary New\ library\ created.=New library created. @@ -590,7 +586,7 @@ no\ library\ generated=no library generated No\ entries\ found.\ Please\ make\ sure\ you\ are\ using\ the\ correct\ import\ filter.=No entries found. Please make sure you are using the correct import filter. No\ files\ found.=No files found. -No\ GUI.\ Only\ process\ command\ line\ options.=No GUI. Only process command line options. +No\ GUI.\ Only\ process\ command\ line\ options=No GUI. Only process command line options No\ journal\ names\ could\ be\ abbreviated.=No journal names could be abbreviated. @@ -641,8 +637,6 @@ Options=Options or=or -Output\ or\ export\ file=Output or export file - Override\ default\ file\ directories=Override default file directories Overwrite=Overwrite @@ -886,7 +880,7 @@ Statically\ group\ entries\ by\ manual\ assignment=Statically group entries by m Status=Status Strings\ for\ library=Strings for library -Sublibrary\ from\ AUX=Sublibrary from AUX +Sublibrary\ from\ AUX\ to\ BibTeX=Sublibrary from AUX to BibTeX Switches\ between\ full\ and\ abbreviated\ journal\ name\ if\ the\ journal\ name\ is\ known.=Switches between full and abbreviated journal name if the journal name is known. @@ -1041,7 +1035,7 @@ Unable\ to\ open\ link.=Unable to open link. MIME\ type=MIME type This\ feature\ lets\ new\ files\ be\ opened\ or\ imported\ into\ an\ already\ running\ instance\ of\ JabRef\ instead\ of\ opening\ a\ new\ instance.\ For\ instance,\ this\ is\ useful\ when\ you\ open\ a\ file\ in\ JabRef\ from\ your\ web\ browser.\ Note\ that\ this\ will\ prevent\ you\ from\ running\ more\ than\ one\ instance\ of\ JabRef\ at\ a\ time.=This feature lets new files be opened or imported into an already running instance of JabRef instead of opening a new instance. For instance, this is useful when you open a file in JabRef from your web browser. Note that this will prevent you from running more than one instance of JabRef at a time. -Run\ fetcher,\ e.g.\ "--fetch\=Medline\:cancer"=Run fetcher, e.g. "--fetch=Medline:cancer" +Run\ fetcher=Run fetcher Reset=Reset @@ -1223,7 +1217,6 @@ Resetting\ preference\ key\ '%0'=Resetting preference key '%0' Unknown\ preference\ key\ '%0'=Unknown preference key '%0' Unable\ to\ clear\ preferences.=Unable to clear preferences. -Reset\ preferences\ (key1,key2,...\ or\ 'all')=Reset preferences (key1,key2,... or 'all') Find\ unlinked\ files=Find unlinked files Unselect\ all=Unselect all Expand\ all=Expand all @@ -1907,7 +1900,7 @@ Could\ not\ copy\ file=Could not copy file Copied\ %0\ files\ of\ %1\ sucessfully\ to\ %2=Copied %0 files of %1 sucessfully to %2 Rename\ failed=Rename failed JabRef\ cannot\ access\ the\ file\ because\ it\ is\ being\ used\ by\ another\ process.=JabRef cannot access the file because it is being used by another process. -Show\ console\ output\ (only\ necessary\ when\ the\ launcher\ is\ used)=Show console output (only necessary when the launcher is used) +Show\ console\ output\ (only\ when\ the\ launcher\ is\ used)=Show console output (only when the launcher is used) Remove\ line\ breaks=Remove line breaks Removes\ all\ line\ breaks\ in\ the\ field\ content.=Removes all line breaks in the field content. @@ -2093,3 +2086,9 @@ Rename\ file\ to\ defined\ pattern=Rename file to defined pattern App\ settings=App settings +Export\ an\ input\ to\ a\ file=Export an input to a file +Export\ preferences\ to\ a\ file=Export preferences to a file +Import\ BibTeX=Import BibTeX +Import\ preferences\ from\ a\ file=Import preferences from a file +Matching=Matching +Same\ as\ --import,\ but\ will\ be\ imported\ to\ the\ opened\ tab=Same as --import, but will be imported to the opened tab From accdef3f5a54a6e525aa73f01ee6bbe83c5961de Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sat, 18 May 2019 20:15:33 +0200 Subject: [PATCH 02/10] Extended Hints - Alternative to #4971 (#4975) * Added Preference "Show helpful Tooltips" to GeneralTab and a check for in the SearchBar * l10n * changelog * Reword Identifier and Label * Refactor Hint Message in GlobalSearchBar * Added switchable visibility of hint for GlobalSearchBar * Add switchable visibility of remote connection text * Add Issue Number in Changelog * Fixes Typo * Fix Undone Change to updateAfterPreferenceChanges() --- CHANGELOG.md | 1 + .../jabref/gui/preferences/AdvancedTab.java | 12 ++--- .../jabref/gui/preferences/GeneralTab.java | 6 +++ .../gui/preferences/PreferencesDialog.java | 1 + .../jabref/gui/search/GlobalSearchBar.java | 45 ++++++++++++++++--- ...tainsAndRegexBasedSearchRuleDescriber.java | 5 --- .../jabref/preferences/JabRefPreferences.java | 2 + src/main/resources/l10n/JabRef_en.properties | 2 + 8 files changed, 59 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5254da0d2e5..73b7b325491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added an option in the settings to set the default action in JabRef when right clicking on any entry in any database and selecting "Open folder". [#4763](https://github.com/JabRef/jabref/issues/4763) - The Medline fetcher now normalizes the author names according to the BibTeX-Standard [#4345](https://github.com/JabRef/jabref/issues/4345) - We added an option on the Linked File Viewer to rename the attached file of an entry directly on the JabRef. [#4844](https://github.com/JabRef/jabref/issues/4844) +- We added an option in the preference dialog box that allows user to enable helpful tooltips.[#3599](https://github.com/JabRef/jabref/issues/3599) ### Fixed diff --git a/src/main/java/org/jabref/gui/preferences/AdvancedTab.java b/src/main/java/org/jabref/gui/preferences/AdvancedTab.java index 829b1a8e97e..b1889a16786 100644 --- a/src/main/java/org/jabref/gui/preferences/AdvancedTab.java +++ b/src/main/java/org/jabref/gui/preferences/AdvancedTab.java @@ -56,11 +56,13 @@ public AdvancedTab(DialogService dialogService, JabRefPreferences prefs) { Label remoteOperation = new Label(Localization.lang("Remote operation")); remoteOperation.getStyleClass().add("sectionHeader"); builder.add(remoteOperation, 2, 1); - Text textRemote = new Text(Localization.lang("This feature lets new files be opened or imported into an already running instance of JabRef " + - "instead of opening a new instance. For instance, this is useful when you open a file in JabRef " + - "from your web browser. Note that this will prevent you from running more than one instance of JabRef at a time.")); - textRemote.setWrappingWidth(600); - builder.add(textRemote, 2, 4); + if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS)) { + Text textRemote = new Text(Localization.lang("This feature lets new files be opened or imported into an already running instance of JabRef " + + "instead of opening a new instance. For instance, this is useful when you open a file in JabRef " + + "from your web browser. Note that this will prevent you from running more than one instance of JabRef at a time.")); + textRemote.setWrappingWidth(600); + builder.add(textRemote, 2, 4); + } HBox p = new HBox(); p.setSpacing(8); diff --git a/src/main/java/org/jabref/gui/preferences/GeneralTab.java b/src/main/java/org/jabref/gui/preferences/GeneralTab.java index d39715dd410..4c76449acdb 100644 --- a/src/main/java/org/jabref/gui/preferences/GeneralTab.java +++ b/src/main/java/org/jabref/gui/preferences/GeneralTab.java @@ -40,6 +40,7 @@ class GeneralTab extends Pane implements PrefsTab { private final CheckBox confirmDelete; private final CheckBox memoryStick; private final CheckBox inspectionWarnDupli; + private final CheckBox showAdvancedHints; private final CheckBox useTimeStamp; private final CheckBox updateTimeStamp; private final CheckBox overwriteTimeStamp; @@ -77,6 +78,7 @@ public GeneralTab(DialogService dialogService, JabRefPreferences prefs) { timeStampFormat = new TextField(); timeStampField = new TextField(); inspectionWarnDupli = new CheckBox(Localization.lang("Warn about unresolved duplicates when closing inspection window")); + showAdvancedHints = new CheckBox(Localization.lang("Show advanced hints (i.e. helpful tooltips, suggestions and explanation)")); shouldCollectTelemetry = new CheckBox(Localization.lang("Collect and share telemetry data to help improve JabRef.")); encodings = new ComboBox<>(FXCollections.observableArrayList(Encodings.ENCODINGS)); @@ -135,6 +137,8 @@ public GeneralTab(DialogService dialogService, JabRefPreferences prefs) { Label defaultBibliographyMode = new Label(Localization.lang("Default bibliography mode")); biblioBox.getChildren().addAll(defaultBibliographyMode, biblatexMode); builder.add(biblioBox, 1, 29); + + builder.add(showAdvancedHints,1,30); } @Override @@ -164,6 +168,7 @@ public void setValues() { } encodings.setValue(prefs.getDefaultEncoding()); languageSelection.setValue(prefs.getLanguage()); + showAdvancedHints.setSelected(prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS)); } @Override @@ -181,6 +186,7 @@ public void storeSettings() { + " rename or remove the jabref.xml file in the same folder as JabRef.")); } prefs.putBoolean(JabRefPreferences.MEMORY_STICK_MODE, memoryStick.isSelected()); + prefs.putBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS, showAdvancedHints.isSelected()); prefs.putBoolean(JabRefPreferences.CONFIRM_DELETE, confirmDelete.isSelected()); prefs.putBoolean(JabRefPreferences.WARN_ABOUT_DUPLICATES_IN_INSPECTION, inspectionWarnDupli.isSelected()); String owner = defOwnerField.getText().trim(); diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java index 7145caa3ed7..4814e1b4165 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.java @@ -246,6 +246,7 @@ private void storeAllSettings() { GUIGlobals.updateEntryEditorColors(); frame.setupAllTables(); + frame.getGlobalSearchBar().updateHintVisibility(); dialogService.notify(Localization.lang("Preferences recorded.")); } diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 8426b3fb290..60a46a783ca 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -1,6 +1,7 @@ package org.jabref.gui.search; import java.lang.reflect.Field; +import java.util.List; import java.util.Objects; import java.util.Optional; @@ -27,6 +28,7 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.util.Duration; @@ -43,10 +45,12 @@ import org.jabref.gui.keyboard.KeyBindingRepository; import org.jabref.gui.maintable.MainTable; import org.jabref.gui.util.DefaultTaskExecutor; +import org.jabref.gui.util.TooltipTextUtil; import org.jabref.logic.l10n.Localization; import org.jabref.logic.search.SearchQuery; import org.jabref.logic.search.SearchQueryHighlightObservable; import org.jabref.model.entry.Author; +import org.jabref.preferences.JabRefPreferences; import org.jabref.preferences.SearchPreferences; import impl.org.controlsfx.skin.AutoCompletePopup; @@ -72,6 +76,7 @@ public class GlobalSearchBar extends HBox { private final ToggleButton regularExp; private final Button searchModeButton = new Button(); private final Label currentResults = new Label(""); + private final Tooltip tooltip = new Tooltip(); private final SearchQueryHighlightObservable searchQueryHighlightObservable = new SearchQueryHighlightObservable(); private SearchWorker searchWorker; @@ -86,6 +91,11 @@ public GlobalSearchBar(JabRefFrame frame) { // fits the standard "found x entries"-message thus hinders the searchbar to jump around while searching if the frame width is too small currentResults.setPrefWidth(150); + tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + tooltip.setMaxHeight(10); + searchField.setTooltip(null); + updateHintVisibility(); + KeyBindingRepository keyBindingRepository = Globals.getKeyPrefs(); searchField.addEventFilter(KeyEvent.KEY_PRESSED, event -> { Optional keyBinding = keyBindingRepository.mapToKeyBinding(event); @@ -188,6 +198,7 @@ public void focus() { private void clearSearch() { currentResults.setText(""); searchField.setText(""); + setHintTooltip(null); searchQueryHighlightObservable.reset(); Globals.stateManager.clearSearchQuery(); @@ -284,11 +295,35 @@ public void updateResults(int matched, TextFlow description, boolean grammarBase // TODO: switch Icon color //searchIcon.setIcon(IconTheme.JabRefIcon.SEARCH.getIcon()); } - Tooltip tooltip = new Tooltip(); - tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - tooltip.setGraphic(description); - tooltip.setMaxHeight(10); - searchField.setTooltip(tooltip); + + setHintTooltip(description); + } + + private void setHintTooltip(TextFlow description) { + if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS)) { + String genericDescription = Localization.lang("Hint: To search specific fields only, enter for example:

author=smith and title=electrical"); + genericDescription = genericDescription.replace("

", "\n"); + List genericDescriptionTexts = TooltipTextUtil.formatToTexts(genericDescription, new TooltipTextUtil.TextReplacement("author=smith and title=electrical", "author=smith and title=electrical", TooltipTextUtil.TextType.MONOSPACED)); + + if (description != null) { + description.getChildren().add(new Text("\n\n")); + description.getChildren().addAll(genericDescriptionTexts); + tooltip.setGraphic(description); + } else { + TextFlow emptyHintTooltip = new TextFlow(); + emptyHintTooltip.getChildren().setAll(genericDescriptionTexts); + tooltip.setGraphic(emptyHintTooltip); + } + } + } + + public void updateHintVisibility() { + if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS)) { + searchField.setTooltip(tooltip); + } else { + searchField.setTooltip(null); + } + setHintTooltip(null); } public void setSearchTerm(String searchTerm) { diff --git a/src/main/java/org/jabref/gui/search/rules/describer/ContainsAndRegexBasedSearchRuleDescriber.java b/src/main/java/org/jabref/gui/search/rules/describer/ContainsAndRegexBasedSearchRuleDescriber.java index ab9503659fb..4ff85ca09ee 100644 --- a/src/main/java/org/jabref/gui/search/rules/describer/ContainsAndRegexBasedSearchRuleDescriber.java +++ b/src/main/java/org/jabref/gui/search/rules/describer/ContainsAndRegexBasedSearchRuleDescriber.java @@ -39,12 +39,7 @@ public TextFlow getDescription() { } } - String genericDescription = "\n\n" + Localization.lang("Hint: To search specific fields only, enter for example:

author=smith and title=electrical"); - genericDescription = genericDescription.replace("

", "\n"); - List genericDescriptionTexts = TooltipTextUtil.formatToTexts(genericDescription, new TooltipTextUtil.TextReplacement("author=smith and title=electrical", "author=smith and title=electrical", TooltipTextUtil.TextType.MONOSPACED)); textList.add(getCaseSensitiveDescription()); - textList.addAll(genericDescriptionTexts); - TextFlow searchDescription = new TextFlow(); searchDescription.getChildren().setAll(textList); return searchDescription; diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index 6e41ae34352..8ea32b20878 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -224,6 +224,7 @@ public class JabRefPreferences implements PreferencesService { public static final String RECENT_DATABASES = "recentDatabases"; public static final String RENAME_ON_MOVE_FILE_TO_FILE_DIR = "renameOnMoveFileToFileDir"; public static final String MEMORY_STICK_MODE = "memoryStickMode"; + public static final String SHOW_ADVANCED_HINTS = "showAdvancedHints"; public static final String DEFAULT_OWNER = "defaultOwner"; public static final String DEFAULT_ENCODING = "defaultEncoding"; public static final String TOOLBAR_VISIBLE = "toolbarVisible"; @@ -590,6 +591,7 @@ private JabRefPreferences() { defaults.put(DEFAULT_ENCODING, StandardCharsets.UTF_8.name()); defaults.put(DEFAULT_OWNER, System.getProperty("user.name")); defaults.put(MEMORY_STICK_MODE, Boolean.FALSE); + defaults.put(SHOW_ADVANCED_HINTS, Boolean.TRUE); defaults.put(RENAME_ON_MOVE_FILE_TO_FILE_DIR, Boolean.TRUE); defaults.put(FONT_STYLE, Font.PLAIN); diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 46610be5394..58822acd1ce 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -530,6 +530,8 @@ Link=Link Listen\ for\ remote\ operation\ on\ port=Listen for remote operation on port Load\ and\ Save\ preferences\ from/to\ jabref.xml\ on\ start-up\ (memory\ stick\ mode)=Load and Save preferences from/to jabref.xml on start-up (memory stick mode) +Show\ advanced\ hints\ (i.e.\ helpful\ tooltips,\ suggestions\ and\ explanation)=Show advanced hints (i.e. helpful tooltips, suggestions and explanation) + Main\ file\ directory=Main file directory Manage\ custom\ exports=Manage custom exports From 5c2e5b1a7f8a76c86b86ee7fb0abd519200c5f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=A9ndez?= Date: Sun, 19 May 2019 21:22:14 +0200 Subject: [PATCH 03/10] Resize different fonts changing entry type (#4980) * Resize different fonts changing entry type * Update CHANGELOG * Update for using relative sizes --- CHANGELOG.md | 1 + .../java/org/jabref/gui/entryeditor/EntryEditor.css | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73b7b325491..5b2f1b66664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,6 +117,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where an NullPointer exception was thrown when a referenced entry in an Open/Libre Office document was no longer present in the library. Now an error message with the reference marker of the missing entry is shown. [#4932](https://github.com/JabRef/jabref/issues/4932) - We fixed an issue where a database exception related to a missing timezone was too big. [#4827](https://github.com/JabRef/jabref/issues/4827) - We fixed an issue where the command line help text had several errors, and arguments and descriptions have been rewritten to simplify and detail them better. [#4932](https://github.com/JabRef/jabref/issues/2016) +- We fixed an issue where the same menu for changing entry type had two different sizes and weights. [#4977](https://github.com/JabRef/jabref/issues/4977) ### Removed diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css index 313583ed222..1a1be9d2870 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.css @@ -31,6 +31,16 @@ -fx-background-color: -jr-icon-background-active; } +#typeLabel .context-menu { + -fx-font-size: 0.92em; + -fx-font-weight: normal; +} + +#typeLabel .tooltip { + -fx-font-size: 1em; + -fx-font-weight: normal; +} + .icon-button.narrow { -fx-padding: 0.1em; } From 21b13f3f20fb8fb8006e068aa2e637e19ff1cc85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 20 May 2019 08:23:20 +0200 Subject: [PATCH 04/10] Bump tika-core from 1.20 to 1.21 (#4984) Bumps [tika-core](https://github.com/apache/tika) from 1.20 to 1.21. - [Release notes](https://github.com/apache/tika/releases) - [Changelog](https://github.com/apache/tika/blob/master/CHANGES.txt) - [Commits](https://github.com/apache/tika/compare/1.20...1.21) Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fed3e3894da..43c087f3fb2 100644 --- a/build.gradle +++ b/build.gradle @@ -94,7 +94,7 @@ dependencies { compile 'org.apache.pdfbox:fontbox:2.0.15' compile 'org.apache.pdfbox:xmpbox:2.0.15' - compile group: 'org.apache.tika', name: 'tika-core', version: '1.20' + compile group: 'org.apache.tika', name: 'tika-core', version: '1.21' // required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635 compile 'org.bouncycastle:bcprov-jdk15on:1.61' From df2a178dd5cc6eb925fa89fbffa94d1a56126b7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 21 May 2019 08:56:08 +0200 Subject: [PATCH 05/10] Bump richtextfx from 0.10.0 to 0.10.1 (#4989) Bumps [richtextfx](https://github.com/FXMisc/RichTextFX) from 0.10.0 to 0.10.1. - [Release notes](https://github.com/FXMisc/RichTextFX/releases) - [Changelog](https://github.com/FXMisc/RichTextFX/blob/master/CHANGELOG.md) - [Commits](https://github.com/FXMisc/RichTextFX/compare/v0.10.0...v0.10.1) Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 43c087f3fb2..32744323702 100644 --- a/build.gradle +++ b/build.gradle @@ -130,7 +130,7 @@ dependencies { compile 'de.saxsys:mvvmfx:1.8.0' compile 'org.fxmisc.easybind:easybind:1.0.3' compile 'org.fxmisc.flowless:flowless:0.6.1' - compile 'org.fxmisc.richtext:richtextfx:0.10.0' + compile 'org.fxmisc.richtext:richtextfx:0.10.1' compile 'com.sibvisions.external.jvxfx:dndtabpane:0.1' compile 'javax.inject:javax.inject:1' compile 'com.jfoenix:jfoenix:8.0.8' From 9322cde80ab049826a93da4520a30dca25b9be95 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Tue, 21 May 2019 14:19:54 +0200 Subject: [PATCH 06/10] NPE-fix for Preferences/Ext-Prog/Settings for X/Browse (#4983) * Added handover dialogservice * Undone previous * Refactor Constructors, handing over dialogService * Reword Identifier * Reformat for codestyle * Refactor Constructors * Delete superfluous import for checkstyle * Reformat whitespace * Refactor Constructors * Refactor Cleanup --- .../org/jabref/gui/preferences/ExternalTab.java | 5 +++-- .../jabref/gui/push/PushToApplicationSettings.java | 4 ++++ .../jabref/gui/push/PushToApplicationsManager.java | 13 ++++++++----- .../org/jabref/gui/push/PushToEmacsSettings.java | 3 +++ .../java/org/jabref/gui/push/PushToLyxSettings.java | 3 +++ .../java/org/jabref/gui/push/PushToVimSettings.java | 3 +++ 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/preferences/ExternalTab.java b/src/main/java/org/jabref/gui/preferences/ExternalTab.java index 08094d037f5..afb52861d68 100644 --- a/src/main/java/org/jabref/gui/preferences/ExternalTab.java +++ b/src/main/java/org/jabref/gui/preferences/ExternalTab.java @@ -19,7 +19,6 @@ import org.jabref.gui.push.PushToApplication; import org.jabref.gui.push.PushToApplicationSettings; import org.jabref.gui.push.PushToApplicationSettingsDialog; -import org.jabref.gui.push.PushToApplicationsManager; import org.jabref.gui.util.FileDialogConfiguration; import org.jabref.logic.l10n.Localization; import org.jabref.logic.util.OS; @@ -28,6 +27,7 @@ class ExternalTab implements PrefsTab { + private final JabRefFrame frame; private final JabRefPreferences prefs; private final TextField emailSubject; private final TextField citeCommand; @@ -54,6 +54,7 @@ class ExternalTab implements PrefsTab { public ExternalTab(JabRefFrame frame, PreferencesDialog prefsDiag, JabRefPreferences prefs) { this.prefs = prefs; + this.frame = frame; dialogService = frame.getDialogService(); builder.setVgap(7); @@ -197,7 +198,7 @@ public Node getBuilder() { } private void addSettingsButton(final PushToApplication application, GridPane panel, int index) { - PushToApplicationSettings settings = PushToApplicationsManager.getSettings(application); + PushToApplicationSettings settings = frame.getPushApplications().getSettings(application); Button button = new Button(Localization.lang("Settings for %0", application.getApplicationName())); button.setPrefSize(150, 20); button.setOnAction(e -> PushToApplicationSettingsDialog.showSettingsDialog(dialogService, settings, index)); diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java index d0818faf106..5bf9d5a75f7 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationSettings.java @@ -19,6 +19,10 @@ public class PushToApplicationSettings { protected AbstractPushToApplication application; private DialogService dialogService; + public PushToApplicationSettings(DialogService dialogService) { + this.dialogService = dialogService; + } + public GridPane getJFXSettingPane(int n) { switch (n) { case 0: diff --git a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java index 32a13f1226b..e7bfaf78b3b 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java +++ b/src/main/java/org/jabref/gui/push/PushToApplicationsManager.java @@ -10,7 +10,10 @@ public class PushToApplicationsManager { private final List applications; + private final DialogService dialogService; + public PushToApplicationsManager(DialogService dialogService) { + this.dialogService = dialogService; // Set up the current available choices: applications = new ArrayList<>(); applications.add(new PushToEmacs(dialogService)); @@ -25,15 +28,15 @@ public List getApplications() { return applications; } - public static PushToApplicationSettings getSettings(PushToApplication application) { + public PushToApplicationSettings getSettings(PushToApplication application) { if (application instanceof PushToEmacs) { - return new PushToEmacsSettings(); + return new PushToEmacsSettings(dialogService); } else if (application instanceof PushToLyx) { - return new PushToLyxSettings(); + return new PushToLyxSettings(dialogService); } else if (application instanceof PushToVim) { - return new PushToVimSettings(); + return new PushToVimSettings(dialogService); } else { - return new PushToApplicationSettings(); + return new PushToApplicationSettings(dialogService); } } diff --git a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java index ca4cee137ac..0147276b652 100644 --- a/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToEmacsSettings.java @@ -4,6 +4,7 @@ import javafx.scene.control.TextField; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; @@ -11,6 +12,8 @@ public class PushToEmacsSettings extends PushToApplicationSettings { private final TextField additionalParams = new TextField(); + public PushToEmacsSettings (DialogService dialogService) { super(dialogService); } + @Override public void storeSettings() { super.storeSettings(); diff --git a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java index 856f6fc86be..85fe05a97e4 100644 --- a/src/main/java/org/jabref/gui/push/PushToLyxSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToLyxSettings.java @@ -1,11 +1,14 @@ package org.jabref.gui.push; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; public class PushToLyxSettings extends PushToApplicationSettings { + public PushToLyxSettings (DialogService dialogService) { super(dialogService); } + @Override protected void initJFXSettingsPanel() { super.initJFXSettingsPanel(); diff --git a/src/main/java/org/jabref/gui/push/PushToVimSettings.java b/src/main/java/org/jabref/gui/push/PushToVimSettings.java index ce94973675d..70438ed9115 100644 --- a/src/main/java/org/jabref/gui/push/PushToVimSettings.java +++ b/src/main/java/org/jabref/gui/push/PushToVimSettings.java @@ -4,6 +4,7 @@ import javafx.scene.control.TextField; import org.jabref.Globals; +import org.jabref.gui.DialogService; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.JabRefPreferences; @@ -11,6 +12,8 @@ public class PushToVimSettings extends PushToApplicationSettings { private final TextField vimServer = new TextField(); + public PushToVimSettings (DialogService dialogService) { super(dialogService); } + @Override public void storeSettings() { super.storeSettings(); From d3b193ce16529f768f7196cdf458c5f82f472226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=A9ndez?= Date: Fri, 24 May 2019 10:24:30 +0200 Subject: [PATCH 07/10] Fix background color of dialogs in dark mode (#4994) * Fix background color of dialogs in dark mode * Update CHANGELOG * Add new line at end of Base.css * Revert "Update CHANGELOG" This reverts commit 13a313a5c93e431a5c0fb3ba0cac815b4091c74b. --- src/main/java/org/jabref/gui/Base.css | 4 ++++ src/main/java/org/jabref/gui/help/AboutDialog.css | 5 +++-- .../java/org/jabref/gui/preferences/PreferencesDialog.css | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/Base.css b/src/main/java/org/jabref/gui/Base.css index 642fe8dcf88..2db5a049c00 100644 --- a/src/main/java/org/jabref/gui/Base.css +++ b/src/main/java/org/jabref/gui/Base.css @@ -1032,3 +1032,7 @@ We want to have a look that matches our icons in the tool-bar */ -fx-font-size: 1.5em; -fx-padding: 1em 0em 1em 0em; } + +.dialog-pane { + -fx-background-color: -fx-control-inner-background; +} diff --git a/src/main/java/org/jabref/gui/help/AboutDialog.css b/src/main/java/org/jabref/gui/help/AboutDialog.css index 8406e6c9ddf..9793ab8df1e 100644 --- a/src/main/java/org/jabref/gui/help/AboutDialog.css +++ b/src/main/java/org/jabref/gui/help/AboutDialog.css @@ -1,9 +1,10 @@ .about-heading { -fx-font-size: 30; + -fx-text-fill: -jr-theme; } .about-heading:pressed { - -fx-text-fill: -fx-focus-color; + -fx-text-fill: -jr-selected; } .top-padding { @@ -33,7 +34,7 @@ } .info-sections { - -fx-padding: 5px; + -fx-padding: 5px; } .logo-pane { diff --git a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css index d65cfddeed0..8933d9096a3 100644 --- a/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css +++ b/src/main/java/org/jabref/gui/preferences/PreferencesDialog.css @@ -1,12 +1,12 @@ #sideMenu { - -fx-background-color: -jr-white; + -fx-background-color: -fx-control-inner-background; -fx-border-color: -fx-outer-border; -fx-border-width: 1; } #sideMenu > .virtual-flow > .clipped-container > .sheet > .list-cell { -fx-padding: 8 8 8 8; - -fx-background: -jr-white; + -fx-background: -fx-control-inner-background; } .preferencePaneContainer { From 3ebc59a764687cb68a6d550c99dce1c686bce174 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Sat, 25 May 2019 14:09:29 +0200 Subject: [PATCH 08/10] Fix icon size - the second (#4993) * Refactor fixing wrong icon size * Refactor and fix configureIconButton --- .../org/jabref/gui/actions/ActionFactory.java | 9 ++------- .../org/jabref/gui/entryeditor/EntryEditor.fxml | 9 ++++++++- .../org/jabref/gui/entryeditor/EntryEditor.java | 16 ++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/jabref/gui/actions/ActionFactory.java b/src/main/java/org/jabref/gui/actions/ActionFactory.java index 07a8ddb3f2f..60625d13a1a 100644 --- a/src/main/java/org/jabref/gui/actions/ActionFactory.java +++ b/src/main/java/org/jabref/gui/actions/ActionFactory.java @@ -4,7 +4,6 @@ import java.lang.reflect.Method; import java.util.Objects; -import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.ButtonBase; import javafx.scene.control.CheckMenuItem; @@ -148,13 +147,9 @@ public ButtonBase configureIconButton(Action action, Command command, ButtonBase button.getStyleClass().add("icon-button"); // For some reason the graphic is not set correctly, so let's fix this + // ToDO: Find a way to reuse JabRefIconView button.graphicProperty().unbind(); - action.getIcon().ifPresent(icon -> { - // ToDO: Find a way to reuse JabRefIconView - Node graphicNode = icon.getGraphicNode(); - graphicNode.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", icon.fontFamily(), "1em")); - button.setGraphic(graphicNode); - }); + action.getIcon().ifPresent(icon -> button.setGraphic(icon.getGraphicNode())); return button; } diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml index d4cd990c09b..35fb41daa74 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml @@ -40,7 +40,14 @@ -