private void fillTree() {
List<String> deviceList = null;
try {
deviceList = match();
} catch (Exception e) {
currentRootNode = new BasicTreeNode();
currentRootNode.setName("ERROR");
currentRootNode.setImage(errorImage);
}
if ((deviceList != null) && (tree != null)) {
ITreeNode rootNode = new BasicTreeNode();
rootNode.setName(rootName);
for (String path : deviceList) {
String[] pathSplit = path.split("/");
ITreeNode currentNode = rootNode;
String nodePath = null;
String el = null;
for (String element : pathSplit) {
el = element;
ITreeNode node = null;
for (ITreeNode child : currentNode.getChildren()) {
if (child.getName().equals(el)) {
node = child;
}
}
if (node == null) {
node = new BasicTreeNode();
}
node.setName(el);
ITreeNode[] childToAdd = new ITreeNode[1];
childToAdd[0] = node;
currentNode.addNodes(childToAdd);