X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.eclipse.ui%2Fsrc%2Forg%2Fargeo%2Feclipse%2Fui%2Ffs%2FFsTableViewer.java;h=3b126e90bcdcc33dcc1b380e22f228f76a31ceb4;hb=503f2f9ae7bc2167a3c41d1937fc63c299c16027;hp=3476739bcbd2e24fdc0a95607e23f2fb47418eb6;hpb=d2e617c3adda3874dd0fbc26ebe83f64814293c1;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java index 3476739bc..3b126e90b 100644 --- a/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java +++ b/org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/fs/FsTableViewer.java @@ -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;