private RemoteFilesystemTreeData(File[] files)
{
setModelType(TreeModelType.CHILDREN);
TreeNode hiddenRoot = new TreeNode();
setRoot(hiddenRoot);
DirectoryNode fsRemoteRoot = new DirectoryNode(new File("/"));
add(fsRemoteRoot, hiddenRoot);
if(files != null)
{
for(File file:files)
{
String path = file.getAbsolutePath();
if(path.startsWith("/"))
path = path.substring(1);
if(path.startsWith("@"))
{
path = "@/" + path.substring(1);
}
String[] segments = path.split("/");
DirectoryNode parent = fsRemoteRoot;
if(segments != null)
{
String pathName = "";
for(int i =0; i< segments.length; i++) // String segment:segments)
{
if(!segments[i].equals(""))
{
if(!(i == 1 && segments[0].equals("@")))
pathName += "/";
pathName += segments[i];
DirectoryNode child = new DirectoryNode(new File(pathName));
add(child,parent);
this.openFolder(parent);
parent = child;
}
}