Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into groupSorting
Browse files Browse the repository at this point in the history
* upstream/master: (35 commits)
  Update antlr from 4.6 to 4.7
  Fix build
  fix ID consideration in DuplicateCheck
  Add ArXiv identifier batch lookup (#2710)
  Update mockito from 2.7.19 to 2.7.21
  More defensive identifier list #2708
  Revert "Add more identifier field names #2708"
  Add more identifier field names #2708
  Consider entries as equal if their DOI matches #2708
  Imports
  Imports
  Move duplicate detection to logic
  Reuse edit distance class
  Refactoring
  EntryTypeDialog Fetching Autogenerates BibTeX Key (#2709)
  Add changelog entry
  Increase permitted size of StringUtil
  Make sure that JavaFx shuts down in case another JabRef instance is already open
  Remove obsolete localization strings
  Hide context menu before group edit/add (probably a JavaFX vs Swing problem)
  ...

# Conflicts:
#	src/main/java/org/jabref/gui/groups/GroupTreeController.java
#	src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
  • Loading branch information
Siedlerchr committed Apr 6, 2017
2 parents 2891123 + 1f7bba8 commit 2ed5e38
Show file tree
Hide file tree
Showing 97 changed files with 1,083 additions and 2,170 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- The background color of the hit counter signals whether the group contains all/any of the entries selected in the main table.
- Added a possibility to filter the groups panel [#1904](https://github.com/JabRef/jabref/issues/1904)
- Removed edit mode.
- Removed the following commands in the right-click menu:
- Expand/collapse subtree
- Move up/down/left/right
- Remove option to "highlight overlapping groups"
- Moved the option to "Gray out non-hits" / "Hide non-hits" to the preferences
- Removed the following options from the group preferences:
- Show icons (icons can now be customized)
- Show dynamic groups in italics (dynamic groups are not treated specially now)
- Initially show groups tree expanded (always true now)
- Redesigned about dialog.
- Redesigned key bindings dialog.
- Redesigned journal abbreviations dialog.
Expand Down Expand Up @@ -47,13 +56,18 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- The `Move linked files to default file directory`-Cleanup operation respects the `File directory pattern` setting
- We separated the `Move file` and `Rename Pdfs` logic and context menu entries in the `General`-Tab for the Field `file` to improve the semantics
- A scrollbar was added to the cleanup panel, as a result of issue [#2501](https://github.com/JabRef/jabref/issues/2501)
- Using "Look up document identifier" in the quality menu, it is possible to look up DOIs and other identifiers for multiple entries.
- Using "Look up document identifier" in the quality menu, it is possible to look up DOIs, ArXiv ids and other identifiers for multiple entries.
- F4 opens selected file in current JTable context not just from selected entry inside the main table [#2355](https://github.com/JabRef/jabref/issues/2355)
- We added an option to copy the title of BibTeX entries to the clipboard through `Edit -> Copy title` (implements [#210](https://github.com/koppor/jabref/issues/210))
- Several scrollbars were added to the preference dialog which show up when content is too large [#2559](https://github.com/JabRef/jabref/issues/2559)
- We fixed and improved the auto detection of the OpenOffice and LibreOffice connection
- Entries with a single corporate author are now correclty exported to the corresponding `corporate` author field in MS-Office XML. [#1497](https://github.com/JabRef/jabref/issues/1497)
- Improved author handling in MS-Office Import/Export
- The `day` part of the biblatex `date` field is now exported to the corresponding `day` field in MS-Office XML. [#2691](https://github.com/JabRef/jabref/issues/2691)

### Fixed
- We fixed an issue of duplicate keys after using a fetcher, e.g., DOI or ISBN [#2867](https://github.com/JabRef/jabref/issues/2687)
- We fixed an issue that prevented multiple parallel JabRef instances from terminating gracefully. [#2698](https://github.com/JabRef/jabref/issues/2698)
- We fixed an issue where authors with multiple surnames were not presented correctly in the main table. [#2534](https://github.com/JabRef/jabref/issues/2534)
- Repairs the handling of apostrophes in the LaTeX to unicode conversion. [#2500](https://github.com/JabRef/jabref/issues/2500)
- Fix import of journal title in ris format. [#2506](https://github.com/JabRef/jabref/issues/2506)
Expand All @@ -66,7 +80,6 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed the synchronization logic of keywords and special fields and vice versa [#2580](https://github.com/JabRef/jabref/issues/2580)
- We fixed an exception that prevented JabRef from starting in rare cases [bug report in the forum](http://discourse.jabref.org/t/jabref-not-opening/476).
- We fixed an unhandled exception when saving an entry containing unbalanced braces [#2571](https://github.com/JabRef/jabref/issues/2571)

- Fixed a display issue when removing a group with a long name [#1407](https://github.com/JabRef/jabref/issues/1407)
- The group selection is no longer lost when switching tabs [#1104](https://github.com/JabRef/jabref/issues/1104)
- We fixed an issue where the "find unlinked files" functionality threw an error when only one PDF was imported but not assigned to an entry [#2577](https://github.com/JabRef/jabref/issues/2577)
Expand All @@ -81,6 +94,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the file folder could not be changed when running `Get fulltext` in the `general`-tab. [#2572](https://github.com/JabRef/jabref/issues/2572)
- Newly created libraries no longer have the executable bit set under POSIX/Linux systems. The file permissions are now set to `664 (-rw-rw-r--)`. [#2635](https://github.com/JabRef/jabref/issues/#2635)
- OpenOffice text formatting now handles nested tags properly [#2483](https://github.com/JabRef/jabref/issues/#2483)
- We fixed an issue where the dialog for selecting the main file directory in the preferences opened the the wrong folder

### Removed

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ dependencies {
antlr3 'org.antlr:antlr:3.5.2'
compile 'org.antlr:antlr-runtime:3.5.2'

antlr4 'org.antlr:antlr4:4.6'
compile 'org.antlr:antlr4-runtime:4.6'
antlr4 'org.antlr:antlr4:4.7'
compile 'org.antlr:antlr4-runtime:4.7'

// 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.40'
Expand Down Expand Up @@ -137,10 +137,10 @@ dependencies {

compile 'com.github.lgooddatepicker:LGoodDatePicker:8.3.0'

compile 'com.github.tomtung:latex2unicode_2.12:0.2-SNAPSHOT'
compile 'com.github.tomtung:latex2unicode_2.12:0.2'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.18'
testCompile 'org.mockito:mockito-core:2.7.21'
testCompile 'com.github.tomakehurst:wiremock:2.5.1'
testCompile 'org.assertj:assertj-swing-junit:3.5.0'
testCompile 'org.reflections:reflections:0.9.11'
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 05 09:52:38 CET 2017
#Mon Mar 27 08:28:31 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip
15 changes: 8 additions & 7 deletions src/main/java/org/jabref/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.jabref.gui.GlobalFocusListener;
import org.jabref.gui.StateManager;
import org.jabref.gui.keyboard.KeyBindingPreferences;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.logic.importer.ImportFormatReader;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.protectedterms.ProtectedTermsLoader;
Expand All @@ -19,32 +21,26 @@ public class Globals {
public static final RemoteListenerServerLifecycle REMOTE_LISTENER = new RemoteListenerServerLifecycle();

public static final ImportFormatReader IMPORT_FORMAT_READER = new ImportFormatReader();


public static final TaskExecutor taskExecutor = new DefaultTaskExecutor();
// In the main program, this field is initialized in JabRef.java
// Each test case initializes this field if required
public static JabRefPreferences prefs;

/**
* This field is initialized upon startup.
* Only GUI code is allowed to access it, logic code should use dependency injection.
*/
public static JournalAbbreviationLoader journalAbbreviationLoader;

/**
* This field is initialized upon startup.
* Only GUI code is allowed to access it, logic code should use dependency injection.
*/
public static ProtectedTermsLoader protectedTermsLoader;

/**
* Manager for the state of the GUI.
*/
public static StateManager stateManager = new StateManager();

// Key binding preferences
private static KeyBindingPreferences keyPrefs;

// Background tasks
private static GlobalFocusListener focusListener;
private static FileUpdateMonitor fileUpdateMonitor;
Expand Down Expand Up @@ -76,4 +72,9 @@ public static GlobalFocusListener getFocusListener() {
public static FileUpdateMonitor getFileUpdateMonitor() {
return fileUpdateMonitor;
}

public static void shutdownThreadPools() {
taskExecutor.shutdown();
JabRefExecutorService.INSTANCE.shutdownEverything();
}
}
55 changes: 25 additions & 30 deletions src/main/java/org/jabref/JabRefExecutorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,22 @@
*/
public class JabRefExecutorService implements Executor {

private static final Log LOGGER = LogFactory.getLog(JabRefExecutorService.class);

public static final JabRefExecutorService INSTANCE = new JabRefExecutorService();

private Thread remoteThread;

private static final Log LOGGER = LogFactory.getLog(JabRefExecutorService.class);
private final ExecutorService executorService = Executors.newCachedThreadPool(r -> {
Thread thread = new Thread(r);
thread.setName("JabRef CachedThreadPool");
thread.setUncaughtExceptionHandler(new FallbackExceptionHandler());
return thread;
});

private final ExecutorService lowPriorityExecutorService = Executors.newCachedThreadPool(r -> {
Thread thread = new Thread(r);
thread.setName("JabRef LowPriorityCachedThreadPool");
thread.setUncaughtExceptionHandler(new FallbackExceptionHandler());
return thread;
});

private final Timer timer = new Timer("timer", true);
private Thread remoteThread;

private JabRefExecutorService() {}

Expand Down Expand Up @@ -77,29 +72,6 @@ public void executeInterruptableTask(final Runnable runnable, String taskName) {
this.lowPriorityExecutorService.execute(new NamedRunnable(taskName, runnable));
}

class NamedRunnable implements Runnable {

private final String name;

private final Runnable task;

public NamedRunnable(String name, Runnable runnable){
this.name = name;
this.task = runnable;
}

@Override
public void run() {
final String orgName = Thread.currentThread().getName();
Thread.currentThread().setName(name);
try {
task.run();
} finally {
Thread.currentThread().setName(orgName);
}
}
}

public void executeInterruptableTaskAndWait(Runnable runnable) {
if(runnable == null) {
LOGGER.debug("Received null as command for execution");
Expand Down Expand Up @@ -149,4 +121,27 @@ public void shutdownEverything() {
// 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
}

class NamedRunnable implements Runnable {

private final String name;

private final Runnable task;

public NamedRunnable(String name, Runnable runnable) {
this.name = name;
this.task = runnable;
}

@Override
public void run() {
final String orgName = Thread.currentThread().getName();
Thread.currentThread().setName(name);
try {
task.run();
} finally {
Thread.currentThread().setName(orgName);
}
}
}

}
6 changes: 4 additions & 2 deletions src/main/java/org/jabref/JabRefMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ private static void start(String[] args) {
// 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."));
JabRefExecutorService.INSTANCE.shutdownEverything();
Globals.shutdownThreadPools();
// needed to tell JavaFx to stop
Platform.exit();
return;
}
}
Expand All @@ -132,7 +134,7 @@ private static void start(String[] args) {

// See if we should shut down now
if (argumentProcessor.shouldShutDown()) {
JabRefExecutorService.INSTANCE.shutdownEverything();
Globals.shutdownThreadPools();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/collab/ChangeScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.jabref.JabRefExecutorService;
import org.jabref.gui.BasePanel;
import org.jabref.gui.JabRefFrame;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.bibtex.comparator.EntryComparator;
import org.jabref.logic.exporter.BibDatabaseWriter;
import org.jabref.logic.exporter.BibtexDatabaseWriter;
Expand All @@ -29,7 +30,6 @@
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.Defaults;
import org.jabref.model.DuplicateCheck;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.EntrySorter;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/collab/EntryChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.jabref.gui.BasePanel;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.DuplicateCheck;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.entry.BibEntry;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/collab/EntryDeleteChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.jabref.gui.PreviewPanel;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableRemoveEntry;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.DuplicateCheck;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.entry.BibEntry;

Expand Down
27 changes: 0 additions & 27 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1301,33 +1301,6 @@ public void keyPressed(KeyEvent e) {

if (e.isControlDown()) {
switch (keyCode) {
// The up/down/left/rightkeystrokes are displayed in the
// GroupSelector's popup menu, so if they are to be changed,
// edit GroupSelector.java accordingly!
case KeyEvent.VK_UP:
e.consume();
if (node != null) {
frame.getGroupSelector().moveNodeUp(node, true);
}
break;
case KeyEvent.VK_DOWN:
e.consume();
if (node != null) {
frame.getGroupSelector().moveNodeDown(node, true);
}
break;
case KeyEvent.VK_LEFT:
e.consume();
if (node != null) {
frame.getGroupSelector().moveNodeLeft(node, true);
}
break;
case KeyEvent.VK_RIGHT:
e.consume();
if (node != null) {
frame.getGroupSelector().moveNodeRight(node, true);
}
break;
case KeyEvent.VK_PAGE_DOWN:
frame.nextTab.actionPerformed(null);
e.consume();
Expand Down
23 changes: 11 additions & 12 deletions src/main/java/org/jabref/gui/DefaultInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.jabref.Globals;
import org.jabref.gui.keyboard.KeyBindingPreferences;
import org.jabref.gui.util.DefaultTaskExecutor;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.preferences.JabRefPreferences;

Expand All @@ -17,16 +16,6 @@ public class DefaultInjector implements PresenterFactory {

private static final Log LOGGER = LogFactory.getLog(DefaultInjector.class);

@Override
public <T> T instantiatePresenter(Class<T> clazz, Function<String, Object> injectionContext) {
LOGGER.debug("Instantiate " + clazz.getName());

// Use our own method to construct dependencies
Injector.setInstanceSupplier(DefaultInjector::createDependency);

return Injector.instantiatePresenter(clazz, injectionContext);
}

/**
* This method takes care of creating dependencies.
* By default, it just creates a new instance of the class.
Expand All @@ -36,7 +25,7 @@ private static Object createDependency(Class<?> clazz) {
if (clazz == DialogService.class) {
return new FXDialogService();
} else if (clazz == TaskExecutor.class) {
return new DefaultTaskExecutor();
return Globals.taskExecutor;
} else if (clazz == JabRefPreferences.class) {
return Globals.prefs;
} else if (clazz == KeyBindingPreferences.class) {
Expand All @@ -52,4 +41,14 @@ private static Object createDependency(Class<?> clazz) {
}
}
}

@Override
public <T> T instantiatePresenter(Class<T> clazz, Function<String, Object> injectionContext) {
LOGGER.debug("Instantiate " + clazz.getName());

// Use our own method to construct dependencies
Injector.setInstanceSupplier(DefaultInjector::createDependency);

return Injector.instantiatePresenter(clazz, injectionContext);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/DuplicateSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import org.jabref.gui.undo.UndoableInsertEntry;
import org.jabref.gui.undo.UndoableRemoveEntry;
import org.jabref.gui.worker.CallBack;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.DuplicateCheck;
import org.jabref.model.entry.BibEntry;

import spin.Spin;
Expand Down
Loading

0 comments on commit 2ed5e38

Please sign in to comment.