You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Latest development branch build (please note build date below)
Operating system
Windows
Details on version and operating system
Windows 21H2, jabref build date: 22/10/22
Checked with the latest development build
I made a backup of my libraries before testing the latest development version.
I have tested the latest development version and the problem persists
Steps to reproduce the behaviour
Create new library
In new library, create 2 groups
Select first group using left click
Right click on second group
Options for second group show up
Click Remove group > Also remove subgroups or Remove group > keep subgroups
First group is deleted, second group is kept
The group passed to removeGroupKeepSubgroups and removeGroupAndSubgroups is only used for dialog text, selectedGroups is used for all actual removals.
Potential solutions could be to check that clicked group is part of selected groups, or to update context menu and dialogs to reflect selected groups more accurately.
public void removeGroupKeepSubgroups(GroupNodeViewModel group) {
boolean confirmed;
if (selectedGroups.size() <= 1) {
confirmed = dialogService.showConfirmationDialogAndWait(
Localization.lang("Remove group"),
Localization.lang("Remove group \"%0\" and keep its subgroups?", group.getDisplayName()),
Localization.lang("Remove"));
} else {
confirmed = dialogService.showConfirmationDialogAndWait(
Localization.lang("Remove groups"),
Localization.lang("Remove all selected groups and keep their subgroups?"),
Localization.lang("Remove all"));
}
if (confirmed) {
// TODO: Add undo
// final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_KEEP_CHILDREN);
// panel.getUndoManager().addEdit(undo);
List<GroupNodeViewModel> selectedGroupNodes = new ArrayList<>(selectedGroups);
selectedGroupNodes.forEach(eachNode -> {
GroupTreeNode groupNode = eachNode.getGroupNode();
groupNode.getParent()
.ifPresent(parent -> groupNode.moveAllChildrenTo(parent, parent.getIndexOfChild(groupNode).get()));
groupNode.removeFromParent();
});
if (selectedGroupNodes.size() > 1) {
dialogService.notify(Localization.lang("Removed all selected groups."));
} else {
dialogService.notify(Localization.lang("Removed group \"%0\".", group.getDisplayName()));
}
writeGroupChangesToMetaData();
}
}
public void removeGroupAndSubgroups(GroupNodeViewModel group) {
boolean confirmed;
if (selectedGroups.size() <= 1) {
confirmed = dialogService.showConfirmationDialogAndWait(
Localization.lang("Remove group and subgroups"),
Localization.lang("Remove group \"%0\" and its subgroups?", group.getDisplayName()),
Localization.lang("Remove"));
} else {
confirmed = dialogService.showConfirmationDialogAndWait(
Localization.lang("Remove groups and subgroups"),
Localization.lang("Remove all selected groups and their subgroups?"),
Localization.lang("Remove all"));
}
if (confirmed) {
// TODO: Add undo
// final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_AND_CHILDREN);
// panel.getUndoManager().addEdit(undo);
ArrayList<GroupNodeViewModel> selectedGroupNodes = new ArrayList<>(selectedGroups);
selectedGroupNodes.forEach(eachNode -> {
removeGroupsAndSubGroupsFromEntries(eachNode);
eachNode.getGroupNode().removeFromParent();
});
if (selectedGroupNodes.size() > 1) {
dialogService.notify(Localization.lang("Removed all selected groups and their subgroups."));
} else {
dialogService.notify(Localization.lang("Removed group \"%0\" and its subgroups.", group.getDisplayName()));
}
writeGroupChangesToMetaData();
}
}
The text was updated successfully, but these errors were encountered:
JabRef version
Latest development branch build (please note build date below)
Operating system
Windows
Details on version and operating system
Windows 21H2, jabref build date: 22/10/22
Checked with the latest development build
Steps to reproduce the behaviour
Remove group > Also remove subgroups
orRemove group > keep subgroups
The
group
passed toremoveGroupKeepSubgroups
andremoveGroupAndSubgroups
is only used for dialog text,selectedGroups
is used for all actual removals.Potential solutions could be to check that clicked group is part of selected groups, or to update context menu and dialogs to reflect selected groups more accurately.
Appendix
Appears to be caused by changes from JabRef#8390.
Problematic methods
org.jabref.gui.groups.GroupTreeViewModel.java:The text was updated successfully, but these errors were encountered: