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/deployment.yml b/.github/workflows/deployment.yml index fbb322b4bac..9db09bcbbb7 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -1,6 +1,6 @@ name: Deployment -on: [push] +on: [create, push] jobs: deploy: @@ -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: diff --git a/.github/workflows/refresh-csl-subtrees.yml b/.github/workflows/refresh-csl-subtrees.yml index ef0d6bd1eff..b6f6a59e98e 100644 --- a/.github/workflows/refresh-csl-subtrees.yml +++ b/.github/workflows/refresh-csl-subtrees.yml @@ -11,15 +11,28 @@ 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 - run: git subtree pull --prefix src/main/resources/csl-styles csl-styles master --squash + run: | + git checkout master + git subtree pull --prefix src/main/resources/csl-styles csl-styles master --squash - name: Add csl-locales remote run: git remote add -f csl-locales https://github.com/citation-style-language/locales.git - name: Update csl-locales - run: git subtree pull --prefix src/main/resources/csl-locales csl-locales master --squash + run: | + git checkout master + git subtree pull --prefix src/main/resources/csl-locales csl-locales master --squash - 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a75af1b603..72ddc0c3a0f 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) @@ -70,6 +71,10 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - 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. +- We fixed an issue where renaming referenced files for bib entries with long titles was not possible. [#5603](https://github.com/JabRef/jabref/issues/5603) +- We fixed an issue where a window which is on an external screen gets unreachable when external screen is removed. [#5037](https://github.com/JabRef/jabref/issues/5037) +- We fixed a bug where the selection of groups was lost after drag and drop. [#2868](https://github.com/JabRef/jabref/issues/2868) +- We fixed an issue where the custom entry types didn't show the correct display name [#5651](https://github.com/JabRef/jabref/issues/5651) ### Removed diff --git a/GitVersion.yml b/GitVersion.yml index 4233c35ce01..726025e5e03 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,2 +1,10 @@ -assembly-versioning-format: '{major}.{minor}.{buildmetadata}' +assembly-versioning-format: '{major}.{minor}.{WeightedPreReleaseNumber}' assembly-informational-format: '{major}.{minor}{PreReleaseTagWithDash}--{CommitDate}--{ShortSha}' + +branches: + master: + regex: ^master + mode: ContinuousDelivery + tag: beta + increment: Minor + pre-release-weight: 30000 # 0 after stable release, 15000 before alpha release, 30000 before beta release, 50000 before stable release diff --git a/README.md b/README.md index 7add8ce7413..ff5ab937253 100644 --- a/README.md +++ b/README.md @@ -36,14 +36,14 @@ JabRef supports you in every step of your research work. - Attach related documents: 20 different kinds of documents supported out of the box, completely customizable and extendable - Automatically rename and move associated documents according to customizable rules - Keep track of what you read: ranking, priority, printed, quality-assured - + #### Cite - Native [BibTeX] and [Biblatex] support - Cite-as-you-write functionality for external applications such as Emacs, Kile, LyX, Texmaker, TeXstudio, Vim and WinEdt. - Format references in one of the many thousand built-in citation styles or create your style - Support for Word and LibreOffice/OpenOffice for inserting and formatting citations - + #### Share - Many built-in export options or create your export format diff --git a/build.gradle b/build.gradle index 052646af9f8..39a78043a13 100644 --- a/build.gradle +++ b/build.gradle @@ -116,7 +116,7 @@ dependencies { compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7' - compile group: 'org.apache.tika', name: 'tika-core', version: '1.22' + compile group: 'org.apache.tika', name: 'tika-core', version: '1.23' // required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635 compile 'org.bouncycastle:bcprov-jdk15on:1.64' @@ -142,7 +142,7 @@ dependencies { compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.2' - compile 'org.postgresql:postgresql:42.2.8' + compile 'org.postgresql:postgresql:42.2.9' compile ('com.oracle.ojdbc:ojdbc10:19.3.0.0') { // causing module issues @@ -169,7 +169,7 @@ dependencies { compile 'org.controlsfx:controlsfx:11.0.1' compile 'org.jsoup:jsoup:1.12.1' - compile 'com.konghq:unirest-java:3.2.00' + compile 'com.konghq:unirest-java:3.3.00' compile 'org.slf4j:slf4j-api:2.0.0-alpha1' compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT' diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000000..ea56400cf36 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,41 @@ +# Develop JabRef + +This page presents all development informatation around JabRef. For users documentation see . + +## Command Line + +The package `org.jabref.cli` is responsible for handling the command line options. + +During development, one can configure IntelliJ to pass command line paramters: + +![IntelliJ-run-configuration](images/intellij-run-configuration-command-line.png) + +Passing command line arguments using gradle is currently not possible as all arguments (such as `-Dfile.encoding=windows-1252`) are passed to the application. + +Without jlink, it is not possible to generate a fat jar any more. During development, the capabilities of the IDE has to be used. + +## Groups + +UML diagram showing aspects of groups: [Groups.uml](Gropus.uml). + +## Decision Records + +This log lists the decisions for JabRef. + + + +- [ADR-0000](0000-use-markdown-architectural-decision-records.md) - Use Markdown Architectural Decision Records +- [ADR-0001](0001-use-crowdin-for-translations.md) - Use Crowdin for translations +- [ADR-0002](0002-use-slf4j-for-logging.md) - Use slf4j together with log4j2 for logging +- [ADR-0003](0003-use-gradle-as-build-tool.md) - Use Gradle as build tool +- [ADR-0003](0003-use-openjson-as-replacement-for-org-json.md) - Use openjson as replacement for org.json +- [ADR-0004](0004-use-mariadb-connector.md) - Use MariaDB Connector +- [ADR-0005](0005-fully-support-utf8-only-for-latex-files.md) - Fully Support UTF-8 Only For LaTeX Files +- [ADR-0006](0006-only-translated-strings-in-language-file.md) - Only translated strings in language file +- [ADR-0007](0007-human-readable-changelog.md) - Provide a human-readable changelog + + + +For new ADRs, please use [docs/template.md](docs/template.md) as basis. +More information on MADR is available at . +General information about architectural decision records is available at . diff --git a/docs/adr/README.md b/docs/adr/README.md deleted file mode 100644 index 9fbff0a524c..00000000000 --- a/docs/adr/README.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Architectural Decision Log - -This log lists the architectural decisions for JabRef. - - - -- [ADR-0000](0000-use-markdown-architectural-decision-records.md) - Use Markdown Architectural Decision Records -- [ADR-0001](0001-use-crowdin-for-translations.md) - Use Crowdin for translations -- [ADR-0002](0002-use-slf4j-for-logging.md) - Use slf4j together with log4j2 for logging -- [ADR-0003](0003-use-gradle-as-build-tool.md) - Use Gradle as build tool -- [ADR-0004](0004-use-mariadb-connector.md) - Use MariaDB Connector -- [ADR-0005](0005-fully-support-utf8-only-for-latex-files.md) - Fully Support UTF-8 Only For LaTeX Files -- [ADR-0006](0006-only-translated-strings-in-language-file.md) - Only translated strings in language file -- [ADR-0007](0007-human-readable-changelog.md) - Provide a human-readable changelog - - - -For new ADRs, please use [template.md](template.md) as basis. -More information on MADR is available at . -General information about architectural decision records is available at . diff --git a/docs/images/intellij-run-configuration-command-line.png b/docs/images/intellij-run-configuration-command-line.png new file mode 100644 index 00000000000..cc71d5d068e Binary files /dev/null and b/docs/images/intellij-run-configuration-command-line.png differ diff --git a/external-libraries.txt b/external-libraries.txt index 1f4e0433d78..bae45aa7424 100644 --- a/external-libraries.txt +++ b/external-libraries.txt @@ -67,8 +67,8 @@ License: MIT Id: com.oracle.ojdbc:ojdbc10 Project: Oracle's JDBC drivers -URL: https://medium.com/oracledevs/oracle-jdbc-drivers-on-maven-central-64fcf724d8b -License: Proprietary +URL: https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc10/19.3.0.0/ojdbc10-19.3.0.0.pom +License: Oracle Free Use Terms and Conditions (FUTC) Id: com.sibvisions.external.jvxfx:DnDTabPane Project: Drag'n'Drop TabPane diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index e5070ca912b..76684d8e1ed 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -3,11 +3,12 @@ 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; +import javafx.stage.Screen; import javafx.stage.Stage; import org.jabref.gui.BasePanel; @@ -40,12 +41,14 @@ public class JabRefGUI { private final List bibDatabases; private final boolean isBlank; + private boolean correctedWindowPos; private final List failed = new ArrayList<>(); private final List toOpenTab = new ArrayList<>(); public JabRefGUI(Stage mainStage, List databases, boolean isBlank) { this.bibDatabases = databases; this.isBlank = isBlank; + this.correctedWindowPos = false; mainFrame = new JabRefFrame(mainStage); openWindow(mainStage); @@ -62,12 +65,21 @@ private void openWindow(Stage mainStage) { // Restore window location and/or maximised state if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); + } else if (Screen.getScreens().size() == 1 && isWindowPositionOutOfBounds()) { + //corrects the Window, if its outside of the mainscreen + LOGGER.debug("The Jabref Window is outside the Main Monitor\n"); + mainStage.setX(0); + mainStage.setY(0); + mainStage.setWidth(1024); + mainStage.setHeight(768); + correctedWindowPos = true; } else { mainStage.setX(Globals.prefs.getDouble(JabRefPreferences.POS_X)); mainStage.setY(Globals.prefs.getDouble(JabRefPreferences.POS_Y)); mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X)); mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y)); } + printWindowState(mainStage); // We create a decoration pane ourselves for performance reasons // (otherwise it has to be injected later, leading to a complete redraw/relayout of the complete scene) @@ -82,7 +94,11 @@ private void openWindow(Stage mainStage) { mainStage.show(); mainStage.setOnCloseRequest(event -> { - saveWindowState(mainStage); + if (!correctedWindowPos) { + //saves the window position only if its not corrected -> the window will rest at the old Position, + //if the external Screen is connected again. + saveWindowState(mainStage); + } boolean reallyQuit = mainFrame.quit(); if (!reallyQuit) { event.consume(); @@ -97,6 +113,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 +129,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; } } @@ -187,6 +204,33 @@ private void saveWindowState(Stage mainStage) { Globals.prefs.putDouble(JabRefPreferences.POS_Y, mainStage.getY()); Globals.prefs.putDouble(JabRefPreferences.SIZE_X, mainStage.getWidth()); Globals.prefs.putDouble(JabRefPreferences.SIZE_Y, mainStage.getHeight()); + printWindowState(mainStage); + } + + /** + * outprints the Data from the Screen + * (only in debug mode) + * @param mainStage + */ + private void printWindowState(Stage mainStage) { + StringBuilder bob = new StringBuilder(); + bob.append("SCREEN DATA:"); + bob.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n"); + bob.append("mainStage.POS_X: " + mainStage.getX() + "\n"); + bob.append("mainStage.POS_Y: " + mainStage.getY() + "\n"); + bob.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n"); + bob.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n"); + LOGGER.debug(bob.toString()); + } + + /** + * Tests if the window coordinates are out of the mainscreen + * @return outbounds + */ + private boolean isWindowPositionOutOfBounds() { + + return !Screen.getPrimary().getBounds().contains(Globals.prefs.getDouble(JabRefPreferences.POS_X) , Globals.prefs.getDouble(JabRefPreferences.POS_Y)); + } private void openLastEditedDatabases() { 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) { diff --git a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml index a905a82060b..5b2924eb764 100644 --- a/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml +++ b/src/main/java/org/jabref/gui/bibtexkeypattern/BibtexKeyPatternTable.fxml @@ -7,8 +7,8 @@ xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.bibtexkeypattern.BibtexKeyPatternTableView"> - - + + diff --git a/src/main/java/org/jabref/gui/groups/GroupTree.fxml b/src/main/java/org/jabref/gui/groups/GroupTree.fxml index ea9b692ef1b..4d5302c133f 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTree.fxml +++ b/src/main/java/org/jabref/gui/groups/GroupTree.fxml @@ -42,7 +42,7 @@ - + diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index ddfbf0434e1..b410e6be80d 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -4,6 +4,7 @@ import java.lang.reflect.Method; import java.time.Duration; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -232,14 +233,18 @@ public void initialize() { if (dragboard.hasContent(DragAndDropDataFormats.GROUP)) { List pathToSources = (List) dragboard.getContent(DragAndDropDataFormats.GROUP); + List changedGroups = new LinkedList<>(); for (String pathToSource : pathToSources) { Optional source = viewModel.rootGroupProperty().get() .getChildByPath(pathToSource); if (source.isPresent()) { source.get().draggedOn(row.getItem(), ControlHelper.getDroppingMouseLocation(row, event)); + changedGroups.add(source.get()); success = true; } } + groupTree.getSelectionModel().clearSelection(); + changedGroups.forEach(value -> selectNode(value, true)); } if (localDragboard.hasBibEntries()) { @@ -268,8 +273,21 @@ private void updateSelection(List> newSelectedGroup } private void selectNode(GroupNodeViewModel value) { + selectNode(value, false); + } + + private void selectNode(GroupNodeViewModel value, boolean expandParents) { getTreeItemByValue(value) - .ifPresent(treeItem -> groupTree.getSelectionModel().select(treeItem)); + .ifPresent(treeItem -> { + if (expandParents) { + TreeItem parent = treeItem.getParent(); + while (parent != null) { + parent.setExpanded(true); + parent = parent.getParent(); + } + } + groupTree.getSelectionModel().select(treeItem); + }); } private Optional> getTreeItemByValue(GroupNodeViewModel value) { @@ -281,7 +299,16 @@ private Optional> getTreeItemByValue(TreeItem getTreeItemByValue(child, value).isPresent()).findFirst(); + + Optional> node = Optional.empty(); + for (TreeItem child : root.getChildren()) { + node = getTreeItemByValue(child, value); + if (node.isPresent()) { + break; + } + } + + return node; } private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) { diff --git a/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.fxml b/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.fxml index 791543daf23..bdc708e4f83 100644 --- a/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.fxml +++ b/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.fxml @@ -13,7 +13,6 @@