]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.e4/src/org/argeo/cms/e4/files/NodeFsBrowserView.java
Move CMS Text framework to Argeo Connect.
[lgpl/argeo-commons.git] / org.argeo.cms.e4 / src / org / argeo / cms / e4 / files / NodeFsBrowserView.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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.cms.CmsException;
28 import org.argeo.eclipse.ui.fs.AdvancedFsBrowser;
29 import org.argeo.eclipse.ui.fs.SimpleFsBrowser;
30 import org.argeo.node.NodeUtils;
31 import org.eclipse.swt.SWT;
32 import org.eclipse.swt.widgets.Composite;
33
34 /** Browse the node file system. */
35 public class NodeFsBrowserView {
36 // public final static String ID = WorkbenchUiPlugin.PLUGIN_ID +
37 // ".nodeFsBrowserView";
38
39 @Inject
40 FileSystemProvider nodeFileSystemProvider;
41
42 @PostConstruct
43 public void createPartControl(Composite parent) {
44 try {
45 //URI uri = new URI("node://root:demo@localhost:7070/");
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 // AdvancedFsBrowser browser = new AdvancedFsBrowser();
57 // browser.createUi(parent, localPath);
58 } catch (Exception e) {
59 throw new CmsException("Cannot open file system browser", e);
60 }
61 }
62
63 public void setFocus() {
64 }
65 }