MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getDescendantSelectedPaths

Method getDescendantSelectedPaths

unused/javax/swing/JTree.java:3740–3763  ·  view source on GitHub ↗

Returns an array of paths in the selection that are descendants of path . The returned array may contain null s.

(TreePath path,
                                                  boolean includePath)

Source from the content-addressed store, hash-verified

3738 * <code>path</code>. The returned array may contain <code>null</code>s.
3739 */
3740 private TreePath[] getDescendantSelectedPaths(TreePath path,
3741 boolean includePath) {
3742 TreeSelectionModel sm = getSelectionModel();
3743 TreePath[] selPaths = (sm != null) ? sm.getSelectionPaths() :
3744 null;
3745
3746 if(selPaths != null) {
3747 boolean shouldRemove = false;
3748
3749 for(int counter = selPaths.length - 1; counter >= 0; counter--) {
3750 if(selPaths[counter] != null &&
3751 path.isDescendant(selPaths[counter]) &&
3752 (!path.equals(selPaths[counter]) || includePath))
3753 shouldRemove = true;
3754 else
3755 selPaths[counter] = null;
3756 }
3757 if(!shouldRemove) {
3758 selPaths = null;
3759 }
3760 return selPaths;
3761 }
3762 return null;
3763 }
3764
3765 /**
3766 * Removes any paths from the selection model that are descendants of

Callers 1

Calls 3

getSelectionModelMethod · 0.95
equalsMethod · 0.65
getSelectionPathsMethod · 0.45

Tested by

no test coverage detected