From 9dae8e5132517b20b4b6d2d44085816915cb0586 Mon Sep 17 00:00:00 2001 From: P D Date: Fri, 25 Oct 2019 12:57:09 +0200 Subject: [PATCH 1/4] Added condition: if only one entry is imported, it automatically selects said entry, making importing single files easier, referring to Isse #5508 --- .../java/org/jabref/gui/importer/ImportEntriesDialog.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index 1e8671150fb..d5c92ee67c1 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -119,6 +119,10 @@ private void initialize() { } }).executeWith(Globals.TASK_EXECUTOR); + if (entriesListView.getItems().size() == 1) { + selectAllNewEntries(); + } + return container; }) .withOnMouseClickedEvent((entry, event) -> entriesListView.getCheckModel().toggleCheckState(entry)) From 50270d6dcfe64f32c08e10a1eba25c4f72197091 Mon Sep 17 00:00:00 2001 From: P D Date: Tue, 29 Oct 2019 10:42:55 +0100 Subject: [PATCH 2/4] trying Platform.runLater around the if-statement, also tried around everything in 'initialize', including and excluding the if-statement --- .../org/jabref/gui/importer/ImportEntriesDialog.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index d5c92ee67c1..db8dd1a1845 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -119,16 +119,20 @@ private void initialize() { } }).executeWith(Globals.TASK_EXECUTOR); - if (entriesListView.getItems().size() == 1) { - selectAllNewEntries(); - } - return container; }) .withOnMouseClickedEvent((entry, event) -> entriesListView.getCheckModel().toggleCheckState(entry)) .withPseudoClass(entrySelected, entriesListView::getItemBooleanProperty) .install(entriesListView); entriesListView.setSelectionModel(new NoSelectionModel<>()); + + Platform.runLater(new Runnable() { + public void run() { + if (entriesListView.getItems().size() == 1) { + selectAllNewEntries(); + } + } + }); } private Node getEntryNode(BibEntry entry) { From 60e8e734e3433c1609005be8d5d2201352266e97 Mon Sep 17 00:00:00 2001 From: P D Date: Thu, 31 Oct 2019 14:47:47 +0100 Subject: [PATCH 3/4] reverted the last change and added a comment as to why the code is there --- .../gui/importer/ImportEntriesDialog.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index db8dd1a1845..25c92c4f252 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -119,20 +119,22 @@ private void initialize() { } }).executeWith(Globals.TASK_EXECUTOR); + /* + inserted the if-statement here, since a Platforn.runLater() call did not work. + also tried to move it to the end of the initialize method, but it did not select the entry. + */ + if (entriesListView.getItems().size() == 1) { + selectAllNewEntries(); + } + + return container; + return container; }) .withOnMouseClickedEvent((entry, event) -> entriesListView.getCheckModel().toggleCheckState(entry)) .withPseudoClass(entrySelected, entriesListView::getItemBooleanProperty) .install(entriesListView); entriesListView.setSelectionModel(new NoSelectionModel<>()); - - Platform.runLater(new Runnable() { - public void run() { - if (entriesListView.getItems().size() == 1) { - selectAllNewEntries(); - } - } - }); } private Node getEntryNode(BibEntry entry) { From 216aad4cd5784c190267a3b71aef6c096b0839e7 Mon Sep 17 00:00:00 2001 From: P D Date: Fri, 1 Nov 2019 12:19:52 +0100 Subject: [PATCH 4/4] fixed a mistake, where 2 returns where present, where one was not necessary --- src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index 25c92c4f252..26221ce81d2 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -126,8 +126,6 @@ private void initialize() { if (entriesListView.getItems().size() == 1) { selectAllNewEntries(); } - - return container; return container; })