Improve files UI
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / fs / FsTableViewer.java
index 3476739bcbd2e24fdc0a95607e23f2fb47418eb6..3b126e90bcdcc33dcc1b380e22f228f76a31ceb4 100644 (file)
@@ -1,6 +1,5 @@
 package org.argeo.eclipse.ui.fs;
 
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
 
@@ -28,6 +27,8 @@ public class FsTableViewer extends TableViewer {
        private boolean reverseOrder = false;
        private String orderProperty = FsUiConstants.PROPERTY_NAME;
 
+       private Path initialPath = null;
+
        public FsTableViewer(Composite parent, int style) {
                super(parent, style | SWT.VIRTUAL);
        }
@@ -88,6 +89,8 @@ public class FsTableViewer extends TableViewer {
                final Object[] res;
                if (isRoot)
                        res = rows;
+               else if (initialPath != null && initialPath.equals(dir))
+                       res = rows;
                else {
                        res = new Object[rows.length + 1];
                        res[0] = new ParentDir(dir.getParent());
@@ -108,6 +111,14 @@ public class FsTableViewer extends TableViewer {
                this.refresh();
        }
 
+       /**
+        * A path which is to be considered as root (and thus provide no link to a
+        * parent directory)
+        */
+       public void setInitialPath(Path initialPath) {
+               this.initialPath = initialPath;
+       }
+
        private class MyLazyCP implements ILazyContentProvider {
                private static final long serialVersionUID = 9096550041395433128L;
                private Object[] elements;