Improve FS UI
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / fs / NioFileLabelProvider.java
index 68fc70b77dae92714aedbd87ef0c14ff51991b55..e2ea90596a33b0ade3abfcd0aa8acf2a449eab71 100644 (file)
@@ -18,8 +18,19 @@ public class NioFileLabelProvider extends ColumnLabelProvider {
 
        @Override
        public String getText(Object element) {
-               Path path = (Path) element;
                try {
+                       if (element instanceof ParentDir) {
+                               switch (propName) {
+                               case FsUiConstants.PROPERTY_SIZE:
+                                       return "-";
+                               case FsUiConstants.PROPERTY_LAST_MODIFIED:
+                                       return Files.getLastModifiedTime(((ParentDir) element).getPath()).toString();
+                               case FsUiConstants.PROPERTY_TYPE:
+                                       return "Folder";
+                               }
+                       }
+
+                       Path path = (Path) element;
                        switch (propName) {
                        case FsUiConstants.PROPERTY_SIZE:
                                if (Files.isDirectory(path))
@@ -42,7 +53,7 @@ public class NioFileLabelProvider extends ColumnLabelProvider {
                                throw new IllegalArgumentException("Unsupported property " + propName);
                        }
                } catch (IOException ioe) {
-                       throw new FsUiException("Cannot get property " + propName + " on " + path.toString());
+                       throw new FsUiException("Cannot get property " + propName + " on " + element);
                }
        }
 }