From 66c82d7e60f42fe5324d4208dcf2188e74c9669e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 13:29:41 +0100 Subject: [PATCH 1/7] Bump controlsfx from 11.0.0 to 11.0.1 (#5714) Bumps [controlsfx](https://bitbucket.org/controlsfx/controlsfx) from 11.0.0 to 11.0.1. - [Changelog](https://bitbucket.org/controlsfx/controlsfx/src/default/doRelease.bat) - [Commits](https://bitbucket.org/controlsfx/controlsfx/commits) Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 10cf5c5cf3f..052646af9f8 100644 --- a/build.gradle +++ b/build.gradle @@ -166,7 +166,7 @@ dependencies { compile 'org.fxmisc.richtext:richtextfx:0.10.3' compile group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1' compile 'com.jfoenix:jfoenix:9.0.9' - compile 'org.controlsfx:controlsfx:11.0.0' + compile 'org.controlsfx:controlsfx:11.0.1' compile 'org.jsoup:jsoup:1.12.1' compile 'com.konghq:unirest-java:3.2.00' From 6af53defd9879bb02758a57bba2e4306ac9506e2 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 6 Dec 2019 15:34:21 +0100 Subject: [PATCH 2/7] fix springer fetcher tests --- .../org/jabref/logic/importer/fetcher/SpringerFetcher.java | 2 +- .../jabref/logic/importer/fetcher/SpringerFetcherTest.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java index 8d9221709a0..0e914c881b0 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/SpringerFetcher.java @@ -38,7 +38,7 @@ public class SpringerFetcher implements SearchBasedParserFetcher { private static final Logger LOGGER = LoggerFactory.getLogger(SpringerFetcher.class); private static final String API_URL = "http://api.springernature.com/meta/v1/json?q="; - private static final String API_KEY = "b0c7151179b3d9c1119cf325bca8460d"; + private static final String API_KEY = "a98b4a55181ffcd27259bea45edad12e"; /** * Convert a JSONObject obtained from http://api.springer.com/metadata/json to a BibEntry diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java index cb4d188e5e0..ee1d3a76c4d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java @@ -7,6 +7,7 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; import org.jabref.model.entry.types.StandardEntryType; +import org.jabref.support.DisabledOnCIServer; import org.jabref.testutils.category.FetcherTest; import kong.unirest.json.JSONObject; @@ -25,6 +26,7 @@ void setUp() { fetcher = new SpringerFetcher(); } + @DisabledOnCIServer("Disable on CI Server to not hit the API call limit") @Test void searchByQueryFindsEntry() throws Exception { BibEntry expected = new BibEntry(StandardEntryType.Article); @@ -47,6 +49,7 @@ void searchByQueryFindsEntry() throws Exception { assertEquals(Collections.singletonList(expected), fetchedEntries); } + @DisabledOnCIServer("Disable on CI Server to not hit the API call limit") @Test void testSpringerJSONToBibtex() { String jsonString = "{\r\n" + " \"identifier\":\"doi:10.1007/BF01201962\",\r\n" @@ -70,6 +73,7 @@ void testSpringerJSONToBibtex() { assertEquals(Optional.of("1992-09-01"), bibEntry.getField(StandardField.DATE)); } + @DisabledOnCIServer("Disable on CI Server to not hit the API call limit") @Test void searchByEmptyQueryFindsNothing() throws Exception { assertEquals(Collections.emptyList(), fetcher.performSearch("")); From 359a1cc709ba3cf4f7dc87ea1b505b220be4e75b Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 7 Dec 2019 10:47:31 +0100 Subject: [PATCH 3/7] Do not couple search position to sidebar width (#5716) --- .idea/runConfigurations/JabRef_Main.xml | 4 ++-- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/JabRefFrame.java | 6 +----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.idea/runConfigurations/JabRef_Main.xml b/.idea/runConfigurations/JabRef_Main.xml index 048f2dd8126..70f04ee246c 100644 --- a/.idea/runConfigurations/JabRef_Main.xml +++ b/.idea/runConfigurations/JabRef_Main.xml @@ -2,11 +2,11 @@ - + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 26772b56e43..cb60b9aa838 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where notifications where shown during autosave. [#5555](https://github.com/JabRef/jabref/issues/5555) - We fixed an issue where the side pane was not remembering its position. [#5615](https://github.com/JabRef/jabref/issues/5615) - We fixed an issue where JabRef could not interact with [Oracle XE](https://www.oracle.com/de/database/technologies/appdev/xe.html) in the [shared SQL database setup](https://docs.jabref.org/collaborative-work/sqldatabase). +- We fixed an issue where the toolbar icons were hidden on smaller screens. ### Removed diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 93337ecb5ef..39c5c3c72b3 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -422,8 +422,6 @@ public void changed(ObservableValue observable, Boolean oldVa EasyBind.subscribe(sidePane.visibleProperty(), visible -> { if (visible) { - // Run SplitPane.setResizableWithParent later to avoid miscalculation during initial layouting - Platform.runLater(() -> SplitPane.setResizableWithParent(sidePane, Boolean.FALSE)); if (!splitPane.getItems().contains(sidePane)) { splitPane.getItems().add(0, sidePane); setDividerPosition(); @@ -452,6 +450,7 @@ private void setDividerPosition() { private Node createToolbar() { Pane leftSpacer = new Pane(); + leftSpacer.setMinWidth(50); HBox.setHgrow(leftSpacer, Priority.SOMETIMES); Pane rightSpacer = new Pane(); HBox.setHgrow(rightSpacer, Priority.SOMETIMES); @@ -471,9 +470,6 @@ private Node createToolbar() { factory.createIconButton(StandardActions.SAVE_LIBRARY, new OldDatabaseCommandWrapper(Actions.SAVE, this, stateManager)), leftSpacer ); - leftSide.setMinWidth(100); - leftSide.prefWidthProperty().bind(sidePane.widthProperty()); - leftSide.maxWidthProperty().bind(sidePane.widthProperty()); final PushToApplicationAction pushToApplicationAction = getPushToApplicationsManager().getPushToApplicationAction(); final Button pushToApplicationButton = factory.createIconButton(pushToApplicationAction.getActionInformation(), pushToApplicationAction); From d0f6c2bb42697c78af24c0e3657f0ec7c9d47b46 Mon Sep 17 00:00:00 2001 From: Kai Takac Date: Sat, 7 Dec 2019 10:50:19 +0100 Subject: [PATCH 4/7] Add throttle to AutosaveUIManager (#5680) * Add throttle to AutosaveUIManager (fixes #5679) * Fix checkstyle errors --- CHANGELOG.md | 1 + .../autosaveandbackup/AutosaveManager.java | 32 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb60b9aa838..1a75af1b603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added support to switch between biblatex and bibtex library types. [#5550](https://github.com/JabRef/jabref/issues/5550) - We changed the save action buttons to be easier to understand. [#5565](https://github.com/JabRef/jabref/issues/5565) - We made the columns for groups, files and uri in the main table reorderable and merged the clickable icon columns for uri, url, doi and eprint. [#5544](https://github.com/JabRef/jabref/pull/5544) +- We reduced the number of write actions performed when autosave is enabled [#5679](https://github.com/JabRef/jabref/issues/5679) ### Fixed diff --git a/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java b/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java index 95a651c7aa6..10e941fac15 100644 --- a/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java +++ b/src/main/java/org/jabref/logic/autosaveandbackup/AutosaveManager.java @@ -2,11 +2,9 @@ import java.util.HashSet; import java.util.Set; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.jabref.model.database.BibDatabaseContext; @@ -21,24 +19,27 @@ /** * Saves the given {@link BibDatabaseContext} on every {@link BibDatabaseContextChangedEvent} by posting a new {@link AutosaveEvent}. - * An intelligent {@link ExecutorService} with a {@link BlockingQueue} prevents a high load while saving and rejects all redundant save tasks. + * An intelligent {@link ScheduledThreadPoolExecutor} prevents a high load while saving and rejects all redundant save tasks. + * The scheduled action is stored and canceled if a newer save action is proposed. */ public class AutosaveManager { private static final Logger LOGGER = LoggerFactory.getLogger(AutosaveManager.class); + private static final int AUTO_SAVE_DELAY = 200; private static Set runningInstances = new HashSet<>(); private final BibDatabaseContext bibDatabaseContext; - private final BlockingQueue workerQueue; - private final ExecutorService executor; + private final ScheduledExecutorService executor; private final EventBus eventBus; private final CoarseChangeFilter changeFilter; + private Future scheduledSaveAction; private AutosaveManager(BibDatabaseContext bibDatabaseContext) { this.bibDatabaseContext = bibDatabaseContext; - this.workerQueue = new ArrayBlockingQueue<>(1); - this.executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, workerQueue); + ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); + executor.setRemoveOnCancelPolicy(true); // This prevents memory leaks + this.executor = executor; this.eventBus = new EventBus(); this.changeFilter = new CoarseChangeFilter(bibDatabaseContext); changeFilter.registerListener(this); @@ -46,13 +47,12 @@ private AutosaveManager(BibDatabaseContext bibDatabaseContext) { @Subscribe public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) { - try { - executor.submit(() -> { - eventBus.post(new AutosaveEvent()); - }); - } catch (RejectedExecutionException e) { - LOGGER.debug("Rejecting autosave while another save process is already running."); + if (scheduledSaveAction != null) { + scheduledSaveAction.cancel(false); } + scheduledSaveAction = executor.schedule(() -> { + eventBus.post(new AutosaveEvent()); + }, AUTO_SAVE_DELAY, TimeUnit.MILLISECONDS); } private void shutdown() { From 673e53bdfa3e9bb06d3ab2909caca21cf5773939 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sat, 7 Dec 2019 14:10:18 +0100 Subject: [PATCH 5/7] Fix import into currently open library (#5717) Remove unnecessary parallel execution of `addTab`, which fixes #5537. --- CHANGELOG.md | 1 + src/main/java/org/jabref/JabRefGUI.java | 67 ++++++++++--------- src/main/java/org/jabref/gui/JabRefFrame.java | 46 ++++++------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a75af1b603..e62873f5eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - The "Automatically set file links" feature now follows symbolic links. [#5664](https://github.com/JabRef/jabref/issues/5664) - After successful import of one or multiple bib entries the main table scrolls to the first imported entry [#5383](https://github.com/JabRef/jabref/issues/5383) - We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452) +- We fixed an issue where the command line arguments `importBibtex` and `importToOpen` did not import into the currently open library, but opened a new one. [#5537](https://github.com/JabRef/jabref/issues/5537) - We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463) - We fixed an issue where the merge dialog showed the wrong text colour in "Dark" mode [#5516](https://github.com/JabRef/jabref/issues/5516) - We fixed visibility issues with the scrollbar and group selection highlight in "Dark" mode, and enabled "Dark" mode for the OpenOffice preview in the style selection window. [#5522](https://github.com/JabRef/jabref/issues/5522) diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index e5070ca912b..4ddd788eff9 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -3,8 +3,8 @@ import java.io.File; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; +import java.util.stream.Collectors; import javafx.application.Platform; import javafx.scene.Scene; @@ -97,6 +97,13 @@ private void openDatabases() { openLastEditedDatabases(); } + // Remove invalid databases + List invalidDatabases = bibDatabases.stream() + .filter(ParserResult::isInvalid) + .collect(Collectors.toList()); + failed.addAll(invalidDatabases); + bibDatabases.removeAll(invalidDatabases); + // passed file (we take the first one) should be focused String focusedFile = bibDatabases.stream() .findFirst() @@ -106,40 +113,34 @@ private void openDatabases() { // Add all bibDatabases databases to the frame: boolean first = false; - if (!bibDatabases.isEmpty()) { - for (Iterator parserResultIterator = bibDatabases.iterator(); parserResultIterator.hasNext();) { - ParserResult pr = parserResultIterator.next(); - // Define focused tab - if (pr.getFile().filter(path -> path.getAbsolutePath().equals(focusedFile)).isPresent()) { - first = true; - } + for (ParserResult pr : bibDatabases) { + // Define focused tab + if (pr.getFile().filter(path -> path.getAbsolutePath().equals(focusedFile)).isPresent()) { + first = true; + } - if (pr.isInvalid()) { - failed.add(pr); - parserResultIterator.remove(); - } else if (pr.getDatabase().isShared()) { - try { - new SharedDatabaseUIManager(mainFrame).openSharedDatabaseFromParserResult(pr); - } catch (SQLException | DatabaseNotSupportedException | InvalidDBMSConnectionPropertiesException | - NotASharedDatabaseException e) { - pr.getDatabaseContext().clearDatabaseFile(); // do not open the original file - pr.getDatabase().clearSharedDatabaseID(); - - LOGGER.error("Connection error", e); - mainFrame.getDialogService().showErrorDialogAndWait( - Localization.lang("Connection error"), - Localization.lang("A local copy will be opened."), - e); - } - toOpenTab.add(pr); - } else if (pr.toOpenTab()) { - // things to be appended to an opened tab should be done after opening all tabs - // add them to the list - toOpenTab.add(pr); - } else { - mainFrame.addParserResult(pr, first); - first = false; + if (pr.getDatabase().isShared()) { + try { + new SharedDatabaseUIManager(mainFrame).openSharedDatabaseFromParserResult(pr); + } catch (SQLException | DatabaseNotSupportedException | InvalidDBMSConnectionPropertiesException | + NotASharedDatabaseException e) { + pr.getDatabaseContext().clearDatabaseFile(); // do not open the original file + pr.getDatabase().clearSharedDatabaseID(); + + LOGGER.error("Connection error", e); + mainFrame.getDialogService().showErrorDialogAndWait( + Localization.lang("Connection error"), + Localization.lang("A local copy will be opened."), + e); } + toOpenTab.add(pr); + } else if (pr.toOpenTab()) { + // things to be appended to an opened tab should be done after opening all tabs + // add them to the list + toOpenTab.add(pr); + } else { + mainFrame.addParserResult(pr, first); + first = false; } } diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 39c5c3c72b3..541da4646e2 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -972,37 +972,35 @@ public void updateAllTabTitles() { } public void addTab(BasePanel basePanel, boolean raisePanel) { - DefaultTaskExecutor.runInJavaFXThread(() -> { - // add tab - Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); - tabbedPane.getTabs().add(newTab); - newTab.setOnCloseRequest(event -> { - closeTab((BasePanel) newTab.getContent()); - event.consume(); - }); + // add tab + Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); + tabbedPane.getTabs().add(newTab); + newTab.setOnCloseRequest(event -> { + closeTab((BasePanel) newTab.getContent()); + event.consume(); + }); - // update all tab titles - updateAllTabTitles(); + // update all tab titles + updateAllTabTitles(); - if (raisePanel) { - tabbedPane.getSelectionModel().select(newTab); - } + if (raisePanel) { + tabbedPane.getSelectionModel().select(newTab); + } - // Register undo/redo listener - basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); + // Register undo/redo listener + basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); - BibDatabaseContext context = basePanel.getBibDatabaseContext(); + BibDatabaseContext context = basePanel.getBibDatabaseContext(); - if (readyForAutosave(context)) { - AutosaveManager autosaver = AutosaveManager.start(context); - autosaver.registerListener(new AutosaveUIManager(basePanel)); - } + if (readyForAutosave(context)) { + AutosaveManager autosaver = AutosaveManager.start(context); + autosaver.registerListener(new AutosaveUIManager(basePanel)); + } - BackupManager.start(context, Globals.entryTypesManager, prefs); + BackupManager.start(context, Globals.entryTypesManager, prefs); - // Track opening - trackOpenNewDatabase(basePanel); - }); + // Track opening + trackOpenNewDatabase(basePanel); } private void trackOpenNewDatabase(BasePanel basePanel) { From 4f9ac1948501a4a6d858e87b638d4e59f354da5a Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 8 Dec 2019 14:05:00 +0100 Subject: [PATCH 6/7] Try to fix csl update (#5718) --- .github/failure-csl-update | 5 +++++ .github/workflows/refresh-csl-subtrees.yml | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .github/failure-csl-update diff --git a/.github/failure-csl-update b/.github/failure-csl-update new file mode 100644 index 00000000000..0b9ab11c20f --- /dev/null +++ b/.github/failure-csl-update @@ -0,0 +1,5 @@ +--- +title: Error while updating citation styles +labels: code-quality, dependencies +--- +[Update of citation styles failed!](https://github.com/JabRef/jabref/actions?query=workflow%3A%22Refresh+Citation+Style+Language+Files%22) diff --git a/.github/workflows/refresh-csl-subtrees.yml b/.github/workflows/refresh-csl-subtrees.yml index ef0d6bd1eff..e3b45237672 100644 --- a/.github/workflows/refresh-csl-subtrees.yml +++ b/.github/workflows/refresh-csl-subtrees.yml @@ -11,7 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v1 + uses: actions/checkout@v2-beta + with: + ref: master - name: Add csl-styles remote run: git remote add -f csl-styles https://github.com/citation-style-language/styles.git - name: Update csl-styles @@ -23,3 +25,10 @@ jobs: - uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Report issues + if: failure() + uses: JasonEtco/create-an-issue@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/failure-csl-update.md From a86b0bff1debca863c593dfc80d2e4868de170d4 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 8 Dec 2019 15:43:49 +0100 Subject: [PATCH 7/7] Fix upload to GitHub artifacts (#5712) --- .github/workflows/deployment.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index fbb322b4bac..55c2c44a690 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -94,11 +94,6 @@ jobs: export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage shell: bash - - name: Add installer as artifact - uses: actions/upload-artifact@master - with: - name: JabRef-${{ matrix.displayName }} - path: build/distribution - name: Package application image run: ${{ matrix.archivePortable }} shell: bash @@ -115,6 +110,11 @@ jobs: get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"} get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"} shell: pwsh + - name: Upload to GitHub workflow artifacts store + uses: actions/upload-artifact@master + with: + name: JabRef-${{ matrix.displayName }} + path: build/distribution - name: Upload to builds.jabref.org uses: garygrossgarten/github-action-scp@release with: