Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into convertSearchWorker
Browse files Browse the repository at this point in the history
* upstream/master:
  Resize different fonts changing entry type (#4980)
  Extended Hints - Alternative to #4971 (#4975)
  Fix command line help text (#4979)

# Conflicts:
#	src/main/java/org/jabref/gui/search/GlobalSearchBar.java
  • Loading branch information
Siedlerchr committed May 19, 2019
2 parents d0c5f2e + 5c2e5b1 commit 32925d8
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 91 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ 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 <kbd>Ctrl</kbd> + <kbd>Enter</kbd> 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)
- We made modifications to improve contrast of UI elements. [#4583](https://github.com/JabRef/jabref/issues/4583)
- 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
Expand Down Expand Up @@ -115,6 +116,9 @@ 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)
- 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
- 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.
Expand Down
118 changes: 54 additions & 64 deletions src/main/java/org/jabref/cli/JabRefCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String> 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"));
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/jabref/gui/preferences/GeneralTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -164,6 +168,7 @@ public void setValues() {
}
encodings.setValue(prefs.getDefaultEncoding());
languageSelection.setValue(prefs.getLanguage());
showAdvancedHints.setSelected(prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS));
}

@Override
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ private void storeAllSettings() {

GUIGlobals.updateEntryEditorColors();
frame.setupAllTables();
frame.getGlobalSearchBar().updateHintVisibility();
dialogService.notify(Localization.lang("Preferences recorded."));
}

Expand Down
Loading

0 comments on commit 32925d8

Please sign in to comment.