2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.cms
.ui
.workbench
.jcr
;
19 import java
.nio
.file
.FileSystem
;
20 import java
.nio
.file
.Path
;
21 import java
.nio
.file
.spi
.FileSystemProvider
;
23 import org
.argeo
.cms
.CmsException
;
24 import org
.argeo
.cms
.ui
.workbench
.WorkbenchUiPlugin
;
25 import org
.argeo
.eclipse
.ui
.fs
.SimpleFsBrowser
;
26 import org
.eclipse
.swt
.SWT
;
27 import org
.eclipse
.swt
.widgets
.Composite
;
28 import org
.eclipse
.ui
.part
.ViewPart
;
30 /** Browse the node file system. */
31 public class NodeFsBrowserView
extends ViewPart
{
32 public final static String ID
= WorkbenchUiPlugin
.PLUGIN_ID
+ ".nodeFsBrowserView";
34 private FileSystemProvider nodeFileSystemProvider
;
37 public void createPartControl(Composite parent
) {
39 URI uri
= new URI("node:///");
40 FileSystem fileSystem
= nodeFileSystemProvider
.getFileSystem(uri
);
41 if (fileSystem
== null)
42 fileSystem
= nodeFileSystemProvider
.newFileSystem(uri
, null);
43 Path nodePath
= fileSystem
.getPath("~");
44 SimpleFsBrowser browser
= new SimpleFsBrowser(parent
, SWT
.NO_FOCUS
);
45 browser
.setInput(nodePath
);
46 } catch (Exception e
) {
47 throw new CmsException("Cannot open file system browser", e
);
52 public void setFocus() {
55 public void setNodeFileSystemProvider(FileSystemProvider nodeFileSystemProvider
) {
56 this.nodeFileSystemProvider
= nodeFileSystemProvider
;