}
private void fillTree() {
List<String> deviceList = match();
if ((deviceList != null) && (tree != null)) {
ITreeNode rootNode = new BasicTreeNode();
rootNode.setName(rootName);
rootNode.setImage(rootImage);
for (String path : deviceList) {
String[] pathSplit = path.split("/");
ITreeNode currentNode = rootNode;
String nodePath = null;
for (String el : pathSplit) {
ITreeNode node = null;
for (ITreeNode child : currentNode.getChildren()) {
if (child.getName().equals(el)) {
node = child;
}
}
if (node == null) {
node = new BasicTreeNode();
}
node.setName(el);
node.setImage(nodeImage);
ITreeNode[] childToAdd = new ITreeNode[1];
childToAdd[0] = node;
currentNode.addNodes(childToAdd);
if (nodePath == null) {
nodePath = el;
} else {
nodePath = nodePath + "/" + el;
}
node.setData(nodePath);
currentNode = node;
}
currentNode.setImage(leafImage);
}
tree.setRootNode(rootNode);