From e0fe422799997e4b5f0b9b5e22e36a8afad1b06d Mon Sep 17 00:00:00 2001 From: LIM0000 Date: Wed, 22 Jun 2022 10:23:39 +0930 Subject: [PATCH 1/3] Fix #8911 by changing to warning dialog instead of confirmation dialog and append additional information for WordKeywordGroup --- .../jabref/gui/groups/GroupTreeViewModel.java | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index 6ac27b40419..3c99633228b 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -17,6 +17,9 @@ import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonBar; +import javafx.scene.control.ButtonType; import org.jabref.gui.AbstractViewModel; import org.jabref.gui.DialogService; @@ -29,6 +32,7 @@ import org.jabref.model.groups.AbstractGroup; import org.jabref.model.groups.ExplicitGroup; import org.jabref.model.groups.GroupTreeNode; +import org.jabref.model.groups.WordKeywordGroup; import org.jabref.model.metadata.MetaData; import org.jabref.preferences.PreferencesService; @@ -192,9 +196,21 @@ public void editGroup(GroupNodeViewModel oldGroup) { newGroup.ifPresent(group -> { // TODO: Keep assignments - boolean keepPreviousAssignments = dialogService.showConfirmationDialogAndWait( + String content = Localization.lang("Assign the original group's entries to this group?"); + ButtonType keepAssignments = new ButtonType(Localization.lang("Yes"), ButtonBar.ButtonData.YES); + ButtonType removeAssignments = new ButtonType(Localization.lang("No"), ButtonBar.ButtonData.NO); + ButtonType cancel = new ButtonType(Localization.lang("Cancel"), ButtonBar.ButtonData.CANCEL_CLOSE); + + if (newGroup.get().getClass() == WordKeywordGroup.class) { + content = content + "\n" + + Localization.lang("(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them)"); + } + Optional previousAssignments = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.WARNING, Localization.lang("Change of Grouping Method"), - Localization.lang("Assign the original group's entries to this group?")); + content, + keepAssignments, + removeAssignments, + cancel); // WarnAssignmentSideEffects.warnAssignmentSideEffects(newGroup, panel.frame()); boolean removePreviousAssignments = (oldGroup.getGroupNode().getGroup() instanceof ExplicitGroup) && (group instanceof ExplicitGroup); @@ -209,11 +225,22 @@ public void editGroup(GroupNodeViewModel oldGroup) { removePreviousAssignments = false; } - oldGroup.getGroupNode().setGroup( - group, - keepPreviousAssignments, - removePreviousAssignments, - database.getEntries()); + if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.YES) { + oldGroup.getGroupNode().setGroup( + group, + true, + removePreviousAssignments, + database.getEntries()); + } else if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.NO) { + oldGroup.getGroupNode().setGroup( + group, + false, + removePreviousAssignments, + database.getEntries()); + } else if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.CANCEL_CLOSE) { + return; + } + // stateManager.getEntriesInCurrentDatabase()); // TODO: Add undo From 3c15c231e011f43d0caa924ef15a81563f85c1a2 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 28 Jun 2022 20:15:27 +0200 Subject: [PATCH 2/3] fix failing tests add changelog improve buttons --- CHANGELOG.md | 3 ++- .../java/org/jabref/gui/groups/GroupTreeViewModel.java | 10 +++++----- src/main/resources/l10n/JabRef_en.properties | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe899c63bd..05655df7a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We improved group expansion arrow that prevent it from activating group when expanding or collapsing. [#7982](https://github.com/JabRef/jabref/issues/7982), [#3176](https://github.com/JabRef/jabref/issues/3176) - When configured SSL certificates changed, JabRef warns the user to restart to apply the configuration. - We improved the appearances and logic of the "Manage field names & content" dialog, and renamed it to "Automatic field editor". [#6536](https://github.com/JabRef/jabref/issues/6536) -- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653) +- We improved the message explaining the options when modifying an automatic keyword group [#8911](https://github.com/JabRef/jabref/issues/8911) ### Fixed @@ -48,6 +48,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where the exception that there are invalid characters in filename. [#8786](https://github.com/JabRef/jabref/issues/8786) - When the proxy configuration removed the proxy user/password, this change is applied immediately. - We fixed an issue where removing several groups deletes only one of them. [#8390](https://github.com/JabRef/jabref/issues/8390) +- We fixed an issue that caused JabRef to sometimes open multiple instances when "Remote Operation" is enabled. [#8653](https://github.com/JabRef/jabref/issues/8653) ### Removed diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index 3c99633228b..4ee1aa4ea7e 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -197,8 +197,8 @@ public void editGroup(GroupNodeViewModel oldGroup) { newGroup.ifPresent(group -> { // TODO: Keep assignments String content = Localization.lang("Assign the original group's entries to this group?"); - ButtonType keepAssignments = new ButtonType(Localization.lang("Yes"), ButtonBar.ButtonData.YES); - ButtonType removeAssignments = new ButtonType(Localization.lang("No"), ButtonBar.ButtonData.NO); + ButtonType keepAssignments = new ButtonType(Localization.lang("Assign"), ButtonBar.ButtonData.YES); + ButtonType removeAssignments = new ButtonType(Localization.lang("Do not assign"), ButtonBar.ButtonData.NO); ButtonType cancel = new ButtonType(Localization.lang("Cancel"), ButtonBar.ButtonData.CANCEL_CLOSE); if (newGroup.get().getClass() == WordKeywordGroup.class) { @@ -225,19 +225,19 @@ public void editGroup(GroupNodeViewModel oldGroup) { removePreviousAssignments = false; } - if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.YES) { + if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.YES)) { oldGroup.getGroupNode().setGroup( group, true, removePreviousAssignments, database.getEntries()); - } else if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.NO) { + } else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.NO)) { oldGroup.getGroupNode().setGroup( group, false, removePreviousAssignments, database.getEntries()); - } else if (previousAssignments.isPresent() && previousAssignments.get().getButtonData() == ButtonBar.ButtonData.CANCEL_CLOSE) { + } else if (previousAssignments.isPresent() && (previousAssignments.get().getButtonData() == ButtonBar.ButtonData.CANCEL_CLOSE)) { return; } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index e66b587e6a1..32c2d62ae61 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2506,3 +2506,7 @@ Move\ value=Move value Swap\ values=Swap values Copy\ or\ move\ the\ value\ of\ one\ field\ to\ another=Copy or move the value of one field to another Automatic\ field\ editor=Automatic field editor + +(Note\:\ If\ original\ entries\ lack\ keywords\ to\ qualify\ for\ the\ new\ group\ configuration,\ confirming\ here\ will\ add\ them)=(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them) +Assign=Assign +Do\ not\ assign=Do not assign From bac360d7276b4426b567421de13ba00268c0d5d6 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 28 Jun 2022 20:35:11 +0200 Subject: [PATCH 3/3] add empty line --- src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index 4ee1aa4ea7e..670130757ad 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -202,7 +202,7 @@ public void editGroup(GroupNodeViewModel oldGroup) { ButtonType cancel = new ButtonType(Localization.lang("Cancel"), ButtonBar.ButtonData.CANCEL_CLOSE); if (newGroup.get().getClass() == WordKeywordGroup.class) { - content = content + "\n" + + content = content + "\n\n" + Localization.lang("(Note: If original entries lack keywords to qualify for the new group configuration, confirming here will add them)"); } Optional previousAssignments = dialogService.showCustomButtonDialogAndWait(Alert.AlertType.WARNING,