use of org.pepsoft.worldpainter.mapexplorer.MapRecognizer in project WorldPainter by Captain-Chaos.
the class DirectoryNode method loadChildren.
@Override
protected Node[] loadChildren() {
File[] contents = file.listFiles(showFiles ? null : File::isDirectory);
if (contents != null) {
Node[] children = new Node[contents.length];
for (int i = 0; i < contents.length; i++) {
if (contents[i].isDirectory()) {
for (MapRecognizer mapRecognizer : MAP_RECOGNIZERS) {
if (mapRecognizer.isMap(contents[i])) {
children[i] = mapRecognizer.getMapNode(contents[i]);
break;
}
}
if (children[i] == null) {
children[i] = new DirectoryNode(contents[i], showFiles);
}
} else {
children[i] = new FileSystemNode(contents[i]);
}
}
Arrays.sort(children, (node1, node2) -> COLLATOR.compare(node1.getName(), node2.getName()));
return children;
} else {
return new Node[0];
}
}
Aggregations