if started from non-leaf then clear selection from sub-nodes while deselecting

This commit is contained in:
Konstantin Bulenkov
2017-08-25 20:44:41 +03:00
parent 2911df071a
commit 24c55ab528
@@ -103,6 +103,15 @@ public class TreeSmartSelectProvider implements SmartSelectProvider<JTree> {
i++;
}
}
//in case lead selection is not leaf
if (paths.length == tree.getSelectionCount()) {
for (TreePath path : paths) {
tree.removeSelectionPath(path);
}
tree.addSelectionPath(leadSelection);
tree.setLeadSelectionPath(leadSelection);
}
}
private static boolean hasCommonStart(TreePath path, TreePath leadSelection, int commonStartLength) {