From 875678beb5e9b0927b8b26f7f23362a2a88069cf Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Tue, 14 Mar 2017 17:02:06 +0100 Subject: [PATCH] Some formatting stuff --- .../jabref/gui/groups/AddToGroupAction.java | 15 ++++---- .../gui/groups/EntryTableTransferHandler.java | 12 +----- .../gui/groups/GroupAddRemoveDialog.java | 2 - .../jabref/gui/groups/GroupDescriptions.java | 38 +++++++++---------- .../org/jabref/gui/groups/GroupSelector.java | 37 ++++++++++-------- .../gui/groups/GroupTreeCellRenderer.java | 5 +-- .../gui/groups/GroupTreeNodeViewModel.java | 34 ++++++++--------- .../jabref/gui/groups/GroupTreeViewModel.java | 9 +++-- .../org/jabref/gui/groups/GroupsTree.java | 12 +++--- .../gui/groups/RemoveFromGroupAction.java | 1 - .../gui/groups/UndoableAddOrRemoveGroup.java | 3 -- .../groups/UndoableChangeEntriesOfGroup.java | 26 ++++++------- 12 files changed, 90 insertions(+), 104 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/AddToGroupAction.java b/src/main/java/org/jabref/gui/groups/AddToGroupAction.java index 82739578f89..0952ea367af 100644 --- a/src/main/java/org/jabref/gui/groups/AddToGroupAction.java +++ b/src/main/java/org/jabref/gui/groups/AddToGroupAction.java @@ -35,8 +35,8 @@ public AddToGroupAction(GroupTreeNodeViewModel node, boolean move, BasePanel pan } public AddToGroupAction(boolean move) { - super(move ? Localization.lang("Assign entry selection exclusively to this group") : - Localization.lang("Add entry selection to this group")); + super(move ? Localization.lang("Assign entry selection exclusively to this group") : Localization + .lang("Add entry selection to this group")); this.move = move; } @@ -73,11 +73,10 @@ public void actionPerformed(ActionEvent evt) { } private void moveToGroup(List entries, NamedCompound undoAll) { - List affectedGroups = - node.getNode().getRoot().getContainingGroups(entries, false).stream() - .map(GroupTreeNode::getGroup) - .filter(group -> group instanceof GroupEntryChanger) - .collect(Collectors.toList()); + List affectedGroups = node.getNode().getRoot().getContainingGroups(entries, false).stream() + .map(GroupTreeNode::getGroup) + .filter(group -> group instanceof GroupEntryChanger) + .collect(Collectors.toList()); affectedGroups.add(node.getNode().getGroup()); if (!WarnAssignmentSideEffects.warnAssignmentSideEffects(affectedGroups, panel.frame())) { return; // user aborted operation @@ -85,7 +84,7 @@ private void moveToGroup(List entries, NamedCompound undoAll) { // first remove for (AbstractGroup group : affectedGroups) { - GroupEntryChanger entryChanger = (GroupEntryChanger)group; + GroupEntryChanger entryChanger = (GroupEntryChanger) group; List changes = entryChanger.remove(entries); if (!changes.isEmpty()) { undoAll.addEdit(UndoableChangeEntriesOfGroup.getUndoableEdit(node, changes)); diff --git a/src/main/java/org/jabref/gui/groups/EntryTableTransferHandler.java b/src/main/java/org/jabref/gui/groups/EntryTableTransferHandler.java index 213436683f9..84d0844cd5d 100644 --- a/src/main/java/org/jabref/gui/groups/EntryTableTransferHandler.java +++ b/src/main/java/org/jabref/gui/groups/EntryTableTransferHandler.java @@ -43,22 +43,14 @@ public class EntryTableTransferHandler extends TransferHandler { private final MainTable entryTable; - private final JabRefFrame frame; - private final BasePanel panel; - private DataFlavor urlFlavor; - private final DataFlavor stringFlavor; - private static final boolean DROP_ALLOWED = true; - private static final Log LOGGER = LogFactory.getLog(EntryTableTransferHandler.class); - private boolean draggingFile; - /** * Construct the transfer handler. * @@ -174,14 +166,12 @@ public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { return false; } - - @Override public void exportAsDrag(JComponent comp, InputEvent e, int action) { if (e instanceof MouseEvent) { int columnIndex = entryTable.columnAtPoint(((MouseEvent) e).getPoint()); int modelIndex = entryTable.getColumnModel().getColumn(columnIndex).getModelIndex(); - if(entryTable.isFileColumn(modelIndex)) { + if (entryTable.isFileColumn(modelIndex)) { LOGGER.info("Dragging file"); draggingFile = true; } diff --git a/src/main/java/org/jabref/gui/groups/GroupAddRemoveDialog.java b/src/main/java/org/jabref/gui/groups/GroupAddRemoveDialog.java index 8a8d7382b7f..ad08815ebf3 100644 --- a/src/main/java/org/jabref/gui/groups/GroupAddRemoveDialog.java +++ b/src/main/java/org/jabref/gui/groups/GroupAddRemoveDialog.java @@ -47,7 +47,6 @@ public class GroupAddRemoveDialog implements BaseAction { private List selection; private JTree tree; - public GroupAddRemoveDialog(BasePanel panel, boolean add, boolean move) { this.panel = panel; this.add = add; @@ -199,7 +198,6 @@ private boolean checkGroupEnable(GroupTreeNodeViewModel node) { return (add ? node.canAddEntries(selection) : node.canRemoveEntries(selection)); } - class AddRemoveGroupTreeCellRenderer extends GroupTreeCellRenderer { @Override diff --git a/src/main/java/org/jabref/gui/groups/GroupDescriptions.java b/src/main/java/org/jabref/gui/groups/GroupDescriptions.java index f78e158cac4..0918a5880a9 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDescriptions.java +++ b/src/main/java/org/jabref/gui/groups/GroupDescriptions.java @@ -9,25 +9,25 @@ public class GroupDescriptions { public static String getDescriptionForPreview(String field, String expr, boolean caseSensitive, boolean regExp) { - String header = regExp ? Localization.lang("This group contains entries whose %0 field contains the regular expression %1", - field, StringUtil.quoteForHTML(expr)) - : Localization.lang("This group contains entries whose %0 field contains the keyword %1", - field, StringUtil.quoteForHTML(expr)); - String caseSensitiveText = caseSensitive ? Localization.lang("case sensitive") : - Localization.lang("case insensitive"); - String footer = regExp ? - Localization.lang("Entries cannot be manually assigned to or removed from this group.") - : Localization.lang( - "Additionally, entries whose %0 field does not contain " - + "%1 can be assigned manually to this group by selecting them " - + "then using either drag and drop or the context menu. " - + "This process adds the term %1 to " - + "each entry's %0 field. " - + "Entries can be removed manually from this group by selecting them " - + "then using the context menu. " - + "This process removes the term %1 from " - + "each entry's %0 field.", - field, StringUtil.quoteForHTML(expr)); + String header = regExp ? Localization.lang( + "This group contains entries whose %0 field contains the regular expression %1", + field, StringUtil.quoteForHTML(expr)) : Localization.lang( + "This group contains entries whose %0 field contains the keyword %1", + field, StringUtil.quoteForHTML(expr)); + String caseSensitiveText = caseSensitive ? Localization.lang("case sensitive") : Localization + .lang("case insensitive"); + String footer = regExp ? Localization + .lang("Entries cannot be manually assigned to or removed from this group.") : Localization.lang( + "Additionally, entries whose %0 field does not contain " + + "%1 can be assigned manually to this group by selecting them " + + "then using either drag and drop or the context menu. " + + "This process adds the term %1 to " + + "each entry's %0 field. " + + "Entries can be removed manually from this group by selecting them " + + "then using the context menu. " + + "This process removes the term %1 from " + + "each entry's %0 field.", + field, StringUtil.quoteForHTML(expr)); return String.format("%s (%s). %s", header, caseSensitiveText, footer); } diff --git a/src/main/java/org/jabref/gui/groups/GroupSelector.java b/src/main/java/org/jabref/gui/groups/GroupSelector.java index ecbe1810964..c6a1ed91392 100644 --- a/src/main/java/org/jabref/gui/groups/GroupSelector.java +++ b/src/main/java/org/jabref/gui/groups/GroupSelector.java @@ -126,8 +126,8 @@ public class GroupSelector extends SidePaneComponent implements TreeSelectionLis public GroupSelector(JabRefFrame frame, SidePaneManager manager) { super(manager, IconTheme.JabRefIcon.TOGGLE_GROUPS.getIcon(), Localization.lang("Groups")); - Globals.stateManager.activeGroupProperty().addListener((observable, oldValue, newValue) -> updateShownEntriesAccordingToSelectedGroups(newValue)); - + Globals.stateManager.activeGroupProperty() + .addListener((observable, oldValue, newValue) -> updateShownEntriesAccordingToSelectedGroups(newValue)); toggleAction = new ToggleAction(Localization.menuTitle("Toggle groups interface"), Localization.lang("Toggle groups interface"), @@ -142,9 +142,12 @@ public GroupSelector(JabRefFrame frame, SidePaneManager manager) { ButtonGroup nonHits = new ButtonGroup(); nonHits.add(hideNonHits); nonHits.add(grayOut); - floatCb.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS, floatCb.isSelected())); - andCb.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS, andCb.isSelected())); - invCb.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS, invCb.isSelected())); + floatCb.addChangeListener( + event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS, floatCb.isSelected())); + andCb.addChangeListener( + event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS, andCb.isSelected())); + invCb.addChangeListener( + event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS, invCb.isSelected())); showOverlappingGroups.addChangeListener(new ChangeListener() { @Override @@ -156,7 +159,8 @@ public void stateChanged(ChangeEvent event) { } }); - grayOut.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.GRAY_OUT_NON_HITS, grayOut.isSelected())); + grayOut.addChangeListener( + event -> Globals.prefs.putBoolean(JabRefPreferences.GRAY_OUT_NON_HITS, grayOut.isSelected())); JRadioButtonMenuItem highlCb = new JRadioButtonMenuItem(Localization.lang("Highlight"), false); if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS)) { @@ -176,7 +180,8 @@ public void stateChanged(ChangeEvent event) { andCb.setSelected(false); } - autoAssignGroup.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP, autoAssignGroup.isSelected())); + autoAssignGroup.addChangeListener( + event -> Globals.prefs.putBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP, autoAssignGroup.isSelected())); invCb.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS)); showOverlappingGroups.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_OVERLAPPING)); @@ -258,8 +263,8 @@ public void stateChanged(ChangeEvent event) { JScrollPane groupsTreePane = new JScrollPane(groupsTree, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - groupsTreePane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); - groupsTreePane.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); + groupsTreePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + groupsTreePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); con.gridwidth = GridBagConstraints.REMAINDER; con.weighty = 1; con.gridx = 0; @@ -284,10 +289,8 @@ public void stateChanged(ChangeEvent event) { moveNodeRightAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK)); - setGroups(GroupTreeNode.fromGroup(DefaultGroupsFactory.getAllEntriesGroup())); - JFXPanel groupsPane = new JFXPanel(); add(groupsPane); // Execute on JavaFX Application Thread @@ -483,7 +486,7 @@ private void updateShownEntriesAccordingToSelectedGroups() { final MatcherSet searchRules = MatcherSets .build(andCb.isSelected() ? MatcherSets.MatcherType.AND : MatcherSets.MatcherType.OR); - for(GroupTreeNodeViewModel node : getLeafsOfSelection()) { + for (GroupTreeNodeViewModel node : getLeafsOfSelection()) { SearchMatcher searchRule = node.getNode().getSearchMatcher(); searchRules.addRule(searchRule); } @@ -506,7 +509,7 @@ private void updateShownEntriesAccordingToSelectedGroups(Optional private List getLeafsOfSelection() { TreePath[] selection = groupsTree.getSelectionPaths(); - if((selection == null) || (selection.length == 0)) { + if ((selection == null) || (selection.length == 0)) { return new ArrayList<>(); } @@ -916,7 +919,8 @@ public void actionPerformed(ActionEvent e) { JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); boolean keepPreviousAssignments = (i == JOptionPane.YES_OPTION) && WarnAssignmentSideEffects.warnAssignmentSideEffects(newGroup, panel.frame()); - boolean removePreviousAssignents = (oldGroup instanceof ExplicitGroup) && (newGroup instanceof ExplicitGroup); + boolean removePreviousAssignents = (oldGroup instanceof ExplicitGroup) + && (newGroup instanceof ExplicitGroup); AbstractUndoableEdit undoAddPreviousEntries = null; UndoableModifyGroup undo = new UndoableModifyGroup(GroupSelector.this, groupsRoot, node, newGroup); @@ -964,7 +968,8 @@ public void actionPerformed(ActionEvent e) { if (node == null) { groupsRoot.getNode().addChild(newNode); } else { - ((GroupTreeNodeViewModel)node.getParent()).getNode().addChild(newNode, node.getNode().getPositionInParent() + 1); + ((GroupTreeNodeViewModel) node.getParent()).getNode().addChild(newNode, + node.getNode().getPositionInParent() + 1); } UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, new GroupTreeNodeViewModel(newNode), UndoableAddOrRemoveGroup.ADD_NODE); @@ -1016,7 +1021,7 @@ public void actionPerformed(ActionEvent e) { if (conf == JOptionPane.YES_OPTION) { final UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(groupsRoot, node, UndoableAddOrRemoveGroup.REMOVE_NODE_KEEP_CHILDREN); - final GroupTreeNodeViewModel parent = (GroupTreeNodeViewModel)node.getParent(); + final GroupTreeNodeViewModel parent = (GroupTreeNodeViewModel) node.getParent(); node.getNode().removeFromParent(); node.getNode().moveAllChildrenTo(parent.getNode(), parent.getIndex(node)); diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeCellRenderer.java b/src/main/java/org/jabref/gui/groups/GroupTreeCellRenderer.java index 811b46499fc..d85a649e8ce 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeCellRenderer.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeCellRenderer.java @@ -28,7 +28,6 @@ public class GroupTreeCellRenderer extends DefaultTreeCellRenderer { private List matchingGroups = new ArrayList<>(); private Object highlightBorderCell; - @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean tmpHasFocus) { @@ -96,7 +95,7 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean } private boolean printInRed(GroupTreeNodeViewModel viewModel) { - if(viewModel.isAllEntriesGroup()) { + if (viewModel.isAllEntriesGroup()) { // Do not print all entries group in red return false; } @@ -105,7 +104,7 @@ private boolean printInRed(GroupTreeNodeViewModel viewModel) { } private boolean printUnderlined(GroupTreeNodeViewModel viewModel) { - if(viewModel.isAllEntriesGroup()) { + if (viewModel.isAllEntriesGroup()) { // Do not underline all entries group return false; } diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeNodeViewModel.java index 173a2849d26..5383817d075 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeNodeViewModel.java @@ -50,7 +50,7 @@ public class GroupTreeNodeViewModel implements Transferable, TreeNode { DataFlavor df = null; try { df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType - + ";class="+GroupTreeNode.class.getCanonicalName()); + + ";class=" + GroupTreeNode.class.getCanonicalName()); } catch (ClassNotFoundException e) { LOGGER.error("Creating DataFlavor failed. This should not happen.", e); } @@ -108,11 +108,11 @@ public TreeNode getParent() { @Override public int getIndex(TreeNode child) { - if(! (child instanceof GroupTreeNodeViewModel)) { + if (!(child instanceof GroupTreeNodeViewModel)) { return -1; } - GroupTreeNodeViewModel childViewModel = (GroupTreeNodeViewModel)child; + GroupTreeNodeViewModel childViewModel = (GroupTreeNodeViewModel) child; return node.getIndexOfChild(childViewModel.getNode()).orElse(-1); } @@ -127,7 +127,7 @@ public boolean isLeaf() { } @Override - public Enumeration children() { + public Enumeration children() { Iterable children = node.getChildren(); return new Enumeration() { @@ -159,21 +159,21 @@ public void collapseSubtree(JTree tree) { public void expandSubtree(JTree tree) { tree.expandPath(this.getTreePath()); - for(GroupTreeNodeViewModel child : getChildren()) { + for (GroupTreeNodeViewModel child : getChildren()) { child.expandSubtree(tree); } } public List getChildren() { List children = new ArrayList<>(); - for(GroupTreeNode child : node.getChildren()) { + for (GroupTreeNode child : node.getChildren()) { children.add(new GroupTreeNodeViewModel(child)); } return children; } protected boolean printInItalics() { - return Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_DYNAMIC) && node.getGroup().isDynamic(); + return Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_DYNAMIC) && node.getGroup().isDynamic(); } public String getDescription() { @@ -213,11 +213,11 @@ public TreePath getTreePath() { } public boolean canAddEntries(List entries) { - return getNode().getGroup() instanceof GroupEntryChanger && !getNode().getGroup().containsAll(entries); + return (getNode().getGroup() instanceof GroupEntryChanger) && !getNode().getGroup().containsAll(entries); } public boolean canRemoveEntries(List entries) { - return getNode().getGroup() instanceof GroupEntryChanger && getNode().getGroup().containsAny(entries); + return (getNode().getGroup() instanceof GroupEntryChanger) && getNode().getGroup().containsAny(entries); } public void sortChildrenByName(boolean recursive) { @@ -355,7 +355,7 @@ public Optional moveLeft() { final Optional grandParent = parent.getParent(); final int index = node.getPositionInParent(); - if (! grandParent.isPresent()) { + if (!grandParent.isPresent()) { return Optional.empty(); } final int indexOfParent = grandParent.get().getIndexOfChild(parent).get(); @@ -380,10 +380,9 @@ public Optional moveRight() { * Adds the given entries to this node's group. */ public List addEntriesToGroup(List entries) { - if(node.getGroup() instanceof GroupEntryChanger) { - return ((GroupEntryChanger)node.getGroup()).add(entries); - } - else { + if (node.getGroup() instanceof GroupEntryChanger) { + return ((GroupEntryChanger) node.getGroup()).add(entries); + } else { return Collections.emptyList(); } } @@ -392,10 +391,9 @@ public List addEntriesToGroup(List entries) { * Removes the given entries from this node's group. */ public List removeEntriesFromGroup(List entries) { - if(node.getGroup() instanceof GroupEntryChanger) { - return ((GroupEntryChanger)node.getGroup()).remove(entries); - } - else { + if (node.getGroup() instanceof GroupEntryChanger) { + return ((GroupEntryChanger) node.getGroup()).remove(entries); + } else { return Collections.emptyList(); } } diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index e6745830ad7..f3423734725 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -34,11 +34,13 @@ public GroupTreeViewModel(StateManager stateManager, DialogService dialogService this.dialogService = Objects.requireNonNull(dialogService); // Register listener - stateManager.activeDatabaseProperty().addListener((observable, oldValue, newValue) -> onActiveDatabaseChanged(newValue)); + stateManager.activeDatabaseProperty() + .addListener((observable, oldValue, newValue) -> onActiveDatabaseChanged(newValue)); selectedGroup.addListener((observable, oldValue, newValue) -> onSelectedGroupChanged(newValue)); // Set-up bindings - filterPredicate.bind(Bindings.createObjectBinding(() -> group -> group.isMatchedBy(filterText.get()), filterText)); + filterPredicate + .bind(Bindings.createObjectBinding(() -> group -> group.isMatchedBy(filterText.get()), filterText)); // Init onActiveDatabaseChanged(stateManager.activeDatabaseProperty().getValue()); @@ -100,7 +102,8 @@ private void onActiveDatabaseChanged(Optional newDatabase) { rootGroup.setValue(newRoot); stateManager.getSelectedGroup(newDatabase.get()).ifPresent( - selectedGroup -> this.selectedGroup.setValue(new GroupNodeViewModel(newDatabase.get(), stateManager, selectedGroup))); + selectedGroup -> this.selectedGroup + .setValue(new GroupNodeViewModel(newDatabase.get(), stateManager, selectedGroup))); } currentDatabase = newDatabase; diff --git a/src/main/java/org/jabref/gui/groups/GroupsTree.java b/src/main/java/org/jabref/gui/groups/GroupsTree.java index a485276031f..a911e4290f7 100644 --- a/src/main/java/org/jabref/gui/groups/GroupsTree.java +++ b/src/main/java/org/jabref/gui/groups/GroupsTree.java @@ -59,7 +59,6 @@ public class GroupsTree extends JTree implements DragSourceListener, private long idleStartTime; private GroupTreeNodeViewModel dragNode; - /** * @param groupSelector the parent UI component */ @@ -90,7 +89,8 @@ public void dragEnter(DragSourceDragEvent dsde) { /** This is for moving of nodes within myself */ @Override - public void dragOver(DragSourceDragEvent dsde) {} + public void dragOver(DragSourceDragEvent dsde) { + } @Override public void dropActionChanged(DragSourceDragEvent dsde) { @@ -228,7 +228,7 @@ private GroupTreeNodeViewModel getSelectedNode() { * @return Refreshed paths that are all valid. */ public Enumeration refreshPaths(Enumeration paths) { - if(paths == null) { + if (paths == null) { return new Vector().elements(); } @@ -298,8 +298,7 @@ public void sort(GroupTreeNodeViewModel node, boolean recursive) { public boolean hasExpandedDescendant(TreePath path) { GroupTreeNodeViewModel node = (GroupTreeNodeViewModel) path.getLastPathComponent(); for (GroupTreeNodeViewModel child : node.getChildren()) { - if (child.isLeaf()) - { + if (child.isLeaf()) { continue; // don't care about this case } TreePath pathToChild = path.pathByAddingChild(child); @@ -317,8 +316,7 @@ public boolean hasExpandedDescendant(TreePath path) { public boolean hasCollapsedDescendant(TreePath path) { GroupTreeNodeViewModel node = (GroupTreeNodeViewModel) path.getLastPathComponent(); for (GroupTreeNodeViewModel child : node.getChildren()) { - if (child.isLeaf()) - { + if (child.isLeaf()) { continue; // don't care about this case } TreePath pathToChild = path.pathByAddingChild(child); diff --git a/src/main/java/org/jabref/gui/groups/RemoveFromGroupAction.java b/src/main/java/org/jabref/gui/groups/RemoveFromGroupAction.java index 456156d23a3..a279b16ab5b 100644 --- a/src/main/java/org/jabref/gui/groups/RemoveFromGroupAction.java +++ b/src/main/java/org/jabref/gui/groups/RemoveFromGroupAction.java @@ -14,7 +14,6 @@ public class RemoveFromGroupAction extends AbstractAction { private GroupTreeNodeViewModel mNode; private BasePanel mPanel; - public RemoveFromGroupAction(GroupTreeNodeViewModel node, BasePanel panel) { super(node.getNode().getGroup().getName()); mNode = node; diff --git a/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java b/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java index 86e6c81e52f..14a91547a35 100644 --- a/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java +++ b/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java @@ -31,7 +31,6 @@ class UndoableAddOrRemoveGroup extends AbstractUndoableJabRefEdit { /** Removal of a node and all of its children. */ public static final int REMOVE_NODE_AND_CHILDREN = 2; - /** * Creates an object that can undo/redo an edit event. * @@ -62,7 +61,6 @@ public UndoableAddOrRemoveGroup(GroupTreeNodeViewModel groupsRoot, m_pathToNode = editedNode.getNode().getIndexedPathFromRoot(); } - @Override public String getPresentationName() { switch (m_editType) { @@ -78,7 +76,6 @@ public String getPresentationName() { return "? (" + Localization.lang("unknown edit") + ")"; } - @Override public void undo() { super.undo(); diff --git a/src/main/java/org/jabref/gui/groups/UndoableChangeEntriesOfGroup.java b/src/main/java/org/jabref/gui/groups/UndoableChangeEntriesOfGroup.java index cded5254d61..85bc697b0ef 100644 --- a/src/main/java/org/jabref/gui/groups/UndoableChangeEntriesOfGroup.java +++ b/src/main/java/org/jabref/gui/groups/UndoableChangeEntriesOfGroup.java @@ -11,18 +11,18 @@ public class UndoableChangeEntriesOfGroup { - public static AbstractUndoableEdit getUndoableEdit(GroupTreeNodeViewModel node, List changes) { - boolean hasEntryChanges = false; - NamedCompound entryChangeCompound = new NamedCompound(Localization.lang("change entries of group")); - for(FieldChange fieldChange : changes) { - hasEntryChanges = true; - entryChangeCompound.addEdit(new UndoableFieldChange(fieldChange)); - } - if (hasEntryChanges) { - entryChangeCompound.end(); - return entryChangeCompound; - } + public static AbstractUndoableEdit getUndoableEdit(GroupTreeNodeViewModel node, List changes) { + boolean hasEntryChanges = false; + NamedCompound entryChangeCompound = new NamedCompound(Localization.lang("change entries of group")); + for (FieldChange fieldChange : changes) { + hasEntryChanges = true; + entryChangeCompound.addEdit(new UndoableFieldChange(fieldChange)); + } + if (hasEntryChanges) { + entryChangeCompound.end(); + return entryChangeCompound; + } - return null; - } + return null; + } }