/** * Expand module to run tree to selected JMeterTreeNode and set selection path to it * @param selected - referenced module to run */ private void focusSelectedOnTree(JMeterTreeNode selected) { TreeNode[] path = selected.getPath(); TreeNode[] filteredPath = new TreeNode[path.length-1]; //ignore first element of path - WorkBench, (why WorkBench is appearing in the path ???) System.arraycopy(path, 1, filteredPath, 0, path.length - 1); DefaultMutableTreeNode root = (DefaultMutableTreeNode) moduleToRunTreeNodes.getModel().getRoot(); //treepath of test plan tree and module to run tree cannot be compared directly - moduleToRunTreeModel.getPathToRoot() //custom method for finding an JMeterTreeNode element in DefaultMutableTreeNode have to be used TreeNode[] dmtnPath = this.findPathInTreeModel(1, filteredPath, root); if (dmtnPath.length > 0) { TreePath treePath = new TreePath(dmtnPath); moduleToRunTreeNodes.setSelectionPath(treePath); moduleToRunTreeNodes.scrollPathToVisible(treePath); } }
return child.getPath(); } else { return findPathInTreeModel(level + 1, testPlanPath, child);