if (!dir.isDirectory()) {
throw new XBayaRuntimeException(dir + "is not a directory.");
}
boolean found = false;
ComponentTreeNode tree = new ComponentTreeNode(dir.getName());
for (File file : dir.listFiles()) {
String fileName = file.getName();
if (file.isDirectory()) {
ComponentTreeNode subTree = getComponentTree(file);
if (subTree != null) {
found = true;
tree.add(subTree);
}
} else if (fileName.endsWith(XBayaConstants.XML_SUFFIX) || fileName.endsWith(XBayaConstants.WSDL_SUFFIX)
|| fileName.endsWith(XBayaConstants.WSDL_SUFFIX2)) {
found = true;
LocalComponentReference componentReference = new LocalComponentReference(file.getName(), file, this);
ComponentTreeNode treeLeaf = new ComponentTreeNode(componentReference);
treeLeaf.setAllowsChildren(false);
tree.add(treeLeaf);
}
}
if (!found) {
// Doesn't show a directory that doesn't have any components.