ArrayList<DataPath> dataPaths = new ArrayList<DataPath>();
findDataItemsRecursive(getRootNode(), new ArrayList<String>(), dataPaths);
if (dataPaths.size() == 0) {
throw new ActionException("Nothing to export");
} else {
for (DataPath dataPath : dataPaths) {
Collection<String> path = dataPath.getPath();
DataTreeNode dataNode = dataPath.getDataNode();
StringBuilder name = new StringBuilder(200);
boolean first = true;
for (String nodeName : path) {
if (first) {
first = false;
} else {
name.append(".");
}
name.append(nodeName);
}
addNode(dataNode, name.toString());
}
try {
matlabExporter.write(file);
} catch (IOException e) {
throw new ActionException("Error writing file: " + e.getMessage(), e);
}
}
}