diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9cbdc129c..36ef36dedad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,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 improved the message explaining the options when modifying an automatic keyword group [#8911](https://github.com/JabRef/jabref/issues/8911) - We moved the preferences option "Warn about duplicates on import" option from the tab "File" to the tab "Import and Export". [kopper#570](https://github.com/koppor/jabref/issues/570) ### Fixed @@ -51,7 +52,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 where the Sidepane(groups, web search and open office) width is not remembered after restarting JabRef. [#8907](https://github.com/JabRef/jabref/issues/8907) +- We fixed an issue where the Sidepane (groups, web search and open office) width is not remembered after restarting JabRef. [#8907](https://github.com/JabRef/jabref/issues/8907) - We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939) ### Removed diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index 6ac27b40419..670130757ad 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("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) { + 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, 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 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