if (inputElement instanceof TreeSelection) {
TreeSelection selection = (TreeSelection) inputElement;
Object firstElement = selection.getFirstElement();
if (firstElement instanceof RemoteFile) {
RemoteFile remFile = (RemoteFile) firstElement;
if(remFile != null){
directoryName = remFile.getFileItem().getName().getPath();
}
}
}
//System.out.println("Getting children of " + inputElement.getClass().getName());
//TODO: Need to return another array as the files... so its an array of name + Size
Object[] files = fileProvider.getChildren(directoryName,fileFilter);
//add another column?
Object[] retFiles = new Object[files.length];
for (int i = 0; i < files.length; i++) {
Object[] retFile = new Object[2];
retFile[0] = files[i];
if(files[i] instanceof File){
File itemFile = (File)files[i];
retFile[1] = itemFile.length()/1024 + " KB";
}
else if(files[i] instanceof RemoteFile){
RemoteFile itemFile = (RemoteFile)files[i];
retFile[1] = itemFile.size()/1024 + " KB";
}
else {
retFile[1] = "???";
}
retFiles[i] = retFile;