keyBinding = keyBindingRepository.mapToKeyBinding(event);
@@ -194,6 +204,7 @@ public void focus() {
private void clearSearch() {
currentResults.setText("");
searchField.setText("");
+ setHintTooltip(null);
Globals.stateManager.clearSearchQuery();
}
@@ -274,11 +285,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 418c62fa307..58822acd1ce 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
@@ -533,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
@@ -573,7 +572,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 +588,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 +639,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 +882,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 +1037,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 +1219,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 +1902,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 +2088,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