Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-04-23 05:11:41 -0400
committerTobias Schwarz2014-04-23 05:11:41 -0400
commit79624d4bedf7d19d2463102b50bbc557b369720e (patch)
treeb1b08450f98649eb67a5a5bad95ddae211a91712
parent79b5d65007b4be4998e140487a0d7b5756fb5568 (diff)
downloadorg.eclipse.tcf-79624d4bedf7d19d2463102b50bbc557b369720e.tar.gz
org.eclipse.tcf-79624d4bedf7d19d2463102b50bbc557b369720e.tar.xz
org.eclipse.tcf-79624d4bedf7d19d2463102b50bbc557b369720e.zip
Target Explorer: rework modelmanager, model and folder selection dialog
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.xml45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java154
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java238
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSModel.java149
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ITreeNodeModel.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java228
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java45
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java71
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java126
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java120
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties4
30 files changed, 965 insertions, 491 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF
index 12f5c61b5..1b97b748e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/META-INF/MANIFEST.MF
@@ -15,13 +15,15 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.3.0",
org.eclipse.tcf.te.tcf.locator;bundle-version="1.3.0",
- org.eclipse.tcf.te.runtime.stepper;bundle-version="1.3.0"
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.3.0",
+ org.eclipse.tcf.te.tcf.core.model;bundle-version="1.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.filesystem.core.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.filesystem.core.interfaces,
+ org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime,
org.eclipse.tcf.te.tcf.filesystem.core.interfaces.steps,
org.eclipse.tcf.te.tcf.filesystem.core.internal;x-internal:=true,
org.eclipse.tcf.te.tcf.filesystem.core.internal.callbacks;x-friends:="org.eclipse.tcf.te.tests",
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.properties
index 2807b0345..15a271aae 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.properties
@@ -12,3 +12,5 @@ providerName = Eclipse.org - Target Explorer
pluginName = Target Explorer, TCF File System Extensions Core
FileTransferStep.name=Transfer File
+InitializeModelStep.name=Initialize Filesystem Runtime Model
+DisposeModelStep.name=Dispose Filesystem Runtime Model
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.xml
index 4bd6a3acf..f7214da16 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/plugin.xml
@@ -58,6 +58,51 @@
label="%FileTransferStep.name">
<requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
</step>
+
+ <step
+ class="org.eclipse.tcf.te.tcf.filesystem.core.steps.InitializeModelStep"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ label="%InitializeModelStep.name">
+ </step>
+ <step
+ class="org.eclipse.tcf.te.tcf.filesystem.core.steps.DisposeModelStep"
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ label="%DisposeModelStep.name">
+ </step>
</extension>
+<!-- Step group contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.locator.connectNoAttachStepGroup"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.disconnectStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.locator.stopSimulatorStep"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectionRecoveringStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.initializeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.locator.waitForReadyStep"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup id="org.eclipse.tcf.te.tcf.locator.connectionLostStepGroup">
+ <references>
+ <reference
+ id="org.eclipse.tcf.te.tcf.filesystem.core.disposeModelStep"
+ insertAfter="org.eclipse.tcf.te.tcf.core.shutDownStep"/>
+ </references>
+ </stepGroup>
+ </extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java
new file mode 100644
index 000000000..c89068eb4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime;
+
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
+
+
+/**
+ * A model dealing with the filesystem at runtime.
+ */
+public interface IRuntimeModel extends IModel, IPeerNodeProvider {
+
+ /**
+ * Get the root node of the peer model.
+ *
+ * @return The root node.
+ */
+ public FSTreeNode getRoot();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java
index d5a9e856d..9f855b939 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java
@@ -121,7 +121,7 @@ public abstract class OpCreate extends Operation {
}
/**
- * Add the new node to the folder and its FSModel.
+ * Add the new node to the folder and its RuntimeModel.
*
* @param service The file system service to be used.
* @throws TCFFileSystemException Thrown when adding.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java
index 58ee9a1d6..78d21f0ef 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java
@@ -17,7 +17,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneOpen;
import org.eclipse.tcf.services.IFileSystem.FileSystemException;
import org.eclipse.tcf.services.IFileSystem.IFileHandle;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
@@ -76,6 +76,6 @@ public class OpCreateFile extends OpCreate {
*/
@Override
protected FSTreeNode newTreeNode() {
- return FSModel.createFileNode(name, folder);
+ return RuntimeModel.createFileNode(name, folder);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java
index 1f3f86b9e..c04102c8e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java
@@ -15,7 +15,7 @@ import org.eclipse.tcf.services.IFileSystem;
import org.eclipse.tcf.services.IFileSystem.DoneMkDir;
import org.eclipse.tcf.services.IFileSystem.FileSystemException;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFFileSystemException;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
/**
@@ -64,7 +64,7 @@ public class OpCreateFolder extends OpCreate {
*/
@Override
protected FSTreeNode newTreeNode() {
- FSTreeNode node = FSModel.createFolderNode(name, folder);
+ FSTreeNode node = RuntimeModel.createFolderNode(name, folder);
// Newly created folder does not have any children. Mark it as queried.
node.queryDone();
return node;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java
index ac95f6678..625f37747 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpParsePath.java
@@ -24,7 +24,6 @@ import org.eclipse.tcf.te.runtime.utils.Host;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
@@ -137,7 +136,7 @@ public class OpParsePath extends Operation {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (peer != null && path != null) {
- final FSTreeNode root = FSModel.getFSModel(peer).getRoot();
+ final FSTreeNode root = org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager.getRuntimeModel(peer).getRoot();
if (!root.childrenQueried) {
new NullOpExecutor().execute(new OpRefreshRoots(root));
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java
index e7ba276b5..c561bc5f2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefreshRoots.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations;
-
-/**
- * The file operation class to create the root node in the file system of Target Explorer.
- */
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IFileSystem;
-import org.eclipse.tcf.services.IFileSystem.DirEntry;
-import org.eclipse.tcf.services.IFileSystem.FileSystemException;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-
-/**
- * The operation to refresh the root of the file system.
- */
-public class OpRefreshRoots extends Operation {
- /* default */FSTreeNode root;
-
- /**
- * Create an instance using the peer model.
- *
- * @param peerModel The peer model.
- */
- public OpRefreshRoots(FSTreeNode root) {
- this.root = root;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- super.run(monitor);
- IChannel channel = null;
- try {
- channel = openChannel(root.peerNode.getPeer());
- IFileSystem service = getBlockingFileSystem(channel);
- if (service != null) {
- root.queryStarted();
- service.roots(new IFileSystem.DoneRoots() {
- @Override
- public void doneRoots(IToken token, FileSystemException error, DirEntry[] entries) {
- if (error == null) {
- for (DirEntry entry : entries) {
- FSTreeNode node = new FSTreeNode(root, entry, true);
- root.addChild(node);
- }
- }
- }
- });
- // Reset the children query markers
- root.queryDone();
- }
- }
- catch(TCFChannelException e) {
- throw new InvocationTargetException(e);
- }
- finally {
- if (channel != null) Tcf.getChannelManager().closeChannel(channel);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations;
+
+/**
+ * The file operation class to create the root node in the file system of Target Explorer.
+ */
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DirEntry;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+
+/**
+ * The operation to refresh the root of the file system.
+ */
+public class OpRefreshRoots extends Operation {
+ /* default */FSTreeNode root;
+
+ /**
+ * Create an instance using the peer model.
+ *
+ * @param peerModel The peer model.
+ */
+ public OpRefreshRoots(FSTreeNode root) {
+ this.root = root;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ super.run(monitor);
+ IChannel channel = null;
+ try {
+ channel = openChannel(root.peerNode.getPeer());
+ IFileSystem service = getBlockingFileSystem(channel);
+ if (service != null) {
+ root.queryStarted();
+ service.roots(new IFileSystem.DoneRoots() {
+ @Override
+ public void doneRoots(IToken token, FileSystemException error, DirEntry[] entries) {
+ if (error == null) {
+ for (DirEntry entry : entries) {
+ FSTreeNode node = new FSTreeNode(root, entry, true);
+ root.addChild(node);
+ }
+ }
+ }
+ });
+ // Reset the children query markers
+ root.queryDone();
+ }
+ }
+ catch(TCFChannelException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ if (channel != null) Tcf.getChannelManager().closeChannel(channel);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java
index f949c2dfd..7073f2bff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfOutputStream.java
@@ -1,119 +1,119 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Chen (Wind River) - [345552] Edit the remote files with a proper editor
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.internal.url;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IFileSystem.DoneWrite;
-import org.eclipse.tcf.services.IFileSystem.FileSystemException;
-import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
-
-/**
- * The TCF output stream returned by {@link TcfURLConnection#getOutputStream()}.
- */
-public class TcfOutputStream extends OutputStream {
- // Default chunk size while pumping the data.
- private static final int DEFAULT_CHUNK_SIZE = 5 * 1024;
-
- // Current writing position
- long position;
- // The byte array used to buffer data.
- byte[] buffer;
- // The offset being written in the buffer.
- int offset;
-
- // If the stream has been closed.
- boolean closed;
- // The current error during writing.
- Exception ERROR;
-
- // The URL Connection
- TcfURLConnection connection;
- /**
- * Create a TCF output stream connected the specified peer with specified
- * path to the remote resource.
- *
- * @param peer
- * The TCF agent peer.
- * @param path
- * The path to the remote resource.
- */
- public TcfOutputStream(TcfURLConnection connection) {
- this(connection, DEFAULT_CHUNK_SIZE);
- }
-
- /**
- * Create a TCF output stream connected the specified peer with specified
- * path to the remote resource using the specified buffer size.
- *
- * @param peer
- * The TCF agent peer.
- * @param path
- * The path to the remote resource.
- * @param chunk_size
- * The buffer size.
- */
- public TcfOutputStream(TcfURLConnection connection, int chunk_size) {
- this.connection = connection;
- buffer = new byte[chunk_size];
- offset = 0;
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- @Override
- public void write(int b) throws IOException {
- if (closed)
- throw new IOException(Messages.TcfOutputStream_StreamClosed);
- if (ERROR != null) {
- IOException exception = new IOException(ERROR.toString());
- exception.initCause(ERROR);
- throw exception;
- }
- if (offset < buffer.length) {
- buffer[offset++] = (byte) b;
- }
- if (offset == buffer.length)
- flush();
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- @Override
- public void flush() throws IOException {
- if (offset > 0) {
- connection.service.write(connection.handle, position, buffer, 0, offset, new DoneWrite() {
- @Override
- public void doneWrite(IToken token, FileSystemException error) {
- if (error != null) {
- ERROR = error;
- }
- position += offset;
- offset = 0;
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
- @Override
- public void close() throws IOException {
- if (!closed) {
- connection.closeStream(this);
- closed = true;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William Chen (Wind River) - [345552] Edit the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.url;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem.DoneWrite;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+
+/**
+ * The TCF output stream returned by {@link TcfURLConnection#getOutputStream()}.
+ */
+public class TcfOutputStream extends OutputStream {
+ // Default chunk size while pumping the data.
+ private static final int DEFAULT_CHUNK_SIZE = 5 * 1024;
+
+ // Current writing position
+ long position;
+ // The byte array used to buffer data.
+ byte[] buffer;
+ // The offset being written in the buffer.
+ int offset;
+
+ // If the stream has been closed.
+ boolean closed;
+ // The current error during writing.
+ Exception ERROR;
+
+ // The URL Connection
+ TcfURLConnection connection;
+ /**
+ * Create a TCF output stream connected the specified peer with specified
+ * path to the remote resource.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ */
+ public TcfOutputStream(TcfURLConnection connection) {
+ this(connection, DEFAULT_CHUNK_SIZE);
+ }
+
+ /**
+ * Create a TCF output stream connected the specified peer with specified
+ * path to the remote resource using the specified buffer size.
+ *
+ * @param peer
+ * The TCF agent peer.
+ * @param path
+ * The path to the remote resource.
+ * @param chunk_size
+ * The buffer size.
+ */
+ public TcfOutputStream(TcfURLConnection connection, int chunk_size) {
+ this.connection = connection;
+ buffer = new byte[chunk_size];
+ offset = 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#write(int)
+ */
+ @Override
+ public void write(int b) throws IOException {
+ if (closed)
+ throw new IOException(Messages.TcfOutputStream_StreamClosed);
+ if (ERROR != null) {
+ IOException exception = new IOException(ERROR.toString());
+ exception.initCause(ERROR);
+ throw exception;
+ }
+ if (offset < buffer.length) {
+ buffer[offset++] = (byte) b;
+ }
+ if (offset == buffer.length)
+ flush();
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#flush()
+ */
+ @Override
+ public void flush() throws IOException {
+ if (offset > 0) {
+ connection.service.write(connection.handle, position, buffer, 0, offset, new DoneWrite() {
+ @Override
+ public void doneWrite(IToken token, FileSystemException error) {
+ if (error != null) {
+ ERROR = error;
+ }
+ position += offset;
+ offset = 0;
+ }
+ });
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException {
+ if (!closed) {
+ connection.closeStream(this);
+ closed = true;
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java
index a47959be0..01fd7a72a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/AbstractTreeNode.java
@@ -266,6 +266,9 @@ public abstract class AbstractTreeNode extends PlatformObject {
* @param callback The callback object, or <code>null</code> when callback is not needed.
*/
public void refresh(ICallback callback) {
+ if (childrenQueryRunning) {
+ return;
+ }
queryStarted();
Map<String, Boolean> flags = new HashMap<String, Boolean>();
flags.put(IChannelManager.FLAG_NO_PATH_MAP, Boolean.TRUE);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSModel.java
deleted file mode 100644
index f2799bb87..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/FSModel.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.model;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
-import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-
-/**
- * The file system model implementation.
- */
-public final class FSModel implements ITreeNodeModel {
- /* default */static final String FSMODEL_KEY = CorePlugin.getUniqueIdentifier() + ".file.system"; //$NON-NLS-1$
-
- /**
- * Get the file system model of the peer model. If it does not
- * exist yet, create a new instance and store it.
- *
- * @param peerNode The peer model
- * @return The file system model connected this peer model.
- */
- public static FSModel getFSModel(final IPeerNode peerNode) {
- final AtomicReference<FSModel> model = new AtomicReference<FSModel>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (peerNode != null) {
- model.set((FSModel) peerNode.getProperty(FSMODEL_KEY));
- if (model.get() == null) {
- model.set(new FSModel(peerNode));
- peerNode.setProperty(FSMODEL_KEY, model.get());
- }
- }
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return model.get();
- }
-
- // The root node of the peer model
- private FSTreeNode root;
- private IPeerNode peerNode;
- /**
- * Create a File System ModelManager.
- */
- /* default */ FSModel(IPeerNode peerNode) {
- this.peerNode = peerNode;
- }
-
- /**
- * Get the root node of the peer model.
- *
- * @return The root node.
- */
- @Override
- public FSTreeNode getRoot() {
- if(root == null) {
- root = createRoot();
- }
- return root;
- }
-
- /**
- * Create a root node for the specified peer.
- *
- * @param peerNode The peer.
- */
- /* default */ FSTreeNode createRoot() {
- if (Protocol.isDispatchThread()) {
- return createRootNode(peerNode);
- }
- else {
- final AtomicReference<FSTreeNode> ref = new AtomicReference<FSTreeNode>();
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- ref.set(createRoot());
- }
- });
- return ref.get();
- }
- }
-
- /**
- * Create a root node for the peer.
- *
- * @param peerNode The peer.
- * @return The root file system node.
- */
- public static FSTreeNode createRootNode(IPeerNode peerNode) {
- FSTreeNode node = new FSTreeNode();
- node.type = "FSRootNode"; //$NON-NLS-1$
- node.peerNode = peerNode;
- node.name = Messages.FSTreeNodeContentProvider_rootNode_label;
- return node;
- }
-
- /**
- * Create a file node under the folder specified folder using the new name.
- *
- * @param name The file's name.
- * @param folder The parent folder.
- * @return The file tree node.
- */
- public static FSTreeNode createFileNode(String name, FSTreeNode folder) {
- return createTreeNode(name, "FSFileNode", folder); //$NON-NLS-1$
- }
-
- /**
- * Create a folder node under the folder specified folder using the new name.
- *
- * @param name The folder's name.
- * @param folder The parent folder.
- * @return The folder tree node.
- */
- public static FSTreeNode createFolderNode(String name, FSTreeNode folder) {
- return createTreeNode(name, "FSDirNode", folder); //$NON-NLS-1$
- }
-
- /**
- * Create a tree node under the folder specified folder using the new name.
- *
- * @param name The tree node's name.
- * @param type The new node's type.
- * @param folder The parent folder.
- * @return The tree node.
- */
- private static FSTreeNode createTreeNode(String name, String type, FSTreeNode folder) {
- FSTreeNode node = new FSTreeNode();
- node.name = name;
- node.parent = folder;
- node.peerNode = folder.peerNode;
- node.type = type;
- return node;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ITreeNodeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ITreeNodeModel.java
deleted file mode 100644
index 4c0dc8625..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ITreeNodeModel.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.model;
-
-/**
- * The model for holding the root of the whole trees.
- */
-public interface ITreeNodeModel {
- /**
- * Get the root node of the whole tree.
- *
- * @return The root node.
- */
- AbstractTreeNode getRoot();
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java
new file mode 100644
index 000000000..cc0a5056e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * Filesystem service model manager implementation.
+ */
+public class ModelManager {
+ // Reference to the runtime models
+ /* default */ static final Map<String, IRuntimeModel> runtimeModels = new HashMap<String, IRuntimeModel>();
+
+ /**
+ * Returns the runtime model instance for the given peer model
+ * <p>
+ * If not yet initialized, a new runtime model will be initialized before returning.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ * @return The runtime model.
+ */
+ public static IRuntimeModel getRuntimeModel(final IPeerNode peerNode) {
+ Assert.isNotNull(peerNode);
+
+ // The result reference holder
+ final AtomicReference<IRuntimeModel> runtimeModel = new AtomicReference<IRuntimeModel>();
+
+ // Create the runnable to execute
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Assert.isTrue(Protocol.isDispatchThread());
+
+ // Get the peer id
+ String id = peerNode.getPeerId();
+ // Lookup the runtime model instance
+ IRuntimeModel candidate = runtimeModels.get(id);
+ // Initialize a new runtime model instance if necessary
+ if (candidate == null) {
+ candidate = initializeRuntimeModel(peerNode);
+ if (candidate != null) runtimeModels.put(id, candidate);
+ }
+ // Store to the result reference holder
+ runtimeModel.set(candidate);
+ }
+ };
+
+ // Execute the runnable
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return runtimeModel.get();
+ }
+
+ /**
+ * Initialize the runtime model.
+ * <p>
+ * Must be called within the TCF dispatch thread.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ * @return The runtime model.
+ */
+ protected static IRuntimeModel initializeRuntimeModel(IPeerNode peerNode) {
+ Assert.isTrue(Protocol.isDispatchThread());
+ IRuntimeModel runtimeModel = new RuntimeModel(peerNode);
+ return runtimeModel;
+ }
+
+ /**
+ * Dispose the runtime model.
+ *
+ * @param peerNode The peer model instance. Must not be <code>null</code>.
+ */
+ public static void disposeRuntimeModel(final IPeerNode peerNode) {
+ Assert.isNotNull(peerNode);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Assert.isTrue(Protocol.isDispatchThread());
+
+ // Get the peer id
+ String id = peerNode.getPeerId();
+ // Lookup the runtime model instance
+ IRuntimeModel candidate = runtimeModels.remove(id);
+ // Dispose it
+ if (candidate != null) candidate.dispose();
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
new file mode 100644
index 000000000..359d8c413
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.model;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.factory.Factory;
+import org.eclipse.tcf.te.runtime.model.interfaces.factory.IFactory;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelService;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * The file system model implementation.
+ */
+public final class RuntimeModel extends ContainerModelNode implements IRuntimeModel {
+ // Flag to mark the model disposed
+ private boolean disposed;
+
+ // Reference to the model node factory
+ private IFactory factory = null;
+
+ // The root node of the peer model
+ private FSTreeNode root;
+ private IPeerNode peerNode;
+
+ /**
+ * Create a File System ModelManager.
+ */
+ public RuntimeModel(IPeerNode peerNode) {
+ disposed = false;
+ this.peerNode = peerNode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.nodes.PropertiesContainer#checkThreadAccess()
+ */
+ @Override
+ protected boolean checkThreadAccess() {
+ return Protocol.isDispatchThread();
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#dispose()
+ */
+ @Override
+ public void dispose() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ disposed = true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#isDisposed()
+ */
+ @Override
+ public boolean isDisposed() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return disposed;
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#getService(java.lang.Class)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V extends IModelService> V getService(Class<V> serviceInterface) {
+ Assert.isNotNull(serviceInterface);
+ return (V)getAdapter(serviceInterface);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IPeerNode.class.isAssignableFrom(adapter) || IConnectable.class.isAssignableFrom(adapter)) {
+ final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peerNode.set(getPeerNode());
+ }
+ });
+ return peerNode.get();
+ }
+
+ return super.getAdapter(adapter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#setFactory(com.windriver.te.tcf.core.model.interfaces.IModelNodeFactory)
+ */
+ @Override
+ public void setFactory(IFactory factory) {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ this.factory = factory;
+ }
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.model.interfaces.IModel#getFactory()
+ */
+ @Override
+ public IFactory getFactory() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return factory != null ? factory : Factory.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider#getPeerModel()
+ */
+ @Override
+ public IPeerNode getPeerNode() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+ return peerNode;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.model.ModelNode#toString()
+ */
+ @Override
+ public String toString() {
+ if (disposed) {
+ return "*DISPOSED* : " + super.toString(); //$NON-NLS-1$
+ }
+ return super.toString();
+ }
+
+ /**
+ * Get the root node of the peer model.
+ *
+ * @return The root node.
+ */
+ @Override
+ public FSTreeNode getRoot() {
+ if(root == null) {
+ root = createRoot();
+ }
+ return root;
+ }
+
+ /**
+ * Create a root node for the specified peer.
+ *
+ * @param peerNode The peer.
+ */
+ /* default */ FSTreeNode createRoot() {
+ if (Protocol.isDispatchThread()) {
+ return createRootNode(peerNode);
+ }
+ else {
+ final AtomicReference<FSTreeNode> ref = new AtomicReference<FSTreeNode>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ ref.set(createRoot());
+ }
+ });
+ return ref.get();
+ }
+ }
+
+ /**
+ * Create a root node for the peer.
+ *
+ * @param peerNode The peer.
+ * @return The root file system node.
+ */
+ public static FSTreeNode createRootNode(IPeerNode peerNode) {
+ FSTreeNode node = new FSTreeNode();
+ node.type = "FSRootNode"; //$NON-NLS-1$
+ node.peerNode = peerNode;
+ node.name = Messages.FSTreeNodeContentProvider_rootNode_label;
+ return node;
+ }
+
+ /**
+ * Create a file node under the folder specified folder using the new name.
+ *
+ * @param name The file's name.
+ * @param folder The parent folder.
+ * @return The file tree node.
+ */
+ public static FSTreeNode createFileNode(String name, FSTreeNode folder) {
+ return createTreeNode(name, "FSFileNode", folder); //$NON-NLS-1$
+ }
+
+ /**
+ * Create a folder node under the folder specified folder using the new name.
+ *
+ * @param name The folder's name.
+ * @param folder The parent folder.
+ * @return The folder tree node.
+ */
+ public static FSTreeNode createFolderNode(String name, FSTreeNode folder) {
+ return createTreeNode(name, "FSDirNode", folder); //$NON-NLS-1$
+ }
+
+ /**
+ * Create a tree node under the folder specified folder using the new name.
+ *
+ * @param name The tree node's name.
+ * @param type The new node's type.
+ * @param folder The parent folder.
+ * @return The tree node.
+ */
+ private static FSTreeNode createTreeNode(String name, String type, FSTreeNode folder) {
+ FSTreeNode node = new FSTreeNode();
+ node.name = name;
+ node.parent = folder;
+ node.peerNode = folder.peerNode;
+ node.type = type;
+ return node;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java
new file mode 100644
index 000000000..2f03dde9a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/DisposeModelStep.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.steps.AbstractPeerNodeStep;
+
+/**
+ * Dispose the filesytsem runtime model associated with the peer node.
+ */
+public class DisposeModelStep extends AbstractPeerNodeStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ IPeerNode peerNode = getActivePeerModelContext(context, data, fullQualifiedId);
+ if (peerNode != null) ModelManager.disposeRuntimeModel(peerNode);
+ callback.done(this, Status.OK_STATUS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java
new file mode 100644
index 000000000..fa5ea991d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/steps/InitializeModelStep.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelChannelService;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.steps.AbstractPeerNodeStep;
+
+/**
+ * Initialize the filesystem runtime model associated with the peer node.
+ */
+public class InitializeModelStep extends AbstractPeerNodeStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ IPeerNode peerNode = getActivePeerModelContext(context, data, fullQualifiedId);
+ if (peerNode != null) {
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
+ final IModelChannelService service = model != null ? model.getService(IModelChannelService.class) : null;
+ if (service != null) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ service.openChannel(new IModelChannelService.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(Throwable error, IChannel channel) {
+ callback.done(InitializeModelStep.this, StatusHelper.getStatus(error));
+ }
+ });
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ } else {
+ callback.done(InitializeModelStep.this, Status.OK_STATUS);
+ }
+ } else {
+ callback.done(InitializeModelStep.this, Status.OK_STATUS);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
index 069b46f9d..5a9f3ef2a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/activator/UIPlugin.java
@@ -146,6 +146,8 @@ public class UIPlugin extends AbstractUIPlugin implements IPreferenceKeys {
registry.put(ImageConsts.BANNER_IMAGE, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "error.gif"); //$NON-NLS-1$
registry.put(ImageConsts.ERROR_IMAGE, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "refresh.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.REFRESH_IMAGE, ImageDescriptor.createFromURL(url));
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
index 372fec425..00e34dac5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/FSNavigatorContentProvider.java
@@ -11,18 +11,15 @@ package org.eclipse.tcf.te.tcf.filesystem.ui.controls;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.ITreeNodeModel;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
/**
* File system content provider for the common navigator of Target Explorer.
*/
public class FSNavigatorContentProvider extends NavigatorContentProvider {
-
+
/*
* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
@@ -60,15 +57,6 @@ public class FSNavigatorContentProvider extends NavigatorContentProvider {
}
return super.getChildren(parentElement);
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.ui.controls.NavigatorContentProvider#doGetModel(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode)
- */
- @Override
- protected ITreeNodeModel doGetModel(IPeerNode peerNode) {
- return FSModel.getFSModel(peerNode);
- }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java
index 57b7058cd..04416adba 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/NavigatorContentProvider.java
@@ -16,8 +16,9 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.ITreeNodeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
@@ -98,7 +99,7 @@ public abstract class NavigatorContentProvider extends TreeContentProvider impl
if (parentElement instanceof IPeerNode) {
final IPeerNode peerNode = (IPeerNode)parentElement;
- ITreeNodeModel model = doGetModel(peerNode);
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
if (isRootNodeVisible()) {
AbstractTreeNode root = model.getRoot();
if(!root.childrenQueried && !root.childrenQueryRunning) {
@@ -122,14 +123,6 @@ public abstract class NavigatorContentProvider extends TreeContentProvider impl
return NO_ELEMENTS;
}
- /**
- * Get the tree node model for this peer node.
- *
- * @param peerNode The peer node from where to get the model.
- * @return The tree node model.
- */
- protected abstract ITreeNodeModel doGetModel(IPeerNode peerNode);
-
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@@ -150,7 +143,7 @@ public abstract class NavigatorContentProvider extends TreeContentProvider impl
}
else if (element instanceof IPeerNode) {
IPeerNode peerNode = (IPeerNode) element;
- ITreeNodeModel model = doGetModel(peerNode);
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerNode);
AbstractTreeNode root = model.getRoot();
hasChildren = root != null ? hasChildren(root) : true;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
index 9f459db3c..74b68f8ff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSFolderSelectionDialog.java
@@ -9,28 +9,45 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.dialogs;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider;
import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter;
import org.eclipse.tcf.te.tcf.filesystem.ui.interfaces.IFSConstants;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveFilesHandler;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.ui.trees.FilterDescriptor;
import org.eclipse.tcf.te.ui.trees.ViewerStateManager;
import org.eclipse.ui.IDecoratorManager;
@@ -97,8 +114,18 @@ public class FSFolderSelectionDialog extends ElementTreeSelectionDialog {
this.setValidator(new ISelectionStatusValidator() {
@Override
- public IStatus validate(Object[] selection) {
- return isValidFolder(selection);
+ public IStatus validate(final Object[] selection) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ IStatus status = isValidFolder(selection);
+ if (getTreeViewer().getSelection().equals(new StructuredSelection(selection))) {
+ updateStatus(status);
+ }
+ }
+ });
+ return new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), Messages.FSFolderSelectionDialog_validate_message);
}
});
}
@@ -155,16 +182,109 @@ public class FSFolderSelectionDialog extends ElementTreeSelectionDialog {
this.movedNodes = movedNodes;
}
+ @Override
+ public TreeViewer getTreeViewer() {
+ return super.getTreeViewer();
+ }
+
/**
* Create the tree viewer and set it to the label provider.
*/
@Override
protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
TreeViewer viewer = super.doCreateTreeViewer(parent, style);
+ viewer.getTree().addKeyListener(new KeyAdapter() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.F5) {
+ refresh();
+ }
+ }
+ });
viewer.getTree().setLinesVisible(false);
- return viewer;
+
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ IAction action = new Action(Messages.FSFolderSelectionDialog_Refresh_menu, UIPlugin.getImageDescriptor(ImageConsts.REFRESH_IMAGE)) {
+ @Override
+ public void run() {
+ refresh();
+ }
+ };
+ action.setAccelerator(SWT.F5);
+ manager.add(action);
+ manager.add(new Action(Messages.FSFolderSelectionDialog_RefreshAll_menu) {
+ @Override
+ public void run() {
+ refreshModel();
+ }
+ });
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+
+ return viewer;
+ }
+
+ public void refresh() {
+ ISelection sel = getTreeViewer().getSelection();
+ if (sel instanceof IStructuredSelection && !sel.isEmpty()) {
+ Iterator<Object> it = ((IStructuredSelection)sel).iterator();
+ while (it.hasNext()) {
+ Object node = it.next();
+ if (node instanceof FSTreeNode) {
+ refreshNode((FSTreeNode)node);
+ }
+ else {
+ refreshModel();
+ return;
+ }
+ }
+ }
+ else {
+ refreshModel();
+ }
}
+ protected void refreshNode(final FSTreeNode treeNode) {
+ treeNode.refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getTreeViewer().refresh(treeNode, true);
+ }
+ });
+ }
+ });
+ }
+
+ protected void refreshModel() {
+ Object input = getTreeViewer().getInput();
+ if (input instanceof IPeerNode) {
+ ModelManager.getRuntimeModel((IPeerNode)input).getRoot().refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ getTreeViewer().refresh(true);
+ }
+ });
+ }
+ });
+ }
+ }
+
+
/**
* If the specified selection is a valid folder to be selected.
*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
index 21c08aba4..5b2629c27 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/dialogs/FSOpenFileDialog.java
@@ -25,8 +25,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider;
import org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeViewerSorter;
@@ -119,7 +120,7 @@ public class FSOpenFileDialog extends ElementTreeSelectionDialog {
IPath path = new Path(filterPath);
if (viewer.getInput() instanceof IPeerNode) {
Object element = null;
- FSModel model = FSModel.getFSModel((IPeerNode)viewer.getInput());
+ IRuntimeModel model = ModelManager.getRuntimeModel((IPeerNode)viewer.getInput());
if (model != null) {
FSTreeNode root = model.getRoot();
ITreeContentProvider contentProvider = (ITreeContentProvider)viewer.getContentProvider();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
index f7bc1f08e..ea2240380 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/ImageConsts.java
@@ -80,4 +80,6 @@ public interface ImageConsts {
* The key to access the error image used in the tool tip popped up during renaming.
*/
public static final String ERROR_IMAGE = "ErrorImage"; //$NON-NLS-1$
+
+ public static final String REFRESH_IMAGE = "RefreshImage"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java
index 34e6d8ebb..3b3a67e01 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeFactory.java
@@ -14,7 +14,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
@@ -37,7 +36,7 @@ public class FSTreeNodeFactory implements IElementFactory {
if(peerNode != null) {
String path = memento.getString("path"); //$NON-NLS-1$
if(path == null) {
- return FSModel.getFSModel(peerNode).getRoot();
+ return org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager.getRuntimeModel(peerNode).getRoot();
}
OpParsePath op = new OpParsePath(peerNode, path);
IOpExecutor executor = new NullOpExecutor();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
index 2cf77ec4b..2a3d832de 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java
@@ -31,6 +31,7 @@ import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy;
@@ -38,8 +39,8 @@ import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpMove;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.MoveCopyCallback;
@@ -47,13 +48,13 @@ import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
import org.eclipse.ui.PlatformUI;
/**
- * Common DnD operations shared by File Explorer and Target Explorer.
+ * Common DnD operations shared by File Explorer and Target Explorer.
*/
public class CommonDnD implements IConfirmCallback {
/**
* If the current selection is draggable.
- *
+ *
* @param selection The currently selected nodes.
* @return true if it is draggable.
*/
@@ -72,7 +73,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* If the specified object is a draggable element.
- *
+ *
* @param object The object to be dragged.
* @return true if it is draggable.
*/
@@ -86,7 +87,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Perform the drop operation over dragged files to the specified target folder.
- *
+ *
* @param viewer the tree viewer to be refreshed after dragging.
* @param files The files being dropped.
* @param operations the current dnd operations.
@@ -123,7 +124,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Get the callback that refresh and select the files being dragged when the dragging gesture is
* copying.
- *
+ *
* @param viewer the tree viewer to be refreshed after dragging.
* @param files The files being dragged.
* @param target The target folder to drag the files to.
@@ -144,7 +145,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Get the callback that delete the dragged source files, refresh and select the files being
* dragged when the dragging gesture is moving.
- *
+ *
* @param viewer the tree viewer to be refreshed after dragging.
* @param files The files being dragged.
* @param target The target folder to drag the files to.
@@ -161,9 +162,9 @@ public class CommonDnD implements IConfirmCallback {
successful &= file.delete();
}
if (successful) {
- FSTreeNode root = FSModel.getFSModel(target.peerNode).getRoot();
+ IRuntimeModel model = ModelManager.getRuntimeModel(target.peerNode);
IOpExecutor executor = new JobExecutor(getSelectionCallback(viewer, files, target));
- executor.execute(new OpRefresh(root));
+ executor.execute(new OpRefresh(model.getRoot()));
}
}
}
@@ -172,7 +173,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Get the callback that refresh the files being dragged after moving or copying.
- *
+ *
* @param viewer the tree viewer to be refreshed after dragging.
* @param paths The paths of the files being dragged.
* @param target The target folder to drag the files to.
@@ -205,7 +206,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Update the tree viewer after DnD and select the nodes that being dropped.
- *
+ *
* @param viewer The tree viewer in which the DnD takes place.
* @param target The target node that the drop operation happens.
* @param nodes The nodes that are being dropped.
@@ -224,10 +225,10 @@ public class CommonDnD implements IConfirmCallback {
}});
}
}
-
+
/**
* Perform the drop operation over dragged selection.
- *
+ *
* @param aTarget the target Object to be moved to.
* @param operations the current dnd operations.
* @param selection The local selection being dropped.
@@ -265,7 +266,7 @@ public class CommonDnD implements IConfirmCallback {
* node. If the hovered node is a file, then return its parent directory. If the hovered node is
* a directory, then return its self if it is not a node being copied. Return its parent
* directory if it is a node being copied.
- *
+ *
* @param hovered
* @param nodes
* @return
@@ -286,7 +287,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Validate dropping when the elements being dragged are files.
- *
+ *
* @param target The target object.
* @param operation The DnD operation.
* @param transferType The transfered data simulator.
@@ -309,7 +310,7 @@ public class CommonDnD implements IConfirmCallback {
/**
* Validate dropping when the elements being dragged are local selection.
- *
+ *
* @param target The target object.
* @param operation The DnD operation.
* @param transferType The transfered data simulator.
@@ -367,8 +368,8 @@ public class CommonDnD implements IConfirmCallback {
String title = Messages.FSUpload_OverwriteTitle;
String message = NLS.bind(Messages.FSUpload_OverwriteConfirmation, file.getName());
final Image titleImage = UIPlugin.getImage(ImageConsts.DELETE_READONLY_CONFIRM);
- MessageDialog qDialog = new MessageDialog(parent, title, null, message,
- MessageDialog.QUESTION, new String[] {Messages.FSUpload_Yes,
+ MessageDialog qDialog = new MessageDialog(parent, title, null, message,
+ MessageDialog.QUESTION, new String[] {Messages.FSUpload_Yes,
Messages.FSUpload_YesToAll, Messages.FSUpload_No, Messages.FSUpload_Cancel}, 0) {
@Override
public Image getQuestionImage() {
@@ -380,7 +381,7 @@ public class CommonDnD implements IConfirmCallback {
});
return results[0];
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
@@ -389,7 +390,7 @@ public class CommonDnD implements IConfirmCallback {
if (LocalSelectionTransfer.getTransfer().isSupportedType(anEvent.dataType)) {
anEvent.data = LocalSelectionTransfer.getTransfer().getSelection();
return true;
- }
+ }
else if (FileTransfer.getInstance().isSupportedType(anEvent.dataType)) {
IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
List<FSTreeNode> nodes = selection.toList();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
index 1ec29d0cc..5cd226d37 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/RefreshViewerHandler.java
@@ -15,8 +15,8 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.JobExecutor;
import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -25,7 +25,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
* The action handler to refresh the whole file system tree.
*/
public class RefreshViewerHandler extends AbstractHandler {
-
+
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
@@ -35,7 +35,7 @@ public class RefreshViewerHandler extends AbstractHandler {
IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
IPeerNode peer = (IPeerNode) editorInput.getAdapter(IPeerNode.class);
if (peer != null) {
- FSTreeNode root = FSModel.getFSModel(peer).getRoot();
+ FSTreeNode root = ModelManager.getRuntimeModel(peer).getRoot();
if (root != null) {
IOpExecutor executor = new JobExecutor();
executor.execute(new OpRefresh(root));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
index d3dcb4bb6..77f665422 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
@@ -10,7 +10,7 @@
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.pages;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.ui.editor.AbstractTreeViewerExplorerEditorPage;
@@ -66,6 +66,6 @@ public class FSExplorerEditorPage extends AbstractTreeViewerExplorerEditorPage {
if (peerNode == null && element instanceof IAdaptable) {
peerNode = (IPeerNode)((IAdaptable)element).getAdapter(IPeerNode.class);
}
- return peerNode != null ? FSModel.getFSModel(peerNode).getRoot() : null;
+ return peerNode != null ? ModelManager.getRuntimeModel(peerNode).getRoot() : null;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
index a3ffc8af2..dc011aa23 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/wizards/FolderValidator.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-
-/**
- * The validator to validate the path of the parent directory in the new file/folder wizard
- * page is valid. It is only when it is not empty and it exists in the target peer.
- *
- * @see Validator
- */
-public class FolderValidator extends Validator {
- // The wizard page to create the new node.
- private NewNodeWizardPage page;
-
- /**
- * Create a folder validator of the specified wizard page.
- *
- * @param page The wizard page to create the new file/folder.
- */
- public FolderValidator(NewNodeWizardPage page) {
- super(ATTR_MANDATORY);
- this.page = page;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
- */
- @Override
- public boolean isValid(String newText) {
- if (newText == null || newText.trim().length() == 0) {
- setMessage(Messages.FolderValidator_SpecifyFolder, IMessageProvider.ERROR);
- return false;
- }
- FSTreeNode folder = page.getInputDir();
- if (folder == null) {
- setMessage(NLS.bind(Messages.FolderValidator_DirNotExist, newText), IMessageProvider.ERROR);
- return false;
- }
- if (!folder.isWritable()) {
- setMessage(NLS.bind(Messages.FolderValidator_NotWritable, newText), IMessageProvider.ERROR);
- return false;
- }
- setMessage(null, IMessageProvider.NONE);
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator to validate the path of the parent directory in the new file/folder wizard
+ * page is valid. It is only when it is not empty and it exists in the target peer.
+ *
+ * @see Validator
+ */
+public class FolderValidator extends Validator {
+ // The wizard page to create the new node.
+ private NewNodeWizardPage page;
+
+ /**
+ * Create a folder validator of the specified wizard page.
+ *
+ * @param page The wizard page to create the new file/folder.
+ */
+ public FolderValidator(NewNodeWizardPage page) {
+ super(ATTR_MANDATORY);
+ this.page = page;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ if (newText == null || newText.trim().length() == 0) {
+ setMessage(Messages.FolderValidator_SpecifyFolder, IMessageProvider.ERROR);
+ return false;
+ }
+ FSTreeNode folder = page.getInputDir();
+ if (folder == null) {
+ setMessage(NLS.bind(Messages.FolderValidator_DirNotExist, newText), IMessageProvider.ERROR);
+ return false;
+ }
+ if (!folder.isWritable()) {
+ setMessage(NLS.bind(Messages.FolderValidator_NotWritable, newText), IMessageProvider.ERROR);
+ return false;
+ }
+ setMessage(null, IMessageProvider.NONE);
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
index 9ca9893b9..a445f9483 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -67,6 +67,10 @@ public class Messages extends NLS {
}
public static String FSFolderSelectionDialog_MoveDialogMessage;
public static String FSFolderSelectionDialog_MoveDialogTitle;
+ public static String FSFolderSelectionDialog_Refresh_menu;
+ public static String FSFolderSelectionDialog_RefreshAll_menu;
+ public static String FSFolderSelectionDialog_validate_message;
+
public static String FSOpenFileDialog_message;
public static String FSOpenFileDialog_title;
public static String FSDelete_ConfirmDelete;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
index 0430f0e76..80ce61911 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
@@ -9,6 +9,10 @@
###############################################################################
FSFolderSelectionDialog_MoveDialogMessage=Choose destination for the files to be moved:
FSFolderSelectionDialog_MoveDialogTitle=Move Files and Folders
+FSFolderSelectionDialog_Refresh_menu=Refresh
+FSFolderSelectionDialog_RefreshAll_menu=Refresh All
+FSFolderSelectionDialog_validate_message=Query folder attributes...
+
FSOpenFileDialog_message=Please select an image file for the process.
FSOpenFileDialog_title=Select Process Image
FSDelete_ConfirmDelete=Confirm Delete

Back to the top