Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/maintable-beta' into jdk9
Browse files Browse the repository at this point in the history
* upstream/maintable-beta: (46 commits)
  update gradle to 4.7 (#4049)
  Add missing translation for "HTML to Unicode" (#4046)
  New Crowdin translations (#4042)
  Use all-text-fields magic also in BibTeX cleanup. (#4039)
  Switch to org.postgresql (#4031)
  Fix freeze when importing (#4037)
  Use JavaFX-native SVGPath for logo in About dialog (#4035)
  Remove reflection hack to set WM_CLASS (#4034)
  Fix initial freeze when downloading files
  Inline comment
  Move color related method
  Extract dialog service to field
  Extract dialog service to field
  Remove unused class
  Show tooltip for icon-based columns
  Remove commented-out code
  Convert static methods to instance members (and fix spelling)
  Fix formatting
  Fix formatting
  Remove unused argument
  ...

# Conflicts:
#	build.gradle
#	gradle/wrapper/gradle-wrapper.properties
#	src/main/java/org/jabref/gui/GUIGlobals.java
#	src/main/java/org/jabref/gui/SidePaneComponent.java
#	src/main/java/org/jabref/gui/groups/GroupModeViewModel.java
#	src/main/java/org/jabref/gui/groups/GroupSidePane.java
#	src/main/java/org/jabref/gui/help/AboutDialogView.java
#	src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
#	src/main/java/org/jabref/logic/shared/PostgreSQLProcessor.java
#	src/main/resources/l10n/JabRef_en.properties
  • Loading branch information
Siedlerchr committed May 22, 2018
2 parents bcfde56 + 8cbe028 commit 9980c74
Show file tree
Hide file tree
Showing 75 changed files with 851 additions and 1,404 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
### Changed
- We added a text file export for 'Find Unlinked Files'. [#3341](https://github.com/JabRef/jabref/issues/3341)
- We added a fetcher based on RFC-IDs. [#3971](https://github.com/JabRef/jabref/issues/3971)
- We changed the implementation of the `[shorttitle]` key pattern. It now removes small words like `a`, `an`, `on`, `the` etc. Refer to the help page for a complete overview. [Feature request in the forum](http://discourse.jabref.org/t/jabref-differences-in-shorttitle-between-versions-3-8-1-and-4-not-discounting-the-a-an-of-in-titles/1147)
- We streamlined the defaults for a [cleanup of entries](http://help.jabref.org/en/CleanupEntries) in the case of BibTeX.

### Fixed
We fixed an issue where the export to clipboard functionality could not be invoked [#3994](https://github.com/JabRef/jabref/issues/3994)
We fixed an issue with the migration of invalid Look and Feels [#3995, comment](https://github.com/JabRef/jabref/issues/3995#issuecomment-385649448)
We fixed an issue where JabRef would no longer start, when the option "Override default font settings" was activated [#3986](https://github.com/JabRef/jabref/issues/3986)
We fixed an issue where the export to clipboard functionality could not be invoked. [#3994](https://github.com/JabRef/jabref/issues/3994)
We fixed an issue with the migration of invalid Look and Feels. [#3995, comment](https://github.com/JabRef/jabref/issues/3995#issuecomment-385649448)
We fixed an issue where JabRef would no longer start, when the option "Override default font settings" was activated. [#3986](https://github.com/JabRef/jabref/issues/3986)
We fixed an issue where JabRef removed whitespace from the Title-fetcher which resulting in no entries being found. [#4014](https://github.com/JabRef/jabref/issues/4014)
We fixed an issue where fetched entries from the ACM fetcher could not be imported. [#4018](https://github.com/JabRef/jabref/issues/4018)

### Removed
We removed the GTK Look and Feel from the Options, as it leads to freezes in JabRef on MacOSX and Linux [#3995](https://github.com/JabRef/jabref/issues/3995)
The GTK Look and Feel is now replaced with the "Nimbus" style as default.
Expand Down
27 changes: 12 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ dependencies {
// VersionEye states that 6.0.5 is the most recent version, but http://dev.mysql.com/downloads/connector/j/ shows that as "Development Release"
compile 'mysql:mysql-connector-java:5.1.46'

compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.7.1'
compile 'org.postgresql:postgresql:42.2.2'

compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1'

Expand All @@ -130,8 +130,6 @@ dependencies {
compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

// JavaFX stuff
// TODO: has an internal dependency exporting org.w3c.dom, temporarily removed
//compile 'de.codecentric.centerdevice:javafxsvg:1.3.0'
compile 'de.jensd:fontawesomefx-materialdesignfont:1.7.22-4'
compile 'de.jensd:fontawesomefx-commons:9.1.2'
compile 'de.saxsys:mvvmfx-validation:1.7.0'
Expand Down Expand Up @@ -163,19 +161,18 @@ dependencies {
// JAX-B is considered JavaEE API and is no longer part of JavaSE (JDK 9)
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
compile group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'


// TODO: recognized as 'latex2unicode.2.12', which is an invalid module name, temporarily removed

// TODO: recognized as 'latex2unicode.2.12', which is an invalid module name, temporarily removed
// compile 'com.github.tomtung:latex2unicode_2.12:0.2.2'

compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.10'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.10'
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.1.1'
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.1.1'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0-RC1'
testCompile 'org.junit.jupiter:junit-jupiter-params:5.2.0-RC1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0-RC1'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.2.0-RC1'
testCompile 'org.junit.platform:junit-platform-launcher:1.2.0-RC1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
testCompile 'org.junit.jupiter:junit-jupiter-params:5.2.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.2.0'
testCompile 'org.junit.platform:junit-platform-launcher:1.2.0'
testRuntime 'org.apache.logging.log4j:log4j-core:2.11.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.11.0'
testCompile 'org.mockito:mockito-core:2.18.3'
Expand All @@ -184,11 +181,11 @@ dependencies {
testCompile 'org.reflections:reflections:0.9.11'
testCompile 'org.xmlunit:xmlunit-core:2.6.0'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.0'
testCompile 'com.tngtech.archunit:archunit-junit:0.6.0-java9-SNAPSHOT'
testCompile 'com.tngtech.archunit:archunit-junit:0.8.0'
testCompile "org.testfx:testfx-core:4.0.+"
testCompile "org.testfx:testfx-junit5:4.0.+"

checkstyle 'com.puppycrawl.tools:checkstyle:8.9'
checkstyle 'com.puppycrawl.tools:checkstyle:8.10'
}

jacoco {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/JabRefExecutorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void shutdownEverything() {
this.lowPriorityExecutorService.shutdownNow();
// kill the remote thread
stopRemoteThread();
// timer doesn't need to be canceled as it is run in daemon mode, which ensures that it is stopped if the application is shut down
timer.cancel();
}

private class NamedRunnable implements Runnable {
Expand Down
26 changes: 17 additions & 9 deletions src/main/java/org/jabref/JabRefMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ private static void ensureCorrectJavaVersion() {

if (java9Fail || versionFail) {
StringBuilder versionError = new StringBuilder(
Localization.lang("Your current Java version (%0) is not supported. Please install version %1 or higher.",
checker.getJavaVersion(),
buildInfo.getMinRequiredJavaVersion()
)
);
Localization.lang("Your current Java version (%0) is not supported. Please install version %1 or higher.",
checker.getJavaVersion(),
buildInfo.getMinRequiredJavaVersion()));

versionError.append("\n");
versionError.append(Localization.lang("Your Java Runtime Environment is located at %0.", checker.getJavaInstallationDirectory()));
Expand All @@ -93,7 +91,7 @@ private static void ensureCorrectJavaVersion() {
@Override
public void start(Stage mainStage) throws Exception {
FallbackExceptionHandler.installExceptionHandler();

ensureCorrectJavaVersion();

// Init preferences
Expand Down Expand Up @@ -121,7 +119,7 @@ public void start(Stage mainStage) throws Exception {

// Update handling of special fields based on preferences
InternalBibtexFields
.updateSpecialFields(Globals.prefs.getBoolean(JabRefPreferences.SERIALIZESPECIALFIELDS));
.updateSpecialFields(Globals.prefs.getBoolean(JabRefPreferences.SERIALIZESPECIALFIELDS));
// Update name of the time stamp field based on preferences
InternalBibtexFields.updateTimeStampField(Globals.prefs.getTimestampPreferences().getTimestampField());
// Update which fields should be treated as numeric, based on preferences:
Expand All @@ -132,9 +130,9 @@ public void start(Stage mainStage) throws Exception {

/* Build list of Import and Export formats */
Globals.IMPORT_FORMAT_READER.resetImportFormats(Globals.prefs.getImportFormatPreferences(),
Globals.prefs.getXMPPreferences(), Globals.getFileUpdateMonitor());
Globals.prefs.getXMPPreferences(), Globals.getFileUpdateMonitor());
EntryTypes.loadCustomEntryTypes(preferences.loadCustomEntryTypes(BibDatabaseMode.BIBTEX),
preferences.loadCustomEntryTypes(BibDatabaseMode.BIBLATEX));
preferences.loadCustomEntryTypes(BibDatabaseMode.BIBLATEX));
Globals.exportFactory = Globals.prefs.getExporterFactory(Globals.journalAbbreviationLoader);

// Initialize protected terms loader
Expand All @@ -151,9 +149,11 @@ public void start(Stage mainStage) throws Exception {
// We have successfully sent our command line options through the socket to another JabRef instance.
// So we assume it's all taken care of, and quit.
LOGGER.info(Localization.lang("Arguments passed on to running JabRef instance. Shutting down."));
Globals.stopBackgroundTasks();
Globals.shutdownThreadPools();
// needed to tell JavaFx to stop
Platform.exit();
System.exit(0);
return;
}
}
Expand All @@ -170,12 +170,20 @@ public void start(Stage mainStage) throws Exception {

// See if we should shut down now
if (argumentProcessor.shouldShutDown()) {
Globals.stopBackgroundTasks();
Globals.shutdownThreadPools();
Platform.exit();
System.exit(0);
return;
}

// If not, start GUI
new JabRefGUI(mainStage, argumentProcessor.getParserResults(), argumentProcessor.isBlank());
}

@Override
public void stop() {
Platform.exit();
System.exit(0);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void update() {
actions.put(Actions.COPY_CITATION_TEXT, (BaseAction) () -> copyCitationToClipboard(CitationStyleOutputFormat.TEXT));

// The action for copying the BibTeX keys as hyperlinks to the urls of the selected entries
actions.put(Actions.COPY_KEY_AND_LINK, new CopyBibTeXKeyAndLinkAction(mainTable));
actions.put(Actions.COPY_KEY_AND_LINK, new CopyBibTeXKeyAndLinkAction(mainTable, Globals.clipboardManager));

actions.put(Actions.MERGE_DATABASE, new AppendDatabaseAction(frame, this));

Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public EntryTypeDialog(JabRefFrame frame) {
setTitle(Localization.lang("Select entry type"));

addWindowListener(new WindowAdapter() {

@Override
public void windowClosing(WindowEvent e) {
cancelAction.actionPerformed(null);
Expand Down Expand Up @@ -245,7 +246,6 @@ static class TypeButton extends JButton implements Comparable<TypeButton> {

private final EntryType type;


TypeButton(String label, EntryType type) {
super(label);
this.type = type;
Expand All @@ -262,6 +262,7 @@ public EntryType getType() {
}

class CancelAction extends AbstractAction {

public CancelAction() {
super("Cancel");
}
Expand All @@ -274,6 +275,7 @@ public void actionPerformed(ActionEvent e) {
}

private class FetcherWorker extends SwingWorker<Optional<BibEntry>, Void> {

private boolean fetcherException = false;
private String fetcherExceptionMessage = "";
private IdBasedFetcher fetcher = null;
Expand All @@ -287,10 +289,9 @@ protected Optional<BibEntry> doInBackground() throws Exception {
generateButton.setText(Localization.lang("Searching..."));
});

Globals.prefs.put(JabRefPreferences.ID_ENTRY_GENERATOR,String.valueOf(comboBox.getSelectedItem()));
searchID = idTextField.getText().trim();
searchID = searchID.replaceAll(" ", "");
Globals.prefs.put(JabRefPreferences.ID_ENTRY_GENERATOR, String.valueOf(comboBox.getSelectedItem()));
fetcher = WebFetchers.getIdBasedFetchers(Globals.prefs.getImportFormatPreferences()).get(comboBox.getSelectedIndex());
searchID = idTextField.getText();
if (!searchID.isEmpty()) {
try {
bibEntry = fetcher.performSearchById(searchID);
Expand All @@ -310,7 +311,7 @@ protected void done() {
if (result.isPresent()) {
final BibEntry bibEntry = result.get();
if ((DuplicateCheck.containsDuplicate(frame.getCurrentBasePanel().getDatabase(), bibEntry, frame.getCurrentBasePanel().getBibDatabaseContext().getMode()).isPresent())) {
//If there are duplicates starts ImportInspectionDialog
//If there are duplicates starts ImportInspectionDialog
final BasePanel panel = frame.getCurrentBasePanel();

ImportInspectionDialog diag = new ImportInspectionDialog(frame, panel, Localization.lang("Import"), false);
Expand All @@ -319,7 +320,7 @@ protected void done() {
diag.setVisible(true);
diag.toFront();
} else {
// Regenerate CiteKey of imported BibEntry
// Regenerate CiteKey of imported BibEntry
new BibtexKeyGenerator(frame.getCurrentBasePanel().getBibDatabaseContext(), Globals.prefs.getBibtexKeyPatternPreferences()).generateAndSetKey(bibEntry);
// Update Timestamps
if (Globals.prefs.getTimestampPreferences().includeCreatedTimestamp()) {
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/org/jabref/gui/GUIGlobals.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import java.awt.Color;
import java.awt.Font;
import java.awt.Toolkit;

import org.jabref.Globals;
import org.jabref.gui.keyboard.EmacsKeyBindings;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.OS;
import org.jabref.preferences.JabRefPreferences;

import org.slf4j.Logger;
Expand Down Expand Up @@ -61,20 +59,6 @@ public static void init() {

GUIGlobals.currentFont = new Font(Globals.prefs.get(JabRefPreferences.FONT_FAMILY),
Globals.prefs.getInt(JabRefPreferences.FONT_STYLE), Globals.prefs.getInt(JabRefPreferences.FONT_SIZE));

// Set WM_CLASS using reflection for certain Un*x window managers
if (!OS.WINDOWS && !OS.OS_X) {
try {
// TODO: reflective access, should be removed (Java 9)
Toolkit xToolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, "org-jabref-JabRefMain");
} catch (Exception e) {
// ignore any error since this code only works for certain toolkits
}
}

}

public static void setFont(int size) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
import org.jabref.gui.actions.CopyFilesAction;
import org.jabref.gui.actions.CustomizeEntryAction;
import org.jabref.gui.actions.CustomizeKeyBindingAction;
import org.jabref.gui.actions.DatabasePropertiesAction;
import org.jabref.gui.actions.EditExternalFileTypesAction;
import org.jabref.gui.actions.ErrorConsoleAction;
import org.jabref.gui.actions.FindUnlinkedFilesAction;
import org.jabref.gui.actions.IntegrityCheckAction;
import org.jabref.gui.actions.LibraryPropertiesAction;
import org.jabref.gui.actions.LookupIdentifierAction;
import org.jabref.gui.actions.ManageCustomExportsAction;
import org.jabref.gui.actions.ManageCustomImportsAction;
Expand Down Expand Up @@ -725,10 +725,10 @@ private MenuBar createMenu() {

factory.createSubMenu(StandardActions.IMPORT_EXPORT,
factory.createMenuItem(StandardActions.MERGE_DATABASE, new OldDatabaseCommandWrapper(Actions.MERGE_DATABASE, this, Globals.stateManager)), // TODO: merge with import
factory.createMenuItem(StandardActions.IMPORT_INTO_CURRENT_LIBRARY, new ImportCommand(this, true)),
factory.createMenuItem(StandardActions.IMPORT_INTO_NEW_LIBRARY, new ImportCommand(this, false)),
factory.createMenuItem(StandardActions.EXPORT_ALL, new ExportCommand(this, false)),
factory.createMenuItem(StandardActions.EXPORT_SELECTED, new ExportCommand(this, true)),
factory.createMenuItem(StandardActions.IMPORT_INTO_CURRENT_LIBRARY, new ImportCommand(this, false)),
factory.createMenuItem(StandardActions.IMPORT_INTO_NEW_LIBRARY, new ImportCommand(this, true)),
factory.createMenuItem(StandardActions.EXPORT_ALL, new ExportCommand(this, false, Globals.prefs)),
factory.createMenuItem(StandardActions.EXPORT_SELECTED, new ExportCommand(this, true, Globals.prefs)),
factory.createMenuItem(StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX, new OldDatabaseCommandWrapper(Actions.SAVE_SELECTED_AS_PLAIN, this, Globals.stateManager))
),

Expand Down Expand Up @@ -831,7 +831,7 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this)),
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new DatabasePropertiesAction(this)),
factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(this)),
factory.createMenuItem(StandardActions.EDIT_STRINGS, new OldDatabaseCommandWrapper(Actions.EDIT_STRINGS, this, Globals.stateManager))

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/jabref/gui/PreambleEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ public void execute() {
DialogPane pane = new DialogPane();

editor.setText(frame.getCurrentBasePanel()
.getDatabase()
.getPreamble()
.orElse(""));
.getDatabase()
.getPreamble()
.orElse(""));
pane.setContent(editor);

Optional<ButtonType> pressedButton = frame.getDialogService().showCustomDialogAndWait(Localization.lang("Edit Preamble"), pane, ButtonType.APPLY, ButtonType.CANCEL);

if (pressedButton.isPresent() && pressedButton.get().equals(ButtonType.APPLY)) {
String toSet = editor.getText();
String newPreamble = editor.getText();

// We check if the field has changed, since we don't want to mark the
// base as changed unless we have a real change.
if (!database.getPreamble().orElse("").equals(toSet)) {
if (!database.getPreamble().orElse("").equals(newPreamble)) {

panel.getUndoManager().addEdit(
new UndoablePreambleChange(database, database.getPreamble().orElse(null), toSet));
database.setPreamble(toSet);
new UndoablePreambleChange(database, database.getPreamble().orElse(null), newPreamble));
database.setPreamble(newPreamble);

panel.markBaseChanged();
}
Expand Down
Loading

0 comments on commit 9980c74

Please sign in to comment.