}
public JTreeNode addTestSuite(String directory) {
// check first if the directory is already added or its parent
//logger.trace("Adding '" + directory + "'" + " directory into the test campaign");
TCTreeNode rootNode = (TCTreeNode)this.getRoot();
Enumeration<?> childNodes = rootNode.children();
while (childNodes.hasMoreElements()){
TCTreeNode childNode = (TCTreeNode)childNodes.nextElement();
JTreeNode child = (JTreeNode)childNode.getUserObject();
if (isTestSuite(child, directory)) {
//logger.trace(directory + "'" + " already defined in the current test campaign, so skip it");
return getTestSuite(directory);
}
}
// check if the parent dir is already added
File testsuiteDirFile = new File(directory);
if (checkIfParentAdded(testsuiteDirFile)) {
//logger.trace(directory + "'" + " already defined in another test suite within the current test campaign, so skip it");
return null;
}
// check if child of this directory is already added, if yes, remove the previous child
removeIfChildAdded(directory);
FileNode childFileNode = new FileNode(testsuiteDirFile, testsuiteDirFile.getName(),TESTUITE_DIR);
childFileNode.setShowTestdata(true);
TCTreeNode testsuiteNode = new TCTreeNode(childFileNode, true);
// add this node to the root node
// current list
int currentIndex = testsuiteDir.size();
testsuiteDir.add(testsuiteNode);