1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.cms.e4.files;
17
18 import java.net.URI;
19 import java.nio.file.FileSystem;
20 import java.nio.file.Path;
21 import java.nio.file.Paths;
22 import java.nio.file.spi.FileSystemProvider;
23
24 import javax.annotation.PostConstruct;
25 import javax.inject.Inject;
26
27 import org.argeo.api.NodeUtils;
28 import org.argeo.cms.CmsException;
29 import org.argeo.eclipse.ui.fs.AdvancedFsBrowser;
30 import org.argeo.eclipse.ui.fs.SimpleFsBrowser;
31 import org.eclipse.swt.SWT;
32 import org.eclipse.swt.widgets.Composite;
33
34
35 public class NodeFsBrowserView {
36
37
38
39 @Inject
40 FileSystemProvider nodeFileSystemProvider;
41
42 @PostConstruct
43 public void createPartControl(Composite parent) {
44 try {
45
46 URI uri = new URI("node:///");
47 FileSystem fileSystem = nodeFileSystemProvider.getFileSystem(uri);
48 if (fileSystem == null)
49 fileSystem = nodeFileSystemProvider.newFileSystem(uri, null);
50 Path nodePath = fileSystem.getPath("/");
51
52 Path localPath = Paths.get(System.getProperty("user.home"));
53
54 SimpleFsBrowser browser = new SimpleFsBrowser(parent, SWT.NO_FOCUS);
55 browser.setInput(nodePath, localPath);
56
57
58 } catch (Exception e) {
59 throw new CmsException("Cannot open file system browser", e);
60 }
61 }
62
63 public void setFocus() {
64 }
65 }