-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Remove group and subgroups" option #2587
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
18d7448
Add "Remove group and subgroups" option
tobiasdiez 89a95de
Remove old code
tobiasdiez 22c75d1
Implement #1904: filter groups
tobiasdiez f260ce9
Merge branch 'master' of https://github.com/JabRef/jabref into groupR…
tobiasdiez 699ae73
Entries are filtered again correctly
tobiasdiez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,6 @@ public class GroupSelector extends SidePaneComponent implements TreeSelectionLis | |
private final AbstractAction editGroupAction = new EditGroupAction(); | ||
private final NodeAction editGroupPopupAction = new EditGroupAction(); | ||
private final NodeAction addGroupPopupAction = new AddGroupAction(); | ||
private final NodeAction removeGroupAndSubgroupsPopupAction = new RemoveGroupAndSubgroupsAction(); | ||
private final NodeAction removeSubgroupsPopupAction = new RemoveSubgroupsAction(); | ||
private final NodeAction removeGroupKeepSubgroupsPopupAction = new RemoveGroupKeepSubgroupsAction(); | ||
private final NodeAction moveNodeUpPopupAction = new MoveNodeUpAction(); | ||
|
@@ -307,7 +306,6 @@ private void definePopup() { | |
groupsContextMenu.add(editGroupPopupAction); | ||
groupsContextMenu.add(addGroupPopupAction); | ||
groupsContextMenu.addSeparator(); | ||
groupsContextMenu.add(removeGroupAndSubgroupsPopupAction); | ||
groupsContextMenu.add(removeGroupKeepSubgroupsPopupAction); | ||
groupsContextMenu.add(removeSubgroupsPopupAction); | ||
groupsContextMenu.addSeparator(); | ||
|
@@ -383,7 +381,6 @@ private void showPopup(MouseEvent e) { | |
final TreePath path = groupsTree.getPathForLocation(e.getPoint().x, e.getPoint().y); | ||
addGroupPopupAction.setEnabled(true); | ||
editGroupPopupAction.setEnabled(path != null); | ||
removeGroupAndSubgroupsPopupAction.setEnabled(path != null); | ||
removeGroupKeepSubgroupsPopupAction.setEnabled(path != null); | ||
moveSubmenu.setEnabled(path != null); | ||
expandSubtreePopupAction.setEnabled(path != null); | ||
|
@@ -396,7 +393,6 @@ private void showPopup(MouseEvent e) { | |
if (path != null) { // some path dependent enabling/disabling | ||
GroupTreeNodeViewModel node = (GroupTreeNodeViewModel) path.getLastPathComponent(); | ||
editGroupPopupAction.setNode(node); | ||
removeGroupAndSubgroupsPopupAction.setNode(node); | ||
removeSubgroupsPopupAction.setNode(node); | ||
removeGroupKeepSubgroupsPopupAction.setNode(node); | ||
expandSubtreePopupAction.setNode(node); | ||
|
@@ -407,13 +403,13 @@ private void showPopup(MouseEvent e) { | |
if (node.canBeEdited()) { | ||
editGroupPopupAction.setEnabled(false); | ||
addGroupPopupAction.setEnabled(false); | ||
removeGroupAndSubgroupsPopupAction.setEnabled(false); | ||
//removeGroupAndSubgroupsPopupAction.setEnabled(false); | ||
removeGroupKeepSubgroupsPopupAction.setEnabled(false); | ||
} else { | ||
editGroupPopupAction.setEnabled(true); | ||
addGroupPopupAction.setEnabled(true); | ||
addGroupPopupAction.setNode(node); | ||
removeGroupAndSubgroupsPopupAction.setEnabled(true); | ||
//removeGroupAndSubgroupsPopupAction.setEnabled(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only commented out? |
||
removeGroupKeepSubgroupsPopupAction.setEnabled(true); | ||
} | ||
expandSubtreePopupAction | ||
|
@@ -452,7 +448,6 @@ private void showPopup(MouseEvent e) { | |
} else { | ||
editGroupPopupAction.setNode(null); | ||
addGroupPopupAction.setNode(null); | ||
removeGroupAndSubgroupsPopupAction.setNode(null); | ||
removeSubgroupsPopupAction.setNode(null); | ||
removeGroupKeepSubgroupsPopupAction.setNode(null); | ||
moveNodeUpPopupAction.setNode(null); | ||
|
@@ -983,31 +978,6 @@ public void actionPerformed(ActionEvent e) { | |
} | ||
} | ||
|
||
private class RemoveGroupAndSubgroupsAction extends NodeAction { | ||
|
||
public RemoveGroupAndSubgroupsAction() { | ||
super(Localization.lang("Remove group and subgroups")); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
final GroupTreeNodeViewModel node = getNodeToUse(); | ||
final AbstractGroup group = node.getNode().getGroup(); | ||
int conf = JOptionPane.showConfirmDialog(frame, | ||
Localization.lang("Remove group \"%0\" and its subgroups?", group.getName()), | ||
Localization.lang("Remove group and subgroups"), JOptionPane.YES_NO_OPTION); | ||
if (conf == JOptionPane.YES_OPTION) { | ||
final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, | ||
UndoableAddOrRemoveGroup.REMOVE_NODE_AND_CHILDREN); | ||
node.getNode().removeFromParent(); | ||
// Store undo information. | ||
panel.getUndoManager().addEdit(undo); | ||
panel.markBaseChanged(); | ||
frame.output(Localization.lang("Removed group \"%0\" and its subgroups.", group.getName())); | ||
} | ||
} | ||
} | ||
|
||
private class RemoveSubgroupsAction extends NodeAction { | ||
|
||
public RemoveSubgroupsAction() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new button is always enabled which is not what you want. Thus this old code functions as a reminder for myself to change it.