Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2015-07-09 10:54:27 +0000
committerMarkus Schorn2015-07-10 09:33:46 +0000
commitaf5c33ecaa05a95ea90e117f2d684690111fc43f (patch)
tree5415cd158e293c3ae82b6c01f87574e95bc559e9 /target_explorer
parent1c9bd712bfbabca1d1541a6561972e12c665742a (diff)
downloadorg.eclipse.tcf-af5c33ecaa05a95ea90e117f2d684690111fc43f.tar.gz
org.eclipse.tcf-af5c33ecaa05a95ea90e117f2d684690111fc43f.tar.xz
org.eclipse.tcf-af5c33ecaa05a95ea90e117f2d684690111fc43f.zip
Bug 472335: Upgrade tcf-remote to work with org.eclipse.remote 2.0
Change-Id: I29bef7ff99dc5b0665a20f09eb4704b07cbc3c49 Signed-off-by: Markus Schorn <markus.schorn@windriver.com>
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.tcf.remote.feature/feature.xml114
-rw-r--r--target_explorer/features/org.eclipse.tcf.te.tcf.remote.sdk.feature/feature.xml92
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java1341
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java616
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/.settings/org.eclipse.jdt.core.prefs769
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/META-INF/MANIFEST.MF48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/plugin.xml79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnection.java604
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionBase.java102
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionManager.java473
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionWorkingCopy.java155
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFEclipseFileSystem.java127
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileManager.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileStore.java454
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcess.java400
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcessBuilder.java248
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteConnectionType.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteServices.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFServicesFactory.java62
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/activator/CoreBundleActivator.java159
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFFileStoreOperation.java170
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationChildStores.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java176
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/META-INF/MANIFEST.MF42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/plugin.xml47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFFileSystemContributor.java168
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIConnectionService.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileService.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileManager.java)212
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServices.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServicesFactory.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/activator/UIPlugin.java133
31 files changed, 3484 insertions, 3570 deletions
diff --git a/target_explorer/features/org.eclipse.tcf.te.tcf.remote.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.tcf.remote.feature/feature.xml
index da50dbf3f..2758e79b1 100644
--- a/target_explorer/features/org.eclipse.tcf.te.tcf.remote.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.tcf.remote.feature/feature.xml
@@ -1,57 +1,57 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.tcf.te.tcf.remote.feature"
- label="%featureName"
- version="1.4.0.qualifier"
- provider-name="%providerName"
- license-feature="org.eclipse.license"
- license-feature-version="1.0.1.qualifier">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/releases/luna"/>
- </url>
-
- <requires>
- <import plugin="org.eclipse.core.runtime" version="3.8.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.remote.core" version="1.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.core" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.core.filesystem" version="1.3.200" match="greaterOrEqual"/>
- <import plugin="org.eclipse.remote.ui" version="1.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.ui" version="3.8.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.ui.ide" version="3.8.1" match="greaterOrEqual"/>
- <import feature="org.eclipse.remote" version="1.1.0" match="compatible"/>
- <import feature="org.eclipse.tcf.te.tcf.core.feature" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.tcf.locator" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.runtime" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.core" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.runtime.model" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.tcf.core" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.tcf.processes.core" version="1.4.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tcf.te.tcf.remote.core" version="1.4.0" match="greaterOrEqual"/>
- </requires>
-
- <plugin
- id="org.eclipse.tcf.te.tcf.remote.core"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.tcf.te.tcf.remote.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
-</feature>
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.tcf.te.tcf.remote.feature"
+ label="%featureName"
+ version="1.4.0.qualifier"
+ provider-name="%providerName"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.1.qualifier">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/releases/mars"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime" version="3.8.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.remote.core" version="2.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.core" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.filesystem" version="1.3.200" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.remote.ui" version="2.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui" version="3.8.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.ide" version="3.8.1" match="greaterOrEqual"/>
+ <import feature="org.eclipse.remote" version="2.0" match="compatible"/>
+ <import feature="org.eclipse.tcf.te.tcf.core.feature" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.tcf.locator" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.runtime" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.core" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.runtime.model" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.tcf.core" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.tcf.processes.core" version="1.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tcf.te.tcf.remote.core" version="1.4.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.tcf.te.tcf.remote.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.tcf.te.tcf.remote.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+</feature>
diff --git a/target_explorer/features/org.eclipse.tcf.te.tcf.remote.sdk.feature/feature.xml b/target_explorer/features/org.eclipse.tcf.te.tcf.remote.sdk.feature/feature.xml
index ba65ab775..2bdb487a3 100644
--- a/target_explorer/features/org.eclipse.tcf.te.tcf.remote.sdk.feature/feature.xml
+++ b/target_explorer/features/org.eclipse.tcf.te.tcf.remote.sdk.feature/feature.xml
@@ -1,46 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.tcf.te.tcf.remote.sdk.feature"
- label="%featureName"
- version="1.4.0.qualifier"
- provider-name="%providerName"
- license-feature="org.eclipse.license"
- license-feature-version="1.0.1.qualifier">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/releases/luna"/>
- </url>
-
- <requires>
- <import feature="org.eclipse.remote.source" version="1.1.0" match="greaterOrEqual"/>
- <import feature="org.eclipse.tcf.te.tcf.core.sdk.feature" version="1.4.0" match="greaterOrEqual"/>
- <import feature="org.eclipse.tcf.te.tcf.remote.feature" version="1.4.0" match="greaterOrEqual"/>
- </requires>
-
- <plugin
- id="org.eclipse.tcf.te.tcf.remote.core.source"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.tcf.te.tcf.remote.ui.source"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.tcf.te.tcf.remote.sdk.feature"
+ label="%featureName"
+ version="1.4.0.qualifier"
+ provider-name="%providerName"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.1.qualifier">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="%updateSiteName" url="http://download.eclipse.org/releases/mars"/>
+ </url>
+
+ <requires>
+ <import feature="org.eclipse.remote.source" version="2.0.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.tcf.te.tcf.core.sdk.feature" version="1.4.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.tcf.te.tcf.remote.feature" version="1.4.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.tcf.te.tcf.remote.core.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.tcf.te.tcf.remote.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java
index 6d3036703..3aff1f101 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java
@@ -1,663 +1,678 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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
- * William Chen (Wind River) - [345384] Provide property pages for remote file system nodes
- * William Chen (Wind River) - [352302]Opening a file in an editor depending on
- * the client's permissions.
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.internal;
-
-import static java.util.Collections.singletonList;
-
-import java.beans.PropertyChangeEvent;
-import java.io.File;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IFileSystem;
-import org.eclipse.tcf.services.IFileSystem.FileAttrs;
-import org.eclipse.tcf.te.core.interfaces.IFilterable;
-import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
-import org.eclipse.tcf.te.core.interfaces.IViewerInput;
-import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
-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.IResultOperation;
-import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNodeWorkingCopy;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopyLocal;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFile;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFolder;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDelete;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDownload;
-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.OpRename;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLStreamHandlerService;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.ContentTypeHelper;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
-import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-
-/**
- * Representation of a file system tree node.
- * <p>
- * <b>Note:</b> Node construction and child list access is limited to the TCF
- * event dispatch thread.
- */
-@SuppressWarnings("deprecation")
-public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode {
- private static final QualifiedName EDITOR_KEY = new QualifiedName("org.eclipse.ui.internal.registry.ResourceEditorRegistry", "EditorProperty");//$NON-NLS-2$//$NON-NLS-1$
- static final String KEY_WIN32_ATTRS = "Win32Attrs"; //$NON-NLS-1$
- private static final Comparator<FSTreeNode> CMP_WIN = new Comparator<FSTreeNode>() {
- @Override
- public int compare(FSTreeNode o1, FSTreeNode o2) {
- return o1.getName().compareToIgnoreCase(o2.getName());
- }
- };
- private static final Comparator<FSTreeNode> CMP_UNIX = new Comparator<FSTreeNode>() {
- @Override
- public int compare(FSTreeNode o1, FSTreeNode o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
-
- private FSTreeNode fParent;
- private String fName;
-
- private Type fType;
- private IFileSystem.FileAttrs fAttributes;
-
- private FSTreeNode[] fChildren = null;
-
- private final RuntimeModel fRuntimeModel;
- private final boolean fWindowsNode;
- private long fRefreshTime;
-
-
- public FSTreeNode(RuntimeModel runtimeModel, String name) {
- fRuntimeModel = runtimeModel;
- fParent = null;
- fName = name;
- fAttributes = null;
- fType = Type.FILE_SYSTEM;
- fWindowsNode = isWindowsNode(getPeerNode());
- Assert.isTrue(Protocol.isDispatchThread());
- }
-
- private boolean isWindowsNode(IPeerNode peerNode) {
- String osname = TargetPropertyTester.getOSName(peerNode);
- if (osname != null){
- return osname.startsWith("Windows"); //$NON-NLS-1$
- }
- return false;
- }
-
- public FSTreeNode(FSTreeNode parent, String name, boolean isRootDir, IFileSystem.FileAttrs attribs) {
- fRuntimeModel = parent.getRuntimeModel();
- fWindowsNode = parent.isWindowsNode() || (isRootDir && name.endsWith("\\")); //$NON-NLS-1$
- fParent = parent;
- fName = name;
- fAttributes = attribs;
- if (isRootDir) {
- fType = Type.ROOT;
- } else {
- fType = Type.DIRECTORY_OR_FILE;
- }
- Assert.isTrue(Protocol.isDispatchThread());
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + ": name=" + fName; //$NON-NLS-1$
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if(IViewerInput.class.equals(adapter)) {
- return getPeerNode().getAdapter(IViewerInput.class);
- }
- if(IPropertyChangeProvider.class.equals(adapter)) {
- return getPeerNode().getAdapter(adapter);
- }
- return super.getAdapter(adapter);
- }
-
- @Override
- public RuntimeModel getRuntimeModel() {
- return fRuntimeModel;
- }
-
- @Override
- public IPeerNode getPeerNode() {
- return fRuntimeModel.getPeerNode();
- }
-
- @Override
- public UserAccount getUserAccount() {
- return fRuntimeModel.getUserAccount();
- }
-
- @Override
- public Type getType() {
- return fType;
- }
-
- @Override
- public boolean isWindowsNode() {
- return fWindowsNode;
- }
-
- @Override
- public boolean isFile() {
- return fAttributes != null && fAttributes.isFile();
- }
-
- @Override
- public boolean isDirectory() {
- switch(fType) {
- case FILE_SYSTEM:
- return false;
- case ROOT:
- return true;
- case DIRECTORY_OR_FILE:
- return fAttributes == null || fAttributes.isDirectory();
- }
- return false;
- }
-
- @Override
- public boolean isRootDirectory() {
- return fType == Type.ROOT;
- }
-
- public FileAttrs getAttributes() {
- return fAttributes;
- }
-
- @Override
- protected int getWin32Attrs() {
- final FileAttrs attribs = fAttributes;
- if (attribs != null && attribs.attributes != null) {
- Object val = attribs.attributes.get(KEY_WIN32_ATTRS);
- if (val instanceof Integer) {
- return ((Integer) val).intValue();
- }
- }
- return 0;
- }
-
- @Override
- protected int getPermissions() {
- final FileAttrs attribs = fAttributes;
- if (attribs != null) {
- return attribs.permissions;
- }
- return 0;
- }
-
- @Override
- public String getLocation() {
- return getLocation(false);
- }
-
- public String getLocation(boolean forceSlashes) {
- return getLocation(isWindowsNode() && !forceSlashes ? '\\' : '/', false);
- }
-
- private String getLocation(char separator, boolean encodeName) {
- String name = getName();
- if (fType == Type.ROOT) {
- if (isWindowsNode() && name.charAt(name.length()-1) != separator) {
- return name.substring(0, name.length()-1) + separator;
- }
- return name;
- }
- if (fParent == null)
- return name;
-
-
- String pLoc = fParent.getLocation(separator, encodeName);
- if (pLoc.length() == 0)
- return name;
-
- if (encodeName) {
- try {
- name = URLEncoder.encode(getName(), "UTF-8"); //$NON-NLS-1$
- } catch (Exception e) {
- // Ignore
- }
- }
- char lastChar = pLoc.charAt(pLoc.length()-1);
- if (lastChar != separator)
- return pLoc + separator + name;
-
- return pLoc + name;
- }
-
- /**
- * Get the URL of the file or folder. The URL's format is created in the
- * following way: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource... See
- * {@link TcfURLConnection#TcfURLConnection(URL)}
- *
- * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
- * @see #getLocationURI()
- * @return The URL of the file/folder.
- */
- @Override
- public URL getLocationURL() {
- try {
- URI uri = getLocationURI();
- return uri == null ? null : uri.toURL();
- } catch (MalformedURLException e) {
- CorePlugin.logError("Cannot create tcf url", e); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Get the URI of the file or folder. The URI's format is created in the
- * following way: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource...
- *
- * @return The URI of the file/folder.
- */
- @Override
- public URI getLocationURI() {
- try {
- String id = getPeerNode().getPeerId();
- String path = getLocation('/', true);
- return new URI(TcfURLConnection.PROTOCOL_SCHEMA, id, "/" + path, null); //$NON-NLS-1$
- } catch (URISyntaxException e) {
- CorePlugin.logError("Cannot create tcf uri", e); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Get the type label of the file for displaying purpose.
- *
- * @return The type label text.
- */
- @Override
- public String getFileTypeLabel() {
- switch (fType) {
- case FILE_SYSTEM:
- return Messages.FSTreeNodeContentProvider_rootNodeLabel;
- case ROOT:
- return Messages.FSTreeNode_TypeLocalDisk;
- case DIRECTORY_OR_FILE:
- break;
- }
-
- if (isDirectory())
- return Messages.FSTreeNode_TypeFileFolder;
-
- if (isSystemFile()) {
- return Messages.FSTreeNode_TypeSystemFile;
- }
- IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(getName());
- if (contentType != null) {
- return contentType.getName();
- }
- int lastDot = getName().lastIndexOf("."); //$NON-NLS-1$
- if (lastDot == -1) {
- return Messages.FSTreeNode_TypeUnknownFile;
- }
- return getName().substring(lastDot + 1).toUpperCase() + " " + Messages.FSTreeNode_TypeFile; //$NON-NLS-1$
- }
-
-
- /**
- * Get the local file's state of the specified tree node. The local file must exist
- * before calling this method to get its state.
- *
- * @return The tree node's latest cache state.
- */
- @Override
- public CacheState getCacheState() {
- File file = CacheManager.getCacheFile(this);
- if (!file.exists()) {
- return CacheState.consistent;
- }
- FileState digest = PersistenceManager.getInstance().getFileDigest(this);
- return digest.getCacheState();
- }
-
- @Override
- public FSTreeNode getParent() {
- return fParent;
- }
-
- @Override
- public String getName() {
- return fName;
- }
-
- @Override
- public IFSTreeNodeWorkingCopy createWorkingCopy() {
- return new FSTreeNodeWorkingCopy(this);
- }
-
- @Override
- public boolean isFileSystem() {
- return fType == Type.FILE_SYSTEM;
- }
-
- @Override
- public long getAccessTime() {
- if (fAttributes != null)
- return fAttributes.atime;
- return 0;
- }
-
- @Override
- public long getModificationTime() {
- if (fAttributes != null)
- return fAttributes.mtime;
- return 0;
- }
-
- @Override
- public long getSize() {
- if (fAttributes != null)
- return fAttributes.size;
- return 0;
- }
-
- @Override
- public int getUID() {
- if (fAttributes != null)
- return fAttributes.uid;
- return 0;
- }
-
- @Override
- public int getGID() {
- if (fAttributes != null)
- return fAttributes.gid;
- return 0;
- }
-
- @Override
- public boolean isAncestorOf(IFSTreeNode node) {
- while (node != null) {
- if ((node = node.getParent()) == this)
- return true;
- }
- return false;
- }
-
- @Override
- public File getCacheFile() {
- return CacheManager.getCacheFile(this);
- }
-
- @Override
- public String getPreferredEditorID() {
- return PersistenceManager.getInstance().getPersistentProperties(this).get(EDITOR_KEY);
- }
-
- @Override
- public void setPreferredEditorID(String editorID) {
- PersistenceManager.getInstance().getPersistentProperties(this).put(EDITOR_KEY, editorID);
- }
-
- @Override
- public IContentType getContentType() {
- return ContentTypeHelper.getContentType(this);
- }
-
- @Override
- public boolean isBinaryFile() {
- return ContentTypeHelper.isBinaryFile(this);
- }
-
- @Override
- public FSTreeNode[] getChildren() {
- return fChildren;
- }
-
- @Override
- public IOperation operationRefresh(boolean recursive) {
- return new OpRefresh(this, recursive);
- }
-
-
- @Override
- public IOperation operationRename(String newName) {
- return new OpRename(this, newName);
- }
-
- @Override
- public IOperation operationUploadContent(File srcFile) {
- if (srcFile == null)
- srcFile = getCacheFile();
-
- OpUpload upload = new OpUpload(null);
- upload.addUpload(srcFile, this);
- return upload;
- }
-
- @Override
- public IOperation operationDelete(IConfirmCallback readonlyCallback) {
- return new OpDelete(singletonList(this), readonlyCallback);
- }
-
- @Override
- public IOperation operationDownload(OutputStream output) {
- return new OpDownload(this, output);
- }
-
- @Override
- public IOperation operationDownload(File destinationFolder, IConfirmCallback confirmCallback) {
- return new OpCopyLocal(singletonList(this), destinationFolder, confirmCallback);
- }
-
- @Override
- public IOperation operationDropFiles(List<String> files, IConfirmCallback confirmCallback) {
- OpUpload upload = new OpUpload(confirmCallback);
- for (String file : files) {
- upload.addDrop(new File(file), this);
- }
- return upload;
- }
-
- @Override
- public IOperation operationDropMove(List<IFSTreeNode> nodes, IConfirmCallback confirmCallback) {
- return new OpMove(nodes, this, confirmCallback);
- }
-
- @Override
- public IOperation operationDropCopy(List<IFSTreeNode> nodes, boolean cpPerm, boolean cpOwn,
- IConfirmCallback moveCopyCallback) {
- return new OpCopy(nodes, this, cpPerm, cpOwn, moveCopyCallback);
- }
-
- @Override
- public IResultOperation<IFSTreeNode> operationNewFile(String name) {
- return new OpCreateFile(this, name);
- }
-
- @Override
- public IResultOperation<IFSTreeNode> operationNewFolder(String name) {
- return new OpCreateFolder(this, name);
- }
-
- public void changeParent(FSTreeNode newParent) {
- fParent = newParent;
- }
-
- public void changeName(String newName) {
- fName = newName;
- }
-
- @Override
- public FSTreeNode findChild(String name) {
- return binarySearch(fChildren, name);
- }
-
- public void addNode(FSTreeNode newNode, boolean notify) {
- final FSTreeNode[] children = fChildren;
- if (children == null) {
- setChildren(new FSTreeNode[] {newNode}, notify);
- } else {
- int ip = Arrays.binarySearch(children, newNode, getComparator());
- if (ip >= 0) {
- children[ip] = newNode;
- } else {
- ip = -ip - 1;
- FSTreeNode[] newChildren = new FSTreeNode[children.length+1];
- System.arraycopy(children, 0, newChildren, 0, ip);
- newChildren[ip] = newNode;
- System.arraycopy(children, ip, newChildren, ip+1, children.length-ip);
- setChildren(newChildren, notify);
- }
- }
- }
-
- public void removeNode(FSTreeNode node, boolean notify) {
- final FSTreeNode[] children = fChildren;
- if (children == null)
- return;
-
- int ip = Arrays.binarySearch(children, node, getComparator());
- if (ip < 0 || children[ip] != node)
- return;
-
- FSTreeNode[] newChildren = new FSTreeNode[children.length-1];
- System.arraycopy(children, 0, newChildren, 0, ip);
- System.arraycopy(children, ip+1, newChildren, ip, children.length-ip-1);
- setChildren(newChildren, notify);
- }
-
- public void setContent(FSTreeNode[] children, boolean notify) {
- setContent(children, notify, true);
- }
-
- public void setContent(FSTreeNode[] children, boolean notify, boolean updateRefreshTime) {
- final Comparator<FSTreeNode> comparator = getComparator();
- Arrays.sort(children, comparator);
- if (fChildren != null) {
- int j = 0;
- for (int i=0; i<children.length; i++) {
- FSTreeNode node = children[i];
- for (; j<fChildren.length; j++) {
- FSTreeNode old = fChildren[j];
- int cmp = comparator.compare(old, node);
- if (cmp == 0) {
- old.setAttributes(node.fAttributes, false);
- children[i] = old;
- j++;
- break;
- } else if (cmp > 0) {
- break;
- }
- }
- }
- }
- if (updateRefreshTime) fRefreshTime = System.currentTimeMillis();
- setChildren(children, notify);
- }
-
- private Comparator<FSTreeNode> getComparator() {
- return isWindowsNode() ? CMP_WIN : CMP_UNIX;
- }
-
- private void setChildren(FSTreeNode[] children, boolean notify) {
- Assert.isTrue(Protocol.isDispatchThread());
- FSTreeNode[] oldChildren = fChildren;
- fChildren = children;
- if (notify) {
- notifyChange("children", oldChildren, children); //$NON-NLS-1$
- }
- }
-
- public void setAttributes(FileAttrs attrs, boolean notify) {
- FileAttrs oldAttrs = fAttributes;
- fAttributes = attrs;
- if (attrs != null && attrs.isFile())
- fRefreshTime = System.currentTimeMillis();
- if (notify) {
- notifyChange("attributes", oldAttrs, attrs); //$NON-NLS-1$
- }
- }
-
- public void notifyChange() {
- notifyChange("children", null, null); //$NON-NLS-1$
- }
-
- private void notifyChange(String prop, Object oldValue, Object newValue) {
- fRuntimeModel.firePropertyChanged(new PropertyChangeEvent(this, prop, oldValue, newValue));
- }
-
- @Override
- public long getLastRefresh() {
- return fRefreshTime;
- }
-
- private FSTreeNode binarySearch(final FSTreeNode[] children, String name) {
- if (children == null)
- return null;
-
- boolean caseSensitive = !isWindowsNode();
- int low = 0;
- int high = children.length - 1;
-
- while (low <= high) {
- int mid = (low + high) >>> 1;
- FSTreeNode midVal = children[mid];
- int cmp = caseSensitive ? midVal.getName().compareTo(name) : midVal.getName().compareToIgnoreCase(name);
- if (cmp < 0)
- low = mid + 1;
- else if (cmp > 0)
- high = mid - 1;
- else
- return midVal;
- }
- return null;
- }
-
- @Override
- public void setRevealOnConnect(boolean value) {
- if (value) {
- if (CorePlugin.getDefault().addToRevealOnConnect(getLocation(true))) {
- notifyChange("favorites", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
- }
- } else {
- if (CorePlugin.getDefault().removeFromRevealOnConnect(getLocation(true))) {
- notifyChange("favorites", Boolean.TRUE, Boolean.FALSE); //$NON-NLS-1$
- }
- }
- }
-
- @Override
- public boolean isRevealOnConnect() {
- return CorePlugin.getDefault().isRevealOnConnect(getLocation(true));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 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
+ * William Chen (Wind River) - [345384] Provide property pages for remote file system nodes
+ * William Chen (Wind River) - [352302]Opening a file in an editor depending on
+ * the client's permissions.
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal;
+
+import static java.util.Collections.singletonList;
+
+import java.beans.PropertyChangeEvent;
+import java.io.File;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.te.core.interfaces.IFilterable;
+import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
+import org.eclipse.tcf.te.tcf.filesystem.core.activator.CorePlugin;
+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.IResultOperation;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNodeWorkingCopy;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopyLocal;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFile;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFolder;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDelete;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDownload;
+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.OpRename;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.testers.TargetPropertyTester;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLStreamHandlerService;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.ContentTypeHelper;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.RuntimeModel;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+
+/**
+ * Representation of a file system tree node.
+ * <p>
+ * <b>Note:</b> Node construction and child list access is limited to the TCF
+ * event dispatch thread.
+ */
+@SuppressWarnings("deprecation")
+public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode {
+ private static final QualifiedName EDITOR_KEY = new QualifiedName("org.eclipse.ui.internal.registry.ResourceEditorRegistry", "EditorProperty");//$NON-NLS-2$//$NON-NLS-1$
+ static final String KEY_WIN32_ATTRS = "Win32Attrs"; //$NON-NLS-1$
+ private static final Comparator<FSTreeNode> CMP_WIN = new Comparator<FSTreeNode>() {
+ @Override
+ public int compare(FSTreeNode o1, FSTreeNode o2) {
+ return o1.getName().compareToIgnoreCase(o2.getName());
+ }
+ };
+ private static final Comparator<FSTreeNode> CMP_UNIX = new Comparator<FSTreeNode>() {
+ @Override
+ public int compare(FSTreeNode o1, FSTreeNode o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ public static final String NOSLASH_MARKER = "/./"; //$NON-NLS-1$
+
+ public static String addNoSlashMarker(String path) {
+ if (path.length() > 0 && path.charAt(0) != '/')
+ return NOSLASH_MARKER + path;
+ return path;
+ }
+
+ public static String stripNoSlashMarker(String path) {
+ if (path.startsWith(NOSLASH_MARKER))
+ return path.substring(NOSLASH_MARKER.length());
+ return path;
+ }
+
+
+
+ private FSTreeNode fParent;
+ private String fName;
+
+ private Type fType;
+ private IFileSystem.FileAttrs fAttributes;
+
+ private FSTreeNode[] fChildren = null;
+
+ private final RuntimeModel fRuntimeModel;
+ private final boolean fWindowsNode;
+ private long fRefreshTime;
+
+
+ public FSTreeNode(RuntimeModel runtimeModel, String name) {
+ fRuntimeModel = runtimeModel;
+ fParent = null;
+ fName = name;
+ fAttributes = null;
+ fType = Type.FILE_SYSTEM;
+ fWindowsNode = isWindowsNode(getPeerNode());
+ Assert.isTrue(Protocol.isDispatchThread());
+ }
+
+ private boolean isWindowsNode(IPeerNode peerNode) {
+ String osname = TargetPropertyTester.getOSName(peerNode);
+ if (osname != null){
+ return osname.startsWith("Windows"); //$NON-NLS-1$
+ }
+ return false;
+ }
+
+ public FSTreeNode(FSTreeNode parent, String name, boolean isRootDir, IFileSystem.FileAttrs attribs) {
+ fRuntimeModel = parent.getRuntimeModel();
+ fWindowsNode = parent.isWindowsNode() || (isRootDir && name.endsWith("\\")); //$NON-NLS-1$
+ fParent = parent;
+ fName = name;
+ fAttributes = attribs;
+ if (isRootDir) {
+ fType = Type.ROOT;
+ } else {
+ fType = Type.DIRECTORY_OR_FILE;
+ }
+ Assert.isTrue(Protocol.isDispatchThread());
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + ": name=" + fName; //$NON-NLS-1$
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (IViewerInput.class.equals(adapter)) {
+ return getPeerNode().getAdapter(adapter);
+ }
+ if (IPropertyChangeProvider.class.equals(adapter)) {
+ return getPeerNode().getAdapter(adapter);
+ }
+ return super.getAdapter(adapter);
+ }
+
+ @Override
+ public RuntimeModel getRuntimeModel() {
+ return fRuntimeModel;
+ }
+
+ @Override
+ public IPeerNode getPeerNode() {
+ return fRuntimeModel.getPeerNode();
+ }
+
+ @Override
+ public UserAccount getUserAccount() {
+ return fRuntimeModel.getUserAccount();
+ }
+
+ @Override
+ public Type getType() {
+ return fType;
+ }
+
+ @Override
+ public boolean isWindowsNode() {
+ return fWindowsNode;
+ }
+
+ @Override
+ public boolean isFile() {
+ return fAttributes != null && fAttributes.isFile();
+ }
+
+ @Override
+ public boolean isDirectory() {
+ switch(fType) {
+ case FILE_SYSTEM:
+ return false;
+ case ROOT:
+ return true;
+ case DIRECTORY_OR_FILE:
+ return fAttributes == null || fAttributes.isDirectory();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isRootDirectory() {
+ return fType == Type.ROOT;
+ }
+
+ public FileAttrs getAttributes() {
+ return fAttributes;
+ }
+
+ @Override
+ protected int getWin32Attrs() {
+ final FileAttrs attribs = fAttributes;
+ if (attribs != null && attribs.attributes != null) {
+ Object val = attribs.attributes.get(KEY_WIN32_ATTRS);
+ if (val instanceof Integer) {
+ return ((Integer) val).intValue();
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ protected int getPermissions() {
+ final FileAttrs attribs = fAttributes;
+ if (attribs != null) {
+ return attribs.permissions;
+ }
+ return 0;
+ }
+
+ @Override
+ public String getLocation() {
+ return getLocation(false);
+ }
+
+ public String getLocation(boolean forceSlashes) {
+ return getLocation(isWindowsNode() && !forceSlashes ? '\\' : '/', false);
+ }
+
+ private String getLocation(char separator, boolean encodeName) {
+ String name = getName();
+ if (fType == Type.ROOT) {
+ if (isWindowsNode() && name.charAt(name.length()-1) != separator) {
+ return name.substring(0, name.length()-1) + separator;
+ }
+ return name;
+ }
+ if (fParent == null)
+ return name;
+
+
+ String pLoc = fParent.getLocation(separator, encodeName);
+ if (pLoc.length() == 0)
+ return name;
+
+ if (encodeName) {
+ try {
+ name = URLEncoder.encode(getName(), "UTF-8"); //$NON-NLS-1$
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ char lastChar = pLoc.charAt(pLoc.length()-1);
+ if (lastChar != separator)
+ return pLoc + separator + name;
+
+ return pLoc + name;
+ }
+
+ /**
+ * Get the URL of the file or folder. The URL's format is created in the
+ * following way: tcf:/<peerName>/remote/path/to/the/resource... See
+ * {@link TcfURLConnection#TcfURLConnection(URL)}
+ *
+ * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
+ * @see #getLocationURI()
+ * @return The URL of the file/folder.
+ */
+ @Override
+ public URL getLocationURL() {
+ try {
+ URI uri = getLocationURI();
+ return uri == null ? null : uri.toURL();
+ } catch (MalformedURLException e) {
+ CorePlugin.logError("Cannot create tcf url", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Get the URI of the file or folder. The URI's format is created in the
+ * following way: tcf:/<peerName>/remote/path/to/the/resource...
+ *
+ * @return The URI of the file/folder.
+ */
+ @Override
+ public URI getLocationURI() {
+ try {
+ String name = getPeerNode().getName();
+ String path = getLocation('/', true);
+ return new URI(TcfURLConnection.PROTOCOL_SCHEMA, name, addNoSlashMarker(path), null);
+ } catch (URISyntaxException e) {
+ CorePlugin.logError("Cannot create tcf uri", e); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /**
+ * Get the type label of the file for displaying purpose.
+ *
+ * @return The type label text.
+ */
+ @Override
+ public String getFileTypeLabel() {
+ switch (fType) {
+ case FILE_SYSTEM:
+ return Messages.FSTreeNodeContentProvider_rootNodeLabel;
+ case ROOT:
+ return Messages.FSTreeNode_TypeLocalDisk;
+ case DIRECTORY_OR_FILE:
+ break;
+ }
+
+ if (isDirectory())
+ return Messages.FSTreeNode_TypeFileFolder;
+
+ if (isSystemFile()) {
+ return Messages.FSTreeNode_TypeSystemFile;
+ }
+ IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(getName());
+ if (contentType != null) {
+ return contentType.getName();
+ }
+ int lastDot = getName().lastIndexOf("."); //$NON-NLS-1$
+ if (lastDot == -1) {
+ return Messages.FSTreeNode_TypeUnknownFile;
+ }
+ return getName().substring(lastDot + 1).toUpperCase() + " " + Messages.FSTreeNode_TypeFile; //$NON-NLS-1$
+ }
+
+
+ /**
+ * Get the local file's state of the specified tree node. The local file must exist
+ * before calling this method to get its state.
+ *
+ * @return The tree node's latest cache state.
+ */
+ @Override
+ public CacheState getCacheState() {
+ File file = CacheManager.getCacheFile(this);
+ if (!file.exists()) {
+ return CacheState.consistent;
+ }
+ FileState digest = PersistenceManager.getInstance().getFileDigest(this);
+ return digest.getCacheState();
+ }
+
+ @Override
+ public FSTreeNode getParent() {
+ return fParent;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
+ public IFSTreeNodeWorkingCopy createWorkingCopy() {
+ return new FSTreeNodeWorkingCopy(this);
+ }
+
+ @Override
+ public boolean isFileSystem() {
+ return fType == Type.FILE_SYSTEM;
+ }
+
+ @Override
+ public long getAccessTime() {
+ if (fAttributes != null)
+ return fAttributes.atime;
+ return 0;
+ }
+
+ @Override
+ public long getModificationTime() {
+ if (fAttributes != null)
+ return fAttributes.mtime;
+ return 0;
+ }
+
+ @Override
+ public long getSize() {
+ if (fAttributes != null)
+ return fAttributes.size;
+ return 0;
+ }
+
+ @Override
+ public int getUID() {
+ if (fAttributes != null)
+ return fAttributes.uid;
+ return 0;
+ }
+
+ @Override
+ public int getGID() {
+ if (fAttributes != null)
+ return fAttributes.gid;
+ return 0;
+ }
+
+ @Override
+ public boolean isAncestorOf(IFSTreeNode node) {
+ while (node != null) {
+ if ((node = node.getParent()) == this)
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public File getCacheFile() {
+ return CacheManager.getCacheFile(this);
+ }
+
+ @Override
+ public String getPreferredEditorID() {
+ return PersistenceManager.getInstance().getPersistentProperties(this).get(EDITOR_KEY);
+ }
+
+ @Override
+ public void setPreferredEditorID(String editorID) {
+ PersistenceManager.getInstance().getPersistentProperties(this).put(EDITOR_KEY, editorID);
+ }
+
+ @Override
+ public IContentType getContentType() {
+ return ContentTypeHelper.getContentType(this);
+ }
+
+ @Override
+ public boolean isBinaryFile() {
+ return ContentTypeHelper.isBinaryFile(this);
+ }
+
+ @Override
+ public FSTreeNode[] getChildren() {
+ return fChildren;
+ }
+
+ @Override
+ public IOperation operationRefresh(boolean recursive) {
+ return new OpRefresh(this, recursive);
+ }
+
+
+ @Override
+ public IOperation operationRename(String newName) {
+ return new OpRename(this, newName);
+ }
+
+ @Override
+ public IOperation operationUploadContent(File srcFile) {
+ if (srcFile == null)
+ srcFile = getCacheFile();
+
+ OpUpload upload = new OpUpload(null);
+ upload.addUpload(srcFile, this);
+ return upload;
+ }
+
+ @Override
+ public IOperation operationDelete(IConfirmCallback readonlyCallback) {
+ return new OpDelete(singletonList(this), readonlyCallback);
+ }
+
+ @Override
+ public IOperation operationDownload(OutputStream output) {
+ return new OpDownload(this, output);
+ }
+
+ @Override
+ public IOperation operationDownload(File destinationFolder, IConfirmCallback confirmCallback) {
+ return new OpCopyLocal(singletonList(this), destinationFolder, confirmCallback);
+ }
+
+ @Override
+ public IOperation operationDropFiles(List<String> files, IConfirmCallback confirmCallback) {
+ OpUpload upload = new OpUpload(confirmCallback);
+ for (String file : files) {
+ upload.addDrop(new File(file), this);
+ }
+ return upload;
+ }
+
+ @Override
+ public IOperation operationDropMove(List<IFSTreeNode> nodes, IConfirmCallback confirmCallback) {
+ return new OpMove(nodes, this, confirmCallback);
+ }
+
+ @Override
+ public IOperation operationDropCopy(List<IFSTreeNode> nodes, boolean cpPerm, boolean cpOwn,
+ IConfirmCallback moveCopyCallback) {
+ return new OpCopy(nodes, this, cpPerm, cpOwn, moveCopyCallback);
+ }
+
+ @Override
+ public IResultOperation<IFSTreeNode> operationNewFile(String name) {
+ return new OpCreateFile(this, name);
+ }
+
+ @Override
+ public IResultOperation<IFSTreeNode> operationNewFolder(String name) {
+ return new OpCreateFolder(this, name);
+ }
+
+ public void changeParent(FSTreeNode newParent) {
+ fParent = newParent;
+ }
+
+ public void changeName(String newName) {
+ fName = newName;
+ }
+
+ @Override
+ public FSTreeNode findChild(String name) {
+ return binarySearch(fChildren, name);
+ }
+
+ public void addNode(FSTreeNode newNode, boolean notify) {
+ final FSTreeNode[] children = fChildren;
+ if (children == null) {
+ setChildren(new FSTreeNode[] {newNode}, notify);
+ } else {
+ int ip = Arrays.binarySearch(children, newNode, getComparator());
+ if (ip >= 0) {
+ children[ip] = newNode;
+ } else {
+ ip = -ip - 1;
+ FSTreeNode[] newChildren = new FSTreeNode[children.length+1];
+ System.arraycopy(children, 0, newChildren, 0, ip);
+ newChildren[ip] = newNode;
+ System.arraycopy(children, ip, newChildren, ip+1, children.length-ip);
+ setChildren(newChildren, notify);
+ }
+ }
+ }
+
+ public void removeNode(FSTreeNode node, boolean notify) {
+ final FSTreeNode[] children = fChildren;
+ if (children == null)
+ return;
+
+ int ip = Arrays.binarySearch(children, node, getComparator());
+ if (ip < 0 || children[ip] != node)
+ return;
+
+ FSTreeNode[] newChildren = new FSTreeNode[children.length-1];
+ System.arraycopy(children, 0, newChildren, 0, ip);
+ System.arraycopy(children, ip+1, newChildren, ip, children.length-ip-1);
+ setChildren(newChildren, notify);
+ }
+
+ public void setContent(FSTreeNode[] children, boolean notify) {
+ setContent(children, notify, true);
+ }
+
+ public void setContent(FSTreeNode[] children, boolean notify, boolean updateRefreshTime) {
+ final Comparator<FSTreeNode> comparator = getComparator();
+ Arrays.sort(children, comparator);
+ if (fChildren != null) {
+ int j = 0;
+ for (int i=0; i<children.length; i++) {
+ FSTreeNode node = children[i];
+ for (; j<fChildren.length; j++) {
+ FSTreeNode old = fChildren[j];
+ int cmp = comparator.compare(old, node);
+ if (cmp == 0) {
+ old.setAttributes(node.fAttributes, false);
+ children[i] = old;
+ j++;
+ break;
+ } else if (cmp > 0) {
+ break;
+ }
+ }
+ }
+ }
+ if (updateRefreshTime) fRefreshTime = System.currentTimeMillis();
+ setChildren(children, notify);
+ }
+
+ private Comparator<FSTreeNode> getComparator() {
+ return isWindowsNode() ? CMP_WIN : CMP_UNIX;
+ }
+
+ private void setChildren(FSTreeNode[] children, boolean notify) {
+ Assert.isTrue(Protocol.isDispatchThread());
+ FSTreeNode[] oldChildren = fChildren;
+ fChildren = children;
+ if (notify) {
+ notifyChange("children", oldChildren, children); //$NON-NLS-1$
+ }
+ }
+
+ public void setAttributes(FileAttrs attrs, boolean notify) {
+ FileAttrs oldAttrs = fAttributes;
+ fAttributes = attrs;
+ if (attrs != null && attrs.isFile())
+ fRefreshTime = System.currentTimeMillis();
+ if (notify) {
+ notifyChange("attributes", oldAttrs, attrs); //$NON-NLS-1$
+ }
+ }
+
+ public void notifyChange() {
+ notifyChange("children", null, null); //$NON-NLS-1$
+ }
+
+ private void notifyChange(String prop, Object oldValue, Object newValue) {
+ fRuntimeModel.firePropertyChanged(new PropertyChangeEvent(this, prop, oldValue, newValue));
+ }
+
+ @Override
+ public long getLastRefresh() {
+ return fRefreshTime;
+ }
+
+ private FSTreeNode binarySearch(final FSTreeNode[] children, String name) {
+ if (children == null)
+ return null;
+
+ boolean caseSensitive = !isWindowsNode();
+ int low = 0;
+ int high = children.length - 1;
+
+ while (low <= high) {
+ int mid = (low + high) >>> 1;
+ FSTreeNode midVal = children[mid];
+ int cmp = caseSensitive ? midVal.getName().compareTo(name) : midVal.getName().compareToIgnoreCase(name);
+ if (cmp < 0)
+ low = mid + 1;
+ else if (cmp > 0)
+ high = mid - 1;
+ else
+ return midVal;
+ }
+ return null;
+ }
+
+ @Override
+ public void setRevealOnConnect(boolean value) {
+ if (value) {
+ if (CorePlugin.getDefault().addToRevealOnConnect(getLocation(true))) {
+ notifyChange("favorites", Boolean.FALSE, Boolean.TRUE); //$NON-NLS-1$
+ }
+ } else {
+ if (CorePlugin.getDefault().removeFromRevealOnConnect(getLocation(true))) {
+ notifyChange("favorites", Boolean.TRUE, Boolean.FALSE); //$NON-NLS-1$
+ }
+ }
+ }
+
+ @Override
+ public boolean isRevealOnConnect() {
+ return CorePlugin.getDefault().isRevealOnConnect(getLocation(true));
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java
index b9cfe3e85..16cf45158 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/url/TcfURLConnection.java
@@ -1,309 +1,307 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 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)- [345387]Open the remote files with a proper editor
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.filesystem.core.internal.url;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IFileSystem;
-import org.eclipse.tcf.services.IFileSystem.DoneClose;
-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.core.Tcf;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
-import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
-import org.eclipse.tcf.te.tcf.filesystem.core.services.Operation;
-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;
-
-/**
- * The URL connection returned by TCF stream service used to handle "tcf"
- * stream protocol.
- */
-public class TcfURLConnection extends URLConnection {
- // Default connecting timeout.
- private static final int DEFAULT_CONNECT_TIMEOUT = 5000;
- // Default file opening timeout.
- private static final int DEFAULT_OPEN_TIMEOUT = 5000;
- // Default file reading timeout.
- private static final int DEFAULT_READ_TIMEOUT = 5000;
- // Default file closing timeout.
- private static final int DEFAULT_CLOSE_TIMEOUT = 5000;
- // The schema name of the stream protocol.
- public static final String PROTOCOL_SCHEMA = "tcf"; //$NON-NLS-1$
-
- // The input stream of this connection.
- private TcfInputStream inputStream;
- // The output stream of this connection.
- private TcfOutputStream outputStream;
-
- // The TCF agent peer of the connection.
- private IPeer peer;
- // The path to the resource on the remote file system.
- String path;
- // The timeout for opening a file.
- private int openTimeout;
- // The timeout for closing a file.
- private int closeTimeout;
-
- // The TCF channel used to open and read the resource.
- IChannel channel;
- // The file's handle
- IFileHandle handle;
- // The file service
- IFileSystem service;
-
- /**
- * Create a TCF URL Connection using the specified url. The format of this
- * URL should be: tcf:/<TCF_AGENT_ID>/remote/path/to/the/resource... The
- * stream protocol schema is designed in this way in order to retrieve the
- * agent peer ID without knowing the structure of a TCF peer id.
- *
- * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
- * @param url
- * The URL of the resource.
- */
- public TcfURLConnection(final URL url) throws IOException {
- super(url);
- String peerId = url.getHost();
- Assert.isNotNull(peerId);
- peer = findPeer(peerId);
- if (peer == null) {
- throw new IOException(NLS.bind(Messages.TcfURLConnection_NoPeerFound, peerId));
- }
- String p = url.getPath();
- if (!p.startsWith("/")) { //$NON-NLS-1$
- throw new IOException(Messages.TcfURLConnection_relativePath);
- }
- path = p.substring(1);
- // Set default timeout.
- setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
- setOpenTimeout(DEFAULT_OPEN_TIMEOUT);
- setReadTimeout(DEFAULT_READ_TIMEOUT);
- setCloseTimeout(DEFAULT_CLOSE_TIMEOUT);
- }
-
- /**
- * Find the TCF peer with the specified ID.
- *
- * @param peerId The target peer's ID.
- * @return The peer with this ID or null if not found.
- */
- private IPeer findPeer(final String peerId) {
- Assert.isNotNull(peerId);
-
- final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
-
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
- IPeer p = Protocol.getLocator().getPeers().get(peerId);
- if (p == null) {
- IPeerNode peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelById(peerId);
- if (peerNode != null) p = peerNode.getPeer();
- }
- peer.set(p);
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return peer.get();
- }
-
- /**
- * Get the timeout for closing a file.
- *
- * @return the timeout in milliseconds.
- */
- public long getCloseTimeout() {
- return closeTimeout;
- }
-
- /**
- * Set the timeout for closing a file.
- *
- * @param closeTimeout
- * the timeout in milliseconds.
- */
- public void setCloseTimeout(int closeTimeout) {
- this.closeTimeout = closeTimeout;
- }
-
- /**
- * Get the timeout for opening a file.
- *
- * @return the timeout in milliseconds.
- */
- public long getOpenTimeout() {
- return openTimeout;
- }
-
- /**
- * Set the timeout for opening a file.
- *
- * @param openTimeout
- * the timeout in milliseconds.
- */
- public void setOpenTimeout(int openTimeout) {
- this.openTimeout = openTimeout;
- }
-
- /**
- * Open a file on the remote file system for read/write and store the file handle.
- *
- * @throws IOException Opening file fails.
- */
- private void openFile() throws IOException {
- if(peer == null)
- throw new IOException(Messages.TcfURLConnection_NoSuchTcfAgent);
- try {
- // Open the channel
- channel = Operation.openChannel(peer);
- } catch (TCFChannelException e) {
- throw new IOException(e.getMessage());
- }
- if (channel != null) {
- service = Operation.getBlockingFileSystem(channel);
- if (service != null) {
- final FileSystemException[] errors = new FileSystemException[1];
- // Open the file.
- int open_flag = 0;
- if (doInput)
- open_flag |= IFileSystem.TCF_O_READ;
- if (doOutput)
- open_flag |= IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_TRUNC;
- service.open(path, open_flag, null, new DoneOpen() {
- @Override
- public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) {
- errors[0] = error;
- handle = hdl;
- }
- });
- if (errors[0] != null) {
- IOException exception = new IOException(errors[0].toString());
- exception.initCause(errors[0]);
- throw exception;
- }
- if (handle == null) {
- throw new IOException(Messages.TcfURLConnection_NoFileHandleReturned);
- }
- } else {
- throw new IOException(Messages.Operation_NoFileSystemError);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.net.URLConnection#connect()
- */
- @Override
- public void connect() throws IOException {
- if (!connected) {
- openFile();
- if (doInput) {
- inputStream = new TcfInputStream(this);
- }
- if (doOutput) {
- outputStream = new TcfOutputStream(this);
- }
- connected = true;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.net.URLConnection#getInputStream()
- */
- @Override
- public InputStream getInputStream() throws IOException {
- if (!connected)
- connect();
- return inputStream;
- }
-
- /*
- * (non-Javadoc)
- * @see java.net.URLConnection#getOutputStream()
- */
- @Override
- public OutputStream getOutputStream() throws IOException {
- if (!connected)
- connect();
- return outputStream;
- }
-
- /**
- * Close the stream, release its file handler and close
- * the TCF channel used if possible.
- *
- * @param stream The stream either the input stream or the output stream.
- * @throws IOException If closing file handle times out.
- */
- public synchronized void closeStream(Closeable stream) throws IOException {
- boolean shouldClose = shouldCloseFileHandle(stream);
- if (shouldClose) {
- service.close(handle, new DoneClose() {
- @Override
- public void doneClose(IToken token, FileSystemException error) {
- Tcf.getChannelManager().closeChannel(channel);
- }
- });
- }
- }
-
- /**
- * Decide if the file handle and the TCF channel should be closed if
- * the specified stream is closed. If the stream is the last stream
- * that depends on the file handle and the TCF channel, then it should
- * be closed.
- *
- * @param stream The stream to be closed.
- * @return true if the file handle and the TCF channel should be closed.
- */
- private boolean shouldCloseFileHandle(Closeable stream) {
- boolean shouldClose = false;
- if (stream == inputStream) {
- if (doOutput) {
- if (outputStream.closed) {
- shouldClose = true;
- }
- } else {
- shouldClose = true;
- }
- } else if (stream == outputStream) {
- if (doInput) {
- if (inputStream.closed)
- shouldClose = true;
- } else {
- shouldClose = true;
- }
- }
- return shouldClose;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 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)- [345387]Open the remote files with a proper editor
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.core.internal.url;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneClose;
+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.core.Tcf;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFChannelException;
+import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.filesystem.core.services.Operation;
+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;
+
+/**
+ * The URL connection returned by TCF stream service used to handle "tcf"
+ * stream protocol.
+ */
+public class TcfURLConnection extends URLConnection {
+ // Default connecting timeout.
+ private static final int DEFAULT_CONNECT_TIMEOUT = 5000;
+ // Default file opening timeout.
+ private static final int DEFAULT_OPEN_TIMEOUT = 5000;
+ // Default file reading timeout.
+ private static final int DEFAULT_READ_TIMEOUT = 5000;
+ // Default file closing timeout.
+ private static final int DEFAULT_CLOSE_TIMEOUT = 5000;
+ // The schema name of the stream protocol.
+ public static final String PROTOCOL_SCHEMA = "tcf"; //$NON-NLS-1$
+
+ // The input stream of this connection.
+ private TcfInputStream inputStream;
+ // The output stream of this connection.
+ private TcfOutputStream outputStream;
+
+ // The TCF agent peer of the connection.
+ private IPeer peer;
+ // The path to the resource on the remote file system.
+ String path;
+ // The timeout for opening a file.
+ private int openTimeout;
+ // The timeout for closing a file.
+ private int closeTimeout;
+
+ // The TCF channel used to open and read the resource.
+ IChannel channel;
+ // The file's handle
+ IFileHandle handle;
+ // The file service
+ IFileSystem service;
+
+ /**
+ * Create a TCF URL Connection using the specified url. The format of this
+ * URL should be: tcf:/<peerName>/remote/path/to/the/resource... The
+ * stream protocol schema is designed in this way in order to retrieve the
+ * agent peer ID without knowing the structure of a TCF peer id.
+ *
+ * @see TcfURLStreamHandlerService#parseURL(URL, String, int, int)
+ * @param url
+ * The URL of the resource.
+ */
+ public TcfURLConnection(final URL url) throws IOException {
+ super(url);
+ String peerName = url.getHost();
+ Assert.isNotNull(peerName);
+ peer = findPeer(peerName);
+ if (peer == null) {
+ throw new IOException(NLS.bind(Messages.TcfURLConnection_NoPeerFound, peerName));
+ }
+ path = FSTreeNode.stripNoSlashMarker(url.getPath());
+ // Set default timeout.
+ setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
+ setOpenTimeout(DEFAULT_OPEN_TIMEOUT);
+ setReadTimeout(DEFAULT_READ_TIMEOUT);
+ setCloseTimeout(DEFAULT_CLOSE_TIMEOUT);
+ }
+
+ /**
+ * Find the TCF peer with the specified ID.
+ *
+ * @param peerId The target peer's ID.
+ * @return The peer with this ID or null if not found.
+ */
+ private IPeer findPeer(final String peerName) {
+ Assert.isNotNull(peerName);
+
+ final AtomicReference<IPeer> peer = new AtomicReference<IPeer>();
+
+ Runnable runnable = new Runnable() {
+
+ @Override
+ public void run() {
+ IPeer p = Protocol.getLocator().getPeers().get(peerName);
+ if (p == null) {
+ IPeerNode[] peerNode = ModelManager.getPeerModel().getService(IPeerModelLookupService.class).lkupPeerModelByName(peerName);
+ if (peerNode != null && peerNode.length > 0)
+ p = peerNode[0].getPeer();
+ }
+ peer.set(p);
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return peer.get();
+ }
+
+ /**
+ * Get the timeout for closing a file.
+ *
+ * @return the timeout in milliseconds.
+ */
+ public long getCloseTimeout() {
+ return closeTimeout;
+ }
+
+ /**
+ * Set the timeout for closing a file.
+ *
+ * @param closeTimeout
+ * the timeout in milliseconds.
+ */
+ public void setCloseTimeout(int closeTimeout) {
+ this.closeTimeout = closeTimeout;
+ }
+
+ /**
+ * Get the timeout for opening a file.
+ *
+ * @return the timeout in milliseconds.
+ */
+ public long getOpenTimeout() {
+ return openTimeout;
+ }
+
+ /**
+ * Set the timeout for opening a file.
+ *
+ * @param openTimeout
+ * the timeout in milliseconds.
+ */
+ public void setOpenTimeout(int openTimeout) {
+ this.openTimeout = openTimeout;
+ }
+
+ /**
+ * Open a file on the remote file system for read/write and store the file handle.
+ *
+ * @throws IOException Opening file fails.
+ */
+ private void openFile() throws IOException {
+ if(peer == null)
+ throw new IOException(Messages.TcfURLConnection_NoSuchTcfAgent);
+ try {
+ // Open the channel
+ channel = Operation.openChannel(peer);
+ } catch (TCFChannelException e) {
+ throw new IOException(e.getMessage());
+ }
+ if (channel != null) {
+ service = Operation.getBlockingFileSystem(channel);
+ if (service != null) {
+ final FileSystemException[] errors = new FileSystemException[1];
+ // Open the file.
+ int open_flag = 0;
+ if (doInput)
+ open_flag |= IFileSystem.TCF_O_READ;
+ if (doOutput)
+ open_flag |= IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_TRUNC;
+ service.open(path, open_flag, null, new DoneOpen() {
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) {
+ errors[0] = error;
+ handle = hdl;
+ }
+ });
+ if (errors[0] != null) {
+ IOException exception = new IOException(errors[0].toString());
+ exception.initCause(errors[0]);
+ throw exception;
+ }
+ if (handle == null) {
+ throw new IOException(Messages.TcfURLConnection_NoFileHandleReturned);
+ }
+ } else {
+ throw new IOException(Messages.Operation_NoFileSystemError);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLConnection#connect()
+ */
+ @Override
+ public void connect() throws IOException {
+ if (!connected) {
+ openFile();
+ if (doInput) {
+ inputStream = new TcfInputStream(this);
+ }
+ if (doOutput) {
+ outputStream = new TcfOutputStream(this);
+ }
+ connected = true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLConnection#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() throws IOException {
+ if (!connected)
+ connect();
+ return inputStream;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.net.URLConnection#getOutputStream()
+ */
+ @Override
+ public OutputStream getOutputStream() throws IOException {
+ if (!connected)
+ connect();
+ return outputStream;
+ }
+
+ /**
+ * Close the stream, release its file handler and close
+ * the TCF channel used if possible.
+ *
+ * @param stream The stream either the input stream or the output stream.
+ * @throws IOException If closing file handle times out.
+ */
+ public synchronized void closeStream(Closeable stream) throws IOException {
+ boolean shouldClose = shouldCloseFileHandle(stream);
+ if (shouldClose) {
+ service.close(handle, new DoneClose() {
+ @Override
+ public void doneClose(IToken token, FileSystemException error) {
+ Tcf.getChannelManager().closeChannel(channel);
+ }
+ });
+ }
+ }
+
+ /**
+ * Decide if the file handle and the TCF channel should be closed if
+ * the specified stream is closed. If the stream is the last stream
+ * that depends on the file handle and the TCF channel, then it should
+ * be closed.
+ *
+ * @param stream The stream to be closed.
+ * @return true if the file handle and the TCF channel should be closed.
+ */
+ private boolean shouldCloseFileHandle(Closeable stream) {
+ boolean shouldClose = false;
+ if (stream == inputStream) {
+ if (doOutput) {
+ if (outputStream.closed) {
+ shouldClose = true;
+ }
+ } else {
+ shouldClose = true;
+ }
+ } else if (stream == outputStream) {
+ if (doInput) {
+ if (inputStream.closed)
+ shouldClose = true;
+ } else {
+ shouldClose = true;
+ }
+ }
+ return shouldClose;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/.settings/org.eclipse.jdt.core.prefs
index 1bf40d52c..724b6a738 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/.settings/org.eclipse.jdt.core.prefs
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,384 +1,385 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=warning
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=100
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=4
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=100
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=4
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/META-INF/MANIFEST.MF
index 58addd0f9..82308655b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/META-INF/MANIFEST.MF
@@ -1,24 +1,24 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.tcf.remote.core;singleton:=true
-Bundle-Version: 1.4.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.remote.core;bundle-version="1.0.0",
- org.eclipse.tcf.te.tcf.locator;bundle-version="1.4.0",
- org.eclipse.tcf.core;bundle-version="1.4.0",
- org.eclipse.tcf.te.runtime;bundle-version="1.4.0",
- org.eclipse.tcf.te.core;bundle-version="1.4.0",
- org.eclipse.tcf.te.runtime.model;bundle-version="1.4.0",
- org.eclipse.core.filesystem;bundle-version="1.3.200",
- org.eclipse.tcf.te.tcf.core;bundle-version="1.4.0",
- org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.4.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.tcf.remote.core,
- org.eclipse.tcf.te.tcf.remote.core.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.remote.core.nls;x-internal:=true,
- org.eclipse.tcf.te.tcf.remote.core.operation
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.remote.core;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.remote.core;bundle-version="2.0.0",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.4.0",
+ org.eclipse.tcf.core;bundle-version="1.4.0",
+ org.eclipse.tcf.te.runtime;bundle-version="1.4.0",
+ org.eclipse.tcf.te.core;bundle-version="1.4.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.4.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.200",
+ org.eclipse.tcf.te.tcf.core;bundle-version="1.4.0",
+ org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.4.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.remote.core,
+ org.eclipse.tcf.te.tcf.remote.core.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.remote.core.nls;x-internal:=true,
+ org.eclipse.tcf.te.tcf.remote.core.operation
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/plugin.xml
index ece1187df..aa491b220 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/plugin.xml
@@ -1,20 +1,59 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.remote.core.remoteServices">
- <remoteServices
- class="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
- id="org.eclipse.tcf.te.tcf.remote.core.TCFService"
- name="TCF"
- scheme="tcf">
- </remoteServices>
- </extension>
- <extension point="org.eclipse.core.filesystem.filesystems"
- id="org.eclipse.tcf.te.tcf.remote.core.filesystem">
- <filesystem scheme="tcf">
- <run class="org.eclipse.tcf.te.tcf.remote.core.TCFEclipseFileSystem"/>
- </filesystem>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension point="org.eclipse.remote.core.remoteServices">
+ <connectionType
+ canAdd="false"
+ canEdit="false"
+ canRemove="false"
+ id="org.eclipse.tcf.te.tcf.remote"
+ name="TCF"
+ scheme="tcf">
+ </connectionType>
+
+ <connectionTypeService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteConnectionProviderService">
+ </connectionTypeService>
+
+ <connectionService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteConnectionControlService">
+ </connectionService>
+ <connectionService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteConnectionPropertyService">
+ </connectionService>
+ <connectionService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteProcessService">
+ </connectionService>
+ <connectionService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteFileService">
+ </connectionService>
+ <connectionService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteConnectionHostService">
+ </connectionService>
+
+ <processService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.core.TCFServicesFactory"
+ service="org.eclipse.remote.core.IRemoteProcessControlService">
+ </processService>
+ </extension>
+ <extension point="org.eclipse.core.filesystem.filesystems"
+ id="org.eclipse.tcf.te.tcf.remote.core.filesystem">
+ <filesystem scheme="tcf">
+ <run class="org.eclipse.tcf.te.tcf.remote.core.TCFEclipseFileSystem"/>
+ </filesystem>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnection.java
index 37bb00a76..abd5194cb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnection.java
@@ -1,272 +1,334 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import static java.util.Collections.emptyMap;
-import static java.util.Collections.unmodifiableMap;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteConnectionChangeEvent;
-import org.eclipse.remote.core.IRemoteConnectionChangeListener;
-import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
-import org.eclipse.remote.core.IRemoteFileManager;
-import org.eclipse.remote.core.IRemoteProcess;
-import org.eclipse.remote.core.IRemoteProcessBuilder;
-import org.eclipse.remote.core.exception.RemoteConnectionException;
-import org.eclipse.tcf.protocol.IPeer;
-import org.eclipse.tcf.te.core.interfaces.IConnectable;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationGetEnvironment;
-
-public class TCFConnection extends TCFConnectionBase {
-
- private static enum EState {OPEN, CLOSED_TCF, CLOSED_REMOTE_SERVICES}
-
- private final String fName;
- private volatile IPeerNode fPeerNode;
- private final List<IRemoteConnectionChangeListener> fListeners = new ArrayList<IRemoteConnectionChangeListener>();
-
- private volatile EState fState;
- private Map<String, String> fAttributes;
- private Map<String, String> fEnvironment;
-
- public TCFConnection(TCFRemoteServices tcfServices, IPeerNode peerNode) {
- super(tcfServices);
- fName = peerNode.getName();
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionControlService;
+import org.eclipse.remote.core.IRemoteConnectionHostService;
+import org.eclipse.remote.core.IRemoteConnectionPropertyService;
+import org.eclipse.remote.core.IRemoteFileService;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
+import org.eclipse.remote.core.IRemoteProcessService;
+import org.eclipse.remote.core.RemoteConnectionChangeEvent;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
+import org.eclipse.remote.internal.core.RemotePath;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationGetEnvironment;
+
+public class TCFConnection implements
+ IRemoteConnectionHostService,
+ IRemoteConnectionPropertyService,
+ IRemoteProcessService,
+ IRemoteConnectionControlService,
+ IRemoteFileService {
+
+ public static final String CONNECTION_TYPE_ID = "org.eclipse.tcf.te.tcf.remote"; //$NON-NLS-1$
+
+ private IRemoteConnection fRemoteConnection;
+ private volatile IPeerNode fPeerNode;
+
+ private volatile boolean fOpen;
+ private Map<String, String> fEnvironment;
+ private String fWorkingDirectory = "/"; //$NON-NLS-1$
+ private String fBaseDirectory = ""; //$NON-NLS-1$
+
+ public TCFConnection(IPeerNode peerNode) {
fPeerNode = peerNode;
- fState = peerNode.getConnectState() == IConnectable.STATE_CONNECTED ? EState.OPEN : EState.CLOSED_TCF;
- }
-
- public TCFConnection(TCFRemoteServices tcfServices, String name) {
- super(tcfServices);
- fName = name;
- fState = EState.CLOSED_TCF;
- }
-
- public void setPeerNode(IPeerNode peerNode) {
- fPeerNode = peerNode;
- setConnectedTCF(peerNode.getConnectState() == IConnectable.STATE_CONNECTED);
- }
-
- public IPeerNode getPeerNode() {
- return fPeerNode;
- }
-
- @Override
- public String getAddress() {
- if (fPeerNode == null)
- return "0.0.0.0"; //$NON-NLS-1$
-
- return fPeerNode.getPeer().getAttributes().get(IPeer.ATTR_IP_HOST);
- }
-
- @Override
- public Map<String, String> getAttributes() {
- if (fPeerNode == null)
- return emptyMap();
-
- if (fAttributes == null) {
- Map<String, String> attributes = new HashMap<String, String>();
- attributes.put(OS_NAME_PROPERTY, fPeerNode.getPeer().getOSName());
- fAttributes = unmodifiableMap(attributes);
- }
- return fAttributes;
- }
-
- @Override
- public IRemoteProcess getCommandShell(int flags) throws IOException {
- throw new IOException(Messages.TCFConnection_errorNoCommandShell);
- }
-
- @Override
- public Map<String, String> getEnv() {
- if (fEnvironment == null && fPeerNode != null) {
- try {
- fEnvironment = new TCFOperationGetEnvironment(fPeerNode.getPeer()).execute(SubMonitor.convert(null));
- } catch (OperationCanceledException e) {
- } catch (CoreException e) {
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.TCFConnection_errorNoEnvironment, e));
- }
- }
- return fEnvironment;
- }
-
- @Override
- public IRemoteFileManager getFileManager() {
- return new TCFFileManager(this);
- }
-
- @Override
- public String getName() {
- return fName;
- }
-
- @Override
- public int getPort() {
- if (fPeerNode == null)
- return 0;
-
- try {
- return Integer.parseInt(fPeerNode.getPeer().getAttributes().get(IPeer.ATTR_IP_PORT));
- } catch (Exception e) {
- return 0;
- }
- }
-
- @Override
- public IRemoteProcessBuilder getProcessBuilder(List<String> command) {
- return new TCFProcessBuilder(this, command);
- }
-
- @Override
- public IRemoteProcessBuilder getProcessBuilder(String... command) {
- return new TCFProcessBuilder(this, command);
- }
-
- @Override
- public String getUsername() {
- if (fPeerNode == null)
- return null;
- return fPeerNode.getPeer().getAttributes().get(IPeer.ATTR_USER_NAME);
- }
-
- @Override
- public IRemoteConnectionWorkingCopy getWorkingCopy() {
- return new TCFConnectionWorkingCopy(this);
- }
-
- @Override
- public boolean isOpen() {
- return fState == EState.OPEN;
- }
-
- @Override
- public void open(IProgressMonitor monitor) throws RemoteConnectionException {
- if (fPeerNode == null) {
- getRemoteServices().getConnectionManager().waitForInitialization(monitor);
- }
- boolean notify = false;
- boolean performOpen = false;
- synchronized (this) {
- if (fState != EState.OPEN) {
- if (fPeerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
- fState = EState.OPEN;
- notify = true;
- } else {
- fState = EState.CLOSED_TCF;
- performOpen = true;
- }
- }
- }
- if (notify) {
- fireConnectionChangeEvent(IRemoteConnectionChangeEvent.CONNECTION_OPENED);
- } else if (performOpen) {
- getRemoteServices().getConnectionManager().open(fPeerNode, monitor);
- }
- }
-
- @Override
- public void close() {
- boolean notify = false;
- synchronized (this) {
- if (fState == EState.OPEN) {
- fState = EState.CLOSED_REMOTE_SERVICES;
- notify = true;
- }
- }
- if (notify) {
- fireConnectionChangeEvent(IRemoteConnectionChangeEvent.CONNECTION_CLOSED);
- }
- }
-
- void setConnectedTCF(boolean connected) {
- int notify = -1;
- synchronized (this) {
- if (connected) {
- if (fState == EState.CLOSED_TCF) {
- fState = EState.OPEN;
- notify = IRemoteConnectionChangeEvent.CONNECTION_OPENED;
- }
- } else {
- if (fState == EState.OPEN) {
- fState = EState.CLOSED_TCF;
- notify = IRemoteConnectionChangeEvent.CONNECTION_CLOSED;
- }
- }
- }
- if (notify != -1) {
- fireConnectionChangeEvent(notify);
- }
- }
-
-
- @Override
- public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
- synchronized (fListeners) {
- if (!fListeners.contains(listener))
- fListeners.add(listener);
- }
- }
-
- @Override
- public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
- synchronized (fListeners) {
- fListeners.remove(listener);
- }
- }
-
- private IRemoteConnectionChangeListener[] getListeners() {
- synchronized (fListeners) {
- return fListeners.toArray(new IRemoteConnectionChangeListener[fListeners.size()]);
- }
- }
-
- @Override
- public void fireConnectionChangeEvent(final int type) {
- final IRemoteConnection connection = this;
- new Job(Messages.TCFConnection_notifyListeners) {
- @SuppressWarnings("synthetic-access")
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IRemoteConnectionChangeEvent event = new IRemoteConnectionChangeEvent() {
- @Override
- public IRemoteConnection getConnection() {
- return connection;
- }
-
- @Override
- public int getType() {
- return type;
- }
- };
- for (Object listener : getListeners()) {
- ((IRemoteConnectionChangeListener) listener).connectionChanged(event);
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-}
+ fOpen = peerNode.getConnectState() == IConnectable.STATE_CONNECTED;
+ }
+
+ public TCFConnection(IRemoteConnection rc) {
+ fRemoteConnection = rc;
+ fOpen = false;
+ }
+
+ public String getName() {
+ if (fPeerNode != null)
+ return fPeerNode.getName();
+ return fRemoteConnection.getName();
+ }
+
+ @Override
+ public IRemoteConnection getRemoteConnection() {
+ return fRemoteConnection;
+ }
+
+ void setRemoteConnection(IRemoteConnection remoteConnection) {
+ fRemoteConnection = remoteConnection;
+ }
+
+ void setPeerNode(IPeerNode peerNode) {
+ if (fPeerNode == peerNode)
+ return;
+
+ fPeerNode = peerNode;
+ setConnectedTCF(peerNode.getConnectState() == IConnectable.STATE_CONNECTED);
+ }
+
+ public IPeerNode getPeerNode() {
+ return fPeerNode;
+ }
+
+ // IRemoteConnectionHostService
+ @Override
+ public String getHostname() {
+ if (fPeerNode == null)
+ return "0.0.0.0"; //$NON-NLS-1$
+
+ return getPeerProperty(IPeer.ATTR_IP_HOST);
+ }
+
+ private String getPeerProperty(String key) {
+ return fPeerNode.getPeer().getAttributes().get(key);
+ }
+
+ @Override
+ public int getPort() {
+ if (fPeerNode != null) {
+ try {
+ return Integer.parseInt(getPeerProperty(IPeer.ATTR_IP_PORT));
+ } catch (Exception e) {
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public int getTimeout() {
+ return 60;
+ }
+
+ @Override
+ public boolean useLoginShell() {
+ return false;
+ }
+
+ @Override
+ public String getUsername() {
+ if (fPeerNode == null)
+ return ""; //$NON-NLS-1$
+ return getPeerProperty(IPeer.ATTR_USER_NAME);
+ }
+
+ @Override
+ public void setHostname(String hostname) {}
+
+ @Override
+ public void setPassphrase(String passphrase) {}
+
+ @Override
+ public void setPassword(String password) {}
+
+ @Override
+ public void setPort(int port) {}
+
+ @Override
+ public void setTimeout(int timeout) {}
+
+ @Override
+ public void setUseLoginShell(boolean useLogingShell) {}
+
+ @Override
+ public void setUsePassword(boolean usePassword) {}
+
+ @Override
+ public void setUsername(String username) {}
+
+ // IRemoteConnectionPropertyService
+ @Override
+ public String getProperty(String key) {
+ if (fPeerNode == null)
+ return null;
+
+ if (IRemoteConnection.OS_NAME_PROPERTY.equals(key)) {
+ return getPeerProperty(IPeer.ATTR_OS_NAME);
+ }
+
+ return null;
+ }
+
+ // IRemoteProcessService
+ @Override
+ public Map<String, String> getEnv() {
+ if (fEnvironment == null && fPeerNode != null) {
+ try {
+ fEnvironment = new TCFOperationGetEnvironment(fPeerNode.getPeer()).execute(SubMonitor.convert(null));
+ } catch (OperationCanceledException e) {
+ } catch (CoreException e) {
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.TCFConnection_errorNoEnvironment, e));
+ }
+ }
+ return fEnvironment;
+ }
+
+ @Override
+ public String getEnv(String name) {
+ Map<String, String> map = getEnv();
+ if (map != null)
+ return map.get(name);
+ return null;
+ }
+
+ @Override
+ public IRemoteProcessBuilder getProcessBuilder(List<String> command) {
+ if (!isOpen())
+ return null;
+
+ return new TCFProcessBuilder(this, command);
+ }
+
+ @Override
+ public IRemoteProcessBuilder getProcessBuilder(String... command) {
+ if (!isOpen())
+ return null;
+
+ return new TCFProcessBuilder(this, command);
+ }
+
+
+ @Override
+ public String getWorkingDirectory() {
+ return fWorkingDirectory;
+ }
+
+ @Override
+ public void setWorkingDirectory(String path) {
+ fWorkingDirectory = path;
+ }
+
+ // IRemoteConnectionControlService
+ @Override
+ public boolean isOpen() {
+ return fOpen;
+ }
+
+ @Override
+ public void open(IProgressMonitor monitor) throws RemoteConnectionException {
+ if (fPeerNode == null) {
+ TCFConnectionManager.INSTANCE.waitForInitialization(monitor);
+ }
+ boolean open = false;
+ synchronized (this) {
+ if (fOpen)
+ return;
+
+ if (fPeerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
+ fOpen = open = true;
+ }
+ }
+ if (open) {
+ fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
+ } else {
+ TCFConnectionManager.INSTANCE.open(fPeerNode, monitor);
+ }
+ }
+
+ @Override
+ public void close() {
+ synchronized (this) {
+ if (!fOpen)
+ return;
+ fOpen = false;
+ }
+ fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_CLOSED);
+ TCFConnectionManager.INSTANCE.close(fPeerNode);
+ }
+
+ void setConnectedTCF(boolean connected) {
+ int notify = -1;
+ synchronized (this) {
+ if (connected) {
+ if (!fOpen) {
+ fOpen = true;
+ notify = RemoteConnectionChangeEvent.CONNECTION_OPENED;
+ }
+ } else {
+ if (fOpen) {
+ fOpen = false;
+ notify = RemoteConnectionChangeEvent.CONNECTION_CLOSED;
+ }
+ }
+ }
+ if (notify != -1) {
+ fireConnectionChangeEvent(notify);
+ }
+ }
+
+ private void fireConnectionChangeEvent(final int type) {
+ final IRemoteConnection rc = fRemoteConnection;
+ if (rc == null)
+ return;
+
+ new Job(Messages.TCFConnection_notifyListeners) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ rc.fireConnectionChangeEvent(type);
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ // IRemoteFileService
+ @Override
+ public String getBaseDirectory() {
+ return fBaseDirectory;
+ }
+
+ @Override
+ public String getDirectorySeparator() {
+ return "/"; //$NON-NLS-1$
+ }
+
+ @Override
+ public IFileStore getResource(String path) {
+ return new TCFFileStore(this, RemotePath.forPosix(path).toString(), null);
+ }
+
+ @Override
+ public void setBaseDirectory(String path) {
+ fBaseDirectory = path;
+ }
+
+ @Override
+ public String toPath(URI uri) {
+ return TCFFileStore.toPath(uri);
+ }
+
+ @Override
+ public URI toURI(String path) {
+ return toURI(RemotePath.forPosix(path));
+ }
+
+ @Override
+ public URI toURI(IPath path) {
+ if (!path.isAbsolute() && fBaseDirectory != null && fBaseDirectory.length() > 0) {
+ path = RemotePath.forPosix(fBaseDirectory).append(path);
+ }
+ return TCFFileStore.toURI(this, path.toString());
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionBase.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionBase.java
deleted file mode 100644
index 771e976d1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionBase.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.exception.RemoteConnectionException;
-import org.eclipse.remote.core.exception.UnableToForwardPortException;
-
-public abstract class TCFConnectionBase implements IRemoteConnection {
-
- private final TCFRemoteServices fRemoteServices;
-
- private String fWorkingDirectory = "/"; //$NON-NLS-1$
-
- public TCFConnectionBase(TCFRemoteServices tcfServices) {
- fRemoteServices = tcfServices;
- }
-
- @Override
- public final int compareTo(IRemoteConnection o) {
- return getName().compareTo(o.getName());
- }
-
- @Override
- public final String getProperty(String key) {
- return getAttributes().get(key);
- }
-
- @Override
- public final String getEnv(String name) {
- return getEnv().get(name);
- }
-
- @Override
- public final TCFRemoteServices getRemoteServices() {
- return fRemoteServices;
- }
-
- @Override
- public final String getWorkingDirectory() {
- return fWorkingDirectory;
- }
-
- @Override
- public final void forwardLocalPort(int localPort, String fwdAddress, int fwdPort) throws RemoteConnectionException {
- throw new UnableToForwardPortException(Messages.TCFConnectionBase_errorNoPortForwarding);
- }
-
- @Override
- public final int forwardLocalPort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
- throw new UnableToForwardPortException(Messages.TCFConnectionBase_errorNoPortForwarding);
- }
-
- @Override
- public final void forwardRemotePort(int remotePort, String fwdAddress, int fwdPort) throws RemoteConnectionException {
- throw new UnableToForwardPortException(Messages.TCFConnectionBase_errorNoPortForwarding);
- }
-
- @Override
- public final int forwardRemotePort(String fwdAddress, int fwdPort, IProgressMonitor monitor) throws RemoteConnectionException {
- throw new UnableToForwardPortException(Messages.TCFConnectionBase_errorNoPortForwarding);
- }
-
- @Override
- public final void removeLocalPortForwarding(int port) {
- }
-
- @Override
- public final void removeRemotePortForwarding(int port) {
- }
-
- @Override
- public final void setWorkingDirectory(String path) {
- if (new Path(path).isAbsolute()) {
- fWorkingDirectory = path;
- }
- }
- @Override
- public final boolean supportsTCPPortForwarding() {
- return false;
- }
-
- @Override
- public final String toString() {
- String str = getName() + " [" + getAddress(); //$NON-NLS-1$
- int port = getPort();
- if (port >= 0 && port != 1756) {
- str += ":" + port; //$NON-NLS-1$
- }
- return str + "]"; //$NON-NLS-1$
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionManager.java
index f856e0b07..82db7ebc7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionManager.java
@@ -1,216 +1,257 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.remote.core.AbstractRemoteConnectionManager;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
-import org.eclipse.remote.core.exception.RemoteConnectionException;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.core.interfaces.IConnectable;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.events.ChangeEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
-import org.eclipse.tcf.te.tcf.locator.interfaces.IPeerModelListener;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
-import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
-
-public class TCFConnectionManager extends AbstractRemoteConnectionManager implements IPeerModelListener, IEventListener {
- private final Map<String, TCFConnection> fConnections = Collections.synchronizedMap(new HashMap<String, TCFConnection>());
- private int fInitialized = 0;
-
- public TCFConnectionManager(TCFRemoteServices services) {
- super(services);
- }
-
- @Override
- protected TCFRemoteServices getRemoteServices() {
- return (TCFRemoteServices) super.getRemoteServices();
- }
-
- public void initialize() {
- synchronized (fConnections) {
- if (fInitialized > 0)
- return;
-
- fInitialized = 1;
-
- Protocol.invokeLater(new Runnable() {
- @SuppressWarnings("synthetic-access")
- @Override
- public void run() {
- EventManager.getInstance().addEventListener(TCFConnectionManager.this, ChangeEvent.class);
- IPeerModel peerModel = ModelManager.getPeerModel();
- peerModel.addListener(TCFConnectionManager.this);
-
- synchronized (fConnections) {
- for (IPeerNode peerNode : peerModel.getPeerNodes()) {
- String name = peerNode.getPeer().getName();
- TCFConnection connection = fConnections.get(name);
- if (connection != null) {
- connection.setPeerNode(peerNode);
- } else {
- fConnections.put(name, new TCFConnection(getRemoteServices(), peerNode));
- }
- }
- for (Iterator<TCFConnection> it = fConnections.values().iterator(); it.hasNext(); ) {
- TCFConnection conn = it.next();
- if (conn.getPeerNode() == null)
- it.remove();
- }
- fInitialized = 2;
- fConnections.notifyAll();
- }
- }
- });
- }
- }
-
- public void waitForInitialization(IProgressMonitor monitor) {
- synchronized (fConnections) {
- if (fInitialized == 2)
- return;
- if (fInitialized == 0)
- initialize();
-
- while (fInitialized != 2) {
- if (monitor.isCanceled())
- return;
- try {
- fConnections.wait(500);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return;
- }
- }
- }
- }
-
- @Override
- public void modelChanged(IPeerModel model, IPeerNode peerNode, boolean added) {
- String name = peerNode.getPeer().getName();
- if (added) {
- synchronized (fConnections) {
- if (!fConnections.containsKey(name)) {
- fConnections.put(name, new TCFConnection(getRemoteServices(), peerNode));
- }
- }
- } else {
- TCFConnection connection = fConnections.remove(name);
- if (connection != null) {
- connection.setConnectedTCF(false);
- }
- }
- }
-
- @Override
- public void modelDisposed(IPeerModel model) {
- fConnections.clear();
- }
-
- @Override
- public void eventFired(EventObject event) {
- final ChangeEvent changeEvent = (ChangeEvent) event;
- final Object source = changeEvent.getSource();
- if (source instanceof IPeerNode && IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId())) {
- IPeerNode peerNode = (IPeerNode) source;
- TCFConnection connection = fConnections.get(peerNode.getPeer().getName());
- if (connection != null) {
- Object val= changeEvent.getNewValue();
- boolean connected = val instanceof Number && ((Number) val).intValue() == IConnectable.STATE_CONNECTED;
- connection.setConnectedTCF(connected);
- }
- }
- }
-
- @Override
- public IRemoteConnection getConnection(String name) {
- synchronized (fConnections) {
- TCFConnection connection = fConnections.get(name);
- if (connection == null && fInitialized < 2) {
- connection = new TCFConnection(getRemoteServices(), name);
- fConnections.put(name, connection);
- }
- }
- return fConnections.get(name);
- }
-
- @Override
- public IRemoteConnection getConnection(URI uri) {
- String connName = TCFEclipseFileSystem.getConnectionNameFor(uri);
- if (connName != null) {
- return getConnection(connName);
- }
- return null;
- }
-
- @Override
- public List<IRemoteConnection> getConnections() {
- synchronized (fConnections) {
- return new ArrayList<IRemoteConnection>(fConnections.values());
- }
- }
-
- @Override
- public IRemoteConnectionWorkingCopy newConnection(String name) throws RemoteConnectionException {
- throw new RemoteConnectionException(Messages.TCFConnectionManager_errorNoCreateConnection);
- }
-
- @Override
- public void removeConnection(IRemoteConnection conn) {
- }
-
- void open(IPeerNode peerNode, IProgressMonitor monitor) throws RemoteConnectionException {
- final boolean[] done = {false};
- Callback callback = new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- synchronized (done) {
- done[0] = true;
- done.notify();
- }
- }
- };
- synchronized (done) {
- peerNode.changeConnectState(IConnectable.ACTION_CONNECT, callback, monitor);
- try {
- if (!done[0])
- done.wait();
- } catch (InterruptedException e) {
- throw new RemoteConnectionException(e);
- }
- }
- if (peerNode.getConnectState() != IConnectable.STATE_CONNECTED) {
- IStatus status = callback.getStatus();
- if (status != null && !status.isOK()) {
- String msg = status.getMessage();
- if (msg != null && msg.length() > 0) {
- throw new RemoteConnectionException(msg, status.getException());
- }
- }
- throw new RemoteConnectionException(Messages.TCFConnectionManager_errorCannotConnect, status != null ? status.getException() : null);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
+import org.eclipse.remote.core.exception.RemoteConnectionException;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.IPeerModelListener;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
+import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+import org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator;
+
+public class TCFConnectionManager implements IPeerModelListener, IEventListener {
+
+ public static final TCFConnectionManager INSTANCE = new TCFConnectionManager();
+
+ private final Map<String, TCFConnection> fConnections = Collections.synchronizedMap(new HashMap<String, TCFConnection>());
+ private IRemoteConnectionType fConnectionType;
+ private int fInitialized = 0;
+
+ public TCFConnection mapConnection(IRemoteConnection rc) {
+ if (rc == null)
+ return null;
+ if (!rc.getConnectionType().getId().equals(TCFConnection.CONNECTION_TYPE_ID))
+ return null;
+
+ synchronized(fConnections) {
+ String name = rc.getName();
+ TCFConnection result = fConnections.get(name);
+ if (result == null) {
+ result = new TCFConnection(rc);
+ fConnections.put(name, result);
+ }
+ return result;
+ }
+ }
+
+ public void setConnectionType(IRemoteConnectionType connectionType) {
+ synchronized(fConnections) {
+ fConnectionType = connectionType;
+ initialize();
+ syncConnections();
+ }
+ }
+
+ public void initialize() {
+ synchronized (fConnections) {
+ if (fInitialized > 0)
+ return;
+
+ fInitialized = 1;
+
+ Protocol.invokeLater(new Runnable() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ EventManager.getInstance().addEventListener(TCFConnectionManager.this, ChangeEvent.class);
+ IPeerModel peerModel = ModelManager.getPeerModel();
+ peerModel.addListener(TCFConnectionManager.this);
+
+ synchronized (fConnections) {
+ for (IPeerNode peerNode : peerModel.getPeerNodes()) {
+ String name = peerNode.getPeer().getName();
+ TCFConnection connection = fConnections.get(name);
+ if (connection == null) {
+ fConnections.put(name, new TCFConnection(peerNode));
+ } else {
+ connection.setPeerNode(peerNode);
+ }
+ }
+ fInitialized = 2;
+ syncConnections();
+ fConnections.notifyAll();
+ }
+ }
+
+ });
+ }
+ }
+
+ void syncConnections() {
+ if (fConnectionType != null && fInitialized == 2) {
+ // Remove all connections without a peer
+ for (IRemoteConnection rc : new ArrayList<IRemoteConnection>(fConnectionType.getConnections())) {
+ String name = rc.getName();
+ TCFConnection connection = fConnections.get(name);
+ if (connection == null || connection.getPeerNode() == null) {
+ try {
+ fConnectionType.removeConnection(rc);
+ } catch (RemoteConnectionException e) {
+ CoreBundleActivator.logError("Cannot remove remote connection.", e); //$NON-NLS-1$
+ }
+ fConnections.remove(name);
+ }
+ }
+ // Add connections with peers
+ for (Iterator<TCFConnection> it = fConnections.values().iterator(); it.hasNext(); ) {
+ TCFConnection connection = it.next();
+ IPeerNode peerNode = connection.getPeerNode();
+ if (peerNode == null) {
+ it.remove();
+ } else {
+ addRemoteConnection(connection);
+ }
+ }
+ }
+ }
+
+ private void addRemoteConnection(TCFConnection connection) {
+ if (fConnectionType == null)
+ return;
+
+ String name = connection.getName();
+ if (fConnectionType.getConnection(name) == null) {
+ try {
+ IRemoteConnectionWorkingCopy wc = fConnectionType.newConnection(name);
+ IRemoteConnection rc = wc.save();
+ connection.setRemoteConnection(rc);
+ } catch (RemoteConnectionException e) {
+ CoreBundleActivator.logError("Cannot add remote connection.", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void waitForInitialization(IProgressMonitor monitor) {
+ synchronized (fConnections) {
+ if (fInitialized == 2)
+ return;
+ if (fInitialized == 0)
+ initialize();
+
+ while (fInitialized != 2) {
+ if (monitor.isCanceled())
+ return;
+ try {
+ fConnections.wait(500);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void modelChanged(IPeerModel model, IPeerNode peerNode, boolean added) {
+ String name = peerNode.getPeer().getName();
+ if (added) {
+ synchronized (fConnections) {
+ TCFConnection connection = fConnections.get(name);
+ if (connection != null) {
+ connection.setPeerNode(peerNode);
+ } else {
+ connection = new TCFConnection(peerNode);
+ fConnections.put(name, connection);
+ }
+ addRemoteConnection(connection);
+ }
+ } else {
+ TCFConnection connection = fConnections.remove(name);
+ if (connection != null) {
+ connection.setConnectedTCF(false);
+ IRemoteConnection rc = connection.getRemoteConnection();
+ if (rc != null) {
+ try {
+ rc.getConnectionType().removeConnection(rc);
+ } catch (RemoteConnectionException e) {
+ CoreBundleActivator.logError("Cannot remove remote connection.", e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void modelDisposed(IPeerModel model) {
+ fConnections.clear();
+ }
+
+ @Override
+ public void eventFired(EventObject event) {
+ final ChangeEvent changeEvent = (ChangeEvent) event;
+ final Object source = changeEvent.getSource();
+ if (source instanceof IPeerNode && IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId())) {
+ IPeerNode peerNode = (IPeerNode) source;
+ TCFConnection connection = fConnections.get(peerNode.getPeer().getName());
+ if (connection != null) {
+ Object val= changeEvent.getNewValue();
+ boolean connected = val instanceof Number && ((Number) val).intValue() == IConnectable.STATE_CONNECTED;
+ connection.setConnectedTCF(connected);
+ }
+ }
+ }
+
+ void open(IPeerNode peerNode, IProgressMonitor monitor) throws RemoteConnectionException {
+ final boolean[] done = {false};
+ Callback callback = new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ synchronized (done) {
+ done[0] = true;
+ done.notify();
+ }
+ }
+ };
+ synchronized (done) {
+ peerNode.changeConnectState(IConnectable.ACTION_CONNECT, callback, monitor);
+ try {
+ if (!done[0])
+ done.wait();
+ } catch (InterruptedException e) {
+ throw new RemoteConnectionException(e);
+ }
+ }
+ if (peerNode.getConnectState() != IConnectable.STATE_CONNECTED) {
+ IStatus status = callback.getStatus();
+ if (status != null && !status.isOK()) {
+ String msg = status.getMessage();
+ if (msg != null && msg.length() > 0) {
+ throw new RemoteConnectionException(msg, status.getException());
+ }
+ }
+ throw new RemoteConnectionException(Messages.TCFConnectionManager_errorCannotConnect, status != null ? status.getException() : null);
+ }
+ }
+
+ void close(IPeerNode peerNode) {
+ peerNode.changeConnectState(IConnectable.ACTION_DISCONNECT, new Callback(), null);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionWorkingCopy.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionWorkingCopy.java
deleted file mode 100644
index 71b438b56..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFConnectionWorkingCopy.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteConnectionChangeListener;
-import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
-import org.eclipse.remote.core.IRemoteFileManager;
-import org.eclipse.remote.core.IRemoteProcess;
-import org.eclipse.remote.core.IRemoteProcessBuilder;
-import org.eclipse.remote.core.exception.RemoteConnectionException;
-
-public class TCFConnectionWorkingCopy extends TCFConnectionBase implements IRemoteConnectionWorkingCopy {
-
- private final TCFConnection fConnection;
-
- public TCFConnectionWorkingCopy(TCFConnection connection) {
- super(connection.getRemoteServices());
- fConnection = connection;
- }
-
- @Override
- public IRemoteConnection getOriginal() {
- return fConnection;
- }
- @Override
- public boolean isDirty() {
- return false;
- }
- @Override
- public IRemoteConnection save() {
- return fConnection;
- }
- @Override
- public void setAddress(String address) {
- }
-
- @Override
- public void setAttribute(String key, String value) {
- }
-
- @Override
- public void setName(String name) {
- }
-
- @Override
- public void setPassword(String password) {
- }
-
- @Override
- public void setPort(int port) {
- }
-
- @Override
- public void setUsername(String username) {
- }
-
- @Override
- public void addConnectionChangeListener(IRemoteConnectionChangeListener listener) {
- fConnection.addConnectionChangeListener(listener);
- }
-
- @Override
- public void close() {
- fConnection.close();
- }
-
- @Override
- public void fireConnectionChangeEvent(int type) {
- fConnection.fireConnectionChangeEvent(type);
- }
-
- @Override
- public String getAddress() {
- return fConnection.getAddress();
- }
-
- @Override
- public Map<String, String> getAttributes() {
- return fConnection.getAttributes();
- }
-
- @Override
- public IRemoteProcess getCommandShell(int flags) throws IOException {
- return fConnection.getCommandShell(flags);
- }
-
- @Override
- public Map<String, String> getEnv() {
- return fConnection.getEnv();
- }
-
- @Override
- public IRemoteFileManager getFileManager() {
- return fConnection.getFileManager();
- }
-
- @Override
- public String getName() {
- return fConnection.getName();
- }
-
- @Override
- public int getPort() {
- return fConnection.getPort();
- }
-
- @Override
- public IRemoteProcessBuilder getProcessBuilder(List<String> command) {
- return fConnection.getProcessBuilder(command);
- }
-
- @Override
- public IRemoteProcessBuilder getProcessBuilder(String... command) {
- return fConnection.getProcessBuilder(command);
- }
-
- @Override
- public String getUsername() {
- return fConnection.getUsername();
- }
-
- @Override
- public IRemoteConnectionWorkingCopy getWorkingCopy() {
- return this;
- }
-
- @Override
- public boolean isOpen() {
- return fConnection.isOpen();
- }
-
- @Override
- public void open(IProgressMonitor monitor) throws RemoteConnectionException {
- fConnection.open(monitor);
- }
-
- @Override
- public void removeConnectionChangeListener(IRemoteConnectionChangeListener listener) {
- fConnection.removeConnectionChangeListener(listener);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFEclipseFileSystem.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFEclipseFileSystem.java
index 513c6436b..861f619b7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFEclipseFileSystem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFEclipseFileSystem.java
@@ -1,78 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileSystem;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemoteServices;
-import org.eclipse.remote.core.RemoteServices;
-
-public class TCFEclipseFileSystem extends FileSystem {
-
- public static final String SCHEME = "tcf"; //$NON-NLS-1$
-
- public static String getConnectionNameFor(URI uri) {
- return uri.getAuthority();
- }
-
- public static URI getURIFor(TCFConnection connection, String path) throws URISyntaxException {
- return new URI(SCHEME, connection.getName(), path, null, null);
- }
-
- public static IRemoteConnection getConnection(URI uri) {
- if (!SCHEME.equals(uri.getScheme()))
- return null;
- String peerName = uri.getAuthority();
- if (peerName == null)
- return null;
-
- IRemoteServices trs = RemoteServices.getRemoteServices(TCFRemoteServices.TCF_ID);
- if (trs == null)
- return null;
-
- return trs.getConnectionManager().getConnection(peerName);
- }
-
- public TCFEclipseFileSystem() {
- super();
- }
-
- @Override
- public int attributes() {
- return EFS.ATTRIBUTE_READ_ONLY | EFS.ATTRIBUTE_EXECUTABLE;
- }
-
- @Override
- public boolean canDelete() {
- return true;
- }
-
- @Override
- public boolean canWrite() {
- return true;
- }
-
- @Override
- public IFileStore getStore(IPath path) {
- return EFS.getNullFileSystem().getStore(path);
- }
-
- @Override
- public IFileStore getStore(URI uri) {
- return TCFFileStore.getInstance(uri);
- }
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import java.net.URI;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileSystem;
+import org.eclipse.core.runtime.IPath;
+
+public class TCFEclipseFileSystem extends FileSystem {
+
+
+ public TCFEclipseFileSystem() {
+ super();
+ }
+
+ @Override
+ public int attributes() {
+ return EFS.ATTRIBUTE_READ_ONLY | EFS.ATTRIBUTE_EXECUTABLE;
+ }
+
+ @Override
+ public boolean canDelete() {
+ return true;
+ }
+
+ @Override
+ public boolean canWrite() {
+ return true;
+ }
+
+ @Override
+ public IFileStore getStore(IPath path) {
+ return EFS.getNullFileSystem().getStore(path);
+ }
+
+ @Override
+ public IFileStore getStore(URI uri) {
+ return TCFFileStore.getInstance(uri);
+ }
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileManager.java
deleted file mode 100644
index 306fd747e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileManager.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.net.URI;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.remote.core.IRemoteFileManager;
-
-public class TCFFileManager implements IRemoteFileManager {
- private final TCFConnection fConnection;
-
- public TCFFileManager(TCFConnection connection) {
- fConnection = connection;
- }
-
- @Override
- public String getDirectorySeparator() {
- return "/"; //$NON-NLS-1$
- }
-
- @Override
- public IFileStore getResource(String pathStr) {
- if (!pathStr.startsWith("/")) { //$NON-NLS-1$
- pathStr = fConnection.getWorkingDirectory() + "/" + pathStr; //$NON-NLS-1$
- }
- return TCFFileStore.getInstance(fConnection, pathStr, null);
- }
-
- @Override
- public String toPath(URI uri) {
- return uri.getPath();
- }
-
- @Override
- public URI toURI(IPath path) {
- try {
- return TCFEclipseFileSystem.getURIFor(fConnection, path.toString());
- } catch (Exception e) {
- return null;
- }
- }
-
- @Override
- public URI toURI(String path) {
- return toURI(new Path(path));
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileStore.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileStore.java
index 63d36c3a8..6bad00765 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileStore.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFFileStore.java
@@ -1,203 +1,251 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileInfo;
-import org.eclipse.core.filesystem.provider.FileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.tcf.services.IFileSystem.FileAttrs;
-import org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationChildStores;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationDelete;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationFetchInfo;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationMkDir;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationOpenInputStream;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationOpenOutputStream;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationPutInfo;
-
-public final class TCFFileStore extends FileStore {
-
- public static IFileStore getInstance(URI uri) {
- IRemoteConnection connection = TCFEclipseFileSystem.getConnection(uri);
- if (connection instanceof TCFConnection)
- return new TCFFileStore((TCFConnection) connection, uri, null);
-
- return EFS.getNullFileSystem().getStore(new Path(uri.getPath()));
- }
-
- public static IFileStore getInstance(TCFConnection connection, String path, TCFFileStore parent) {
- try {
- URI uri = TCFEclipseFileSystem.getURIFor(connection, path);
- return new TCFFileStore(connection, uri, parent);
- } catch (URISyntaxException e) {
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.TCFFileManager_errorFileStoreForPath, e));
- }
- return EFS.getNullFileSystem().getStore(new Path(path));
- }
-
- private final URI fURI;
- private final TCFConnection fConnection;
- private FileAttrs fAttributes;
- private IFileStore fParent;
-
- private TCFFileStore(TCFConnection connection, URI uri, TCFFileStore parent) {
- fURI = uri;
- fConnection = connection;
- fParent = parent;
- }
-
- @Override
- public URI toURI() {
- return fURI;
- }
-
- public TCFConnection getConnection() {
- return fConnection;
- }
-
- public String getPath() {
- return fURI.getPath();
- }
-
- public void setAttributes(FileAttrs attrs) {
- fAttributes = attrs;
- }
-
- public FileAttrs getAttributes() {
- return fAttributes;
- }
-
- @Override
- public IFileStore getChild(String name) {
- String path = getPath() + '/' + name;
- path = path.replaceAll("/+", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- if (path.length() > 1 && path.endsWith("/")) //$NON-NLS-1$
- path = path.substring(0, path.length()-1);
- return getInstance(fConnection, path, this);
- }
-
- @Override
- public String getName() {
- String path = getPath();
- int idx = path.lastIndexOf('/');
- if (idx > 0)
- return path.substring(idx + 1);
- return path;
- }
-
- @Override
- public IFileStore getParent() {
- if (fParent != null)
- return fParent;
-
- String path = getPath();
- int idx = path.lastIndexOf('/');
- if (idx < 1)
- return null;
-
- fParent = getInstance(fConnection, path.substring(0, idx-1), null);
- return fParent;
- }
-
- @Override
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
- try {
- return new TCFOperationFetchInfo(this).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- }
- return new FileInfo(getName());
- }
-
- @Override
- public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
- try {
- return new TCFOperationChildStores(this).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- }
- return new IFileStore[0];
- }
-
- @Override
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
- IFileStore[] children = childStores(options, monitor);
- String[] result = new String[children.length];
- int i = 0;
- for (IFileStore s : children) {
- result[i++] = s.getName();
- }
- return result;
- }
-
- @Override
- public void delete(int options, IProgressMonitor monitor) throws CoreException {
- try {
- new TCFOperationDelete(this).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- }
- }
-
- @Override
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
- boolean shallow = (options & EFS.SHALLOW) == EFS.SHALLOW;
- try {
- new TCFOperationMkDir(this, shallow).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- }
- return this;
- }
-
- @Override
- public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
- boolean setAttribs = (options & EFS.SET_ATTRIBUTES) != 0;
- boolean setLastModified = (options & EFS.SET_LAST_MODIFIED) != 0;
- try {
- if (setAttribs || setLastModified) {
- new TCFOperationPutInfo(this, info, setAttribs, setLastModified).execute(SubMonitor.convert(monitor));
- }
- } catch (OperationCanceledException e) {
- }
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
- try {
- return new TCFOperationOpenInputStream(this).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- return null;
- }
- }
-
- @Override
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
- boolean append = (options & EFS.APPEND) != 0;
- try {
- return new TCFOperationOpenOutputStream(this, append).execute(SubMonitor.convert(monitor));
- } catch (OperationCanceledException e) {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.filesystem.provider.FileInfo;
+import org.eclipse.core.filesystem.provider.FileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteServicesManager;
+import org.eclipse.remote.internal.core.RemotePath;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.te.tcf.remote.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationChildStores;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationDelete;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationFetchInfo;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationMkDir;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationOpenInputStream;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationOpenOutputStream;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationPutInfo;
+
+public final class TCFFileStore extends FileStore {
+ public static final String SCHEME = "tcf"; //$NON-NLS-1$
+ public static final String NOSLASH_MARKER = "/./"; //$NON-NLS-1$
+
+ public static String addNoSlashMarker(String path) {
+ if (path.length() > 0 && path.charAt(0) != '/')
+ return NOSLASH_MARKER + path;
+ return path;
+ }
+
+ public static String stripNoSlashMarker(String path) {
+ if (path.startsWith(NOSLASH_MARKER))
+ return path.substring(NOSLASH_MARKER.length());
+ return path;
+ }
+
+ public static URI toURI(TCFConnection connection, String path) {
+ try {
+ return new URI(SCHEME, connection.getName(), addNoSlashMarker(path), null, null);
+ } catch (URISyntaxException e) {
+ return null;
+ }
+ }
+
+ public static String toPath(URI uri) {
+ return stripNoSlashMarker(uri.getPath());
+ }
+
+
+ public static TCFConnection toConnection(URI uri) {
+ IRemoteServicesManager rsm = CoreBundleActivator.getService(IRemoteServicesManager.class);
+ if (rsm == null)
+ return null;
+
+ IRemoteConnectionType ct = rsm.getConnectionType(uri);
+ if (ct == null)
+ return null;
+
+ String peerName = uri.getAuthority();
+ if (peerName == null)
+ return null;
+
+ return TCFConnectionManager.INSTANCE.mapConnection(ct.getConnection(peerName));
+ }
+
+
+ public static IFileStore getInstance(URI uri) {
+ TCFConnection connection = toConnection(uri);
+ String path = toPath(uri);
+ if (connection != null) {
+ return new TCFFileStore(connection, path, null);
+ }
+ return EFS.getNullFileSystem().getStore(RemotePath.forPosix(path));
+ }
+
+ private final TCFConnection fConnection;
+ private final String fPath;
+ private FileAttrs fAttributes;
+ private TCFFileStore fParent;
+ private boolean fArtificialRoot;
+
+ TCFFileStore(TCFConnection connection, String path, TCFFileStore parent) {
+ fPath = path;
+ fConnection = connection;
+ fParent = parent;
+ }
+
+ @Override
+ public URI toURI() {
+ return toURI(fConnection, fPath);
+ }
+
+ public TCFConnection getConnection() {
+ return fConnection;
+ }
+
+ public String getPath() {
+ return fPath;
+ }
+
+ public void setAttributes(FileAttrs attrs) {
+ fAttributes = attrs;
+ }
+
+ public FileAttrs getAttributes() {
+ return fAttributes;
+ }
+
+ @Override
+ public IFileStore getChild(String name) {
+ // Remove trailing slash
+ if (name.length() > 1 && name.endsWith("/")) //$NON-NLS-1$
+ name = name.substring(0, name.length()-1);
+
+ String path;
+ if (fArtificialRoot) {
+ path = name;
+ } else if (fPath.endsWith("/")) { //$NON-NLS-1$
+ path = fPath + name;
+ } else {
+ path = fPath + "/" + name; //$NON-NLS-1$
+ }
+ return new TCFFileStore(fConnection, path, this);
+ }
+
+ @Override
+ public String getName() {
+ String path = getPath();
+ if (fParent == null || fParent.fArtificialRoot)
+ return path;
+
+ int idx = path.lastIndexOf('/', path.length()-2);
+ if (idx > 0)
+ return path.substring(idx + 1);
+ return path;
+ }
+
+ @Override
+ public IFileStore getParent() {
+ if (fParent != null)
+ return fParent;
+
+ int idx = fPath.lastIndexOf('/');
+ if (idx < 1)
+ return null;
+
+ fParent = new TCFFileStore(fConnection, fPath.substring(0, idx-1), null);
+ return fParent;
+ }
+
+ @Override
+ public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
+ try {
+ return new TCFOperationFetchInfo(this).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ }
+ return new FileInfo(getName());
+ }
+
+ @Override
+ public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
+ try {
+ return new TCFOperationChildStores(this).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ }
+ return new IFileStore[0];
+ }
+
+ @Override
+ public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
+ IFileStore[] children = childStores(options, monitor);
+ String[] result = new String[children.length];
+ int i = 0;
+ for (IFileStore s : children) {
+ result[i++] = s.getName();
+ }
+ return result;
+ }
+
+ @Override
+ public void delete(int options, IProgressMonitor monitor) throws CoreException {
+ try {
+ new TCFOperationDelete(this).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ }
+ }
+
+ @Override
+ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
+ boolean shallow = (options & EFS.SHALLOW) == EFS.SHALLOW;
+ try {
+ new TCFOperationMkDir(this, shallow).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ }
+ return this;
+ }
+
+ @Override
+ public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
+ boolean setAttribs = (options & EFS.SET_ATTRIBUTES) != 0;
+ boolean setLastModified = (options & EFS.SET_LAST_MODIFIED) != 0;
+ try {
+ if (setAttribs || setLastModified) {
+ new TCFOperationPutInfo(this, info, setAttribs, setLastModified).execute(SubMonitor.convert(monitor));
+ }
+ } catch (OperationCanceledException e) {
+ }
+ }
+
+ @Override
+ public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
+ try {
+ return new TCFOperationOpenInputStream(this).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
+ boolean append = (options & EFS.APPEND) != 0;
+ try {
+ return new TCFOperationOpenOutputStream(this, append).execute(SubMonitor.convert(monitor));
+ } catch (OperationCanceledException e) {
+ return null;
+ }
+ }
+
+ public void setIsArtificialRoot() {
+ fArtificialRoot = true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcess.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcess.java
index 541c6fce1..2c2b63a37 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcess.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcess.java
@@ -1,183 +1,217 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.EventObject;
-
-import org.eclipse.remote.core.AbstractRemoteProcess;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
-import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
-import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessStateChangeEvent;
-
-public class TCFProcess extends AbstractRemoteProcess implements IEventListener {
- private InputStream fStdout;
- private InputStream fStderr;
- private OutputStream fStdin;
-
- private PipedOutputStream fCombinedOutput;
- private int fReadersDone;
-
- private final ProcessLauncher fLauncher;
- private int fExitValue;
- private boolean fCompleted;
-
- private class StreamForwarder implements Runnable {
- private final static int BUF_SIZE = 8192;
-
- private final InputStream fInput;
- private final OutputStream fOutput;
-
- public StreamForwarder(InputStream input, OutputStream output) {
- fInput = input;
- fOutput = output;
- }
-
- @Override
- public void run() {
- int len;
- byte b[] = new byte[BUF_SIZE];
- try {
- while ((len = fInput.read(b)) > 0) {
- fOutput.write(b, 0, len);
- }
- } catch (IOException e) {
- }
- onProcReaderDone();
- }
- }
-
- private static class NullInputStream extends InputStream {
- public NullInputStream() {
- }
-
- @Override
- public int read() throws IOException {
- return -1;
- }
-
- @Override
- public int available() {
- return 0;
- }
- }
-
- public TCFProcess(ProcessLauncher launcher) {
- fLauncher = launcher;
- EventManager.getInstance().addEventListener(this, ProcessStateChangeEvent.class);
- }
-
- public void connectStreams(TCFProcessStreams streams, boolean redirectStderr) throws IOException {
- if (redirectStderr) {
- fCombinedOutput = new PipedOutputStream();
- fStdout = new PipedInputStream(fCombinedOutput);
- fStderr = null;
-
- new Thread(new StreamForwarder(streams.getStdout(), fCombinedOutput)).start();
- new Thread(new StreamForwarder(streams.getStderr(), fCombinedOutput)).start();
- } else {
- fStdout = streams.getStdout();
- fStderr = streams.getStderr();
- }
- fStdin = streams.getStdin();
- }
-
- protected void onProcReaderDone() {
- synchronized (this) {
- if (++fReadersDone == 2) {
- try {
- fCombinedOutput.close();
- } catch (IOException e) {
- }
- }
- }
- }
-
- @Override
- public void destroy() {
- synchronized(this) {
- if (fCompleted)
- return;
- }
-
- fLauncher.cancel();
- fLauncher.terminate();
- synchronized (this) {
- if (!fCompleted) {
- fExitValue = -1;
- fCompleted = true;
- notifyAll();
- }
- }
- EventManager.getInstance().removeEventListener(this);
- }
-
- @Override
- public int exitValue() {
- return fExitValue;
- }
-
- @Override
- public InputStream getErrorStream() {
- return fStderr != null ? fStderr : new NullInputStream();
- }
-
- @Override
- public InputStream getInputStream() {
- return fStdout != null ? fStdout : new NullInputStream();
- }
-
- @Override
- public OutputStream getOutputStream() {
- return fStdin;
- }
-
- @Override
- public int waitFor() throws InterruptedException {
- synchronized (this) {
- while (!isCompleted()) {
- wait();
- }
- }
- return exitValue();
- }
-
- @Override
- public boolean isCompleted() {
- return fCompleted;
- }
-
- @Override
- public void eventFired(EventObject event) {
- if (event instanceof ProcessStateChangeEvent) {
- ProcessStateChangeEvent pscEvent = (ProcessStateChangeEvent) event;
- if (pscEvent.getEventId().equals(ProcessStateChangeEvent.EVENT_PROCESS_TERMINATED)) {
- Object source = pscEvent.getSource();
- if ((source instanceof ProcessContext)) {
- ProcessContext context = (ProcessContext) fLauncher.getAdapter(ProcessContext.class);
- if (context != null && ((ProcessContext) source).getID().equals(context.getID())) {
- synchronized (this) {
- fExitValue = pscEvent.getExitCode();
- fCompleted = true;
- notifyAll();
- }
- }
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.util.EventObject;
+
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteProcess;
+import org.eclipse.remote.core.IRemoteProcessBuilder;
+import org.eclipse.remote.core.IRemoteProcessControlService;
+import org.eclipse.tcf.services.IProcesses.ProcessContext;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
+import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessStateChangeEvent;
+
+public class TCFProcess implements IRemoteProcess, IRemoteProcessControlService, IEventListener {
+ private InputStream fStdout;
+ private InputStream fStderr;
+ private OutputStream fStdin;
+
+ private PipedOutputStream fCombinedOutput;
+ private int fReadersDone;
+
+ private final ProcessLauncher fLauncher;
+ private int fExitValue;
+ private boolean fCompleted;
+ private IRemoteProcessBuilder fBuilder;
+
+ private class StreamForwarder implements Runnable {
+ private final static int BUF_SIZE = 8192;
+
+ private final InputStream fInput;
+ private final OutputStream fOutput;
+
+ public StreamForwarder(InputStream input, OutputStream output) {
+ fInput = input;
+ fOutput = output;
+ }
+
+ @Override
+ public void run() {
+ int len;
+ byte b[] = new byte[BUF_SIZE];
+ try {
+ while ((len = fInput.read(b)) > 0) {
+ fOutput.write(b, 0, len);
+ }
+ } catch (IOException e) {
+ }
+ onProcReaderDone();
+ }
+ }
+
+ private static class NullInputStream extends InputStream {
+ public NullInputStream() {
+ }
+
+ @Override
+ public int read() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int available() {
+ return 0;
+ }
+ }
+
+ public TCFProcess(TCFProcessBuilder builder, ProcessLauncher launcher) {
+ fBuilder = builder;
+ fLauncher = launcher;
+ EventManager.getInstance().addEventListener(this, ProcessStateChangeEvent.class);
+ }
+
+ @Override
+ public IRemoteProcessBuilder getProcessBuilder() {
+ return fBuilder;
+ }
+
+ @Override
+ public IRemoteConnection getRemoteConnection() {
+ return fBuilder.getRemoteConnection();
+ }
+
+ @Override
+ public IRemoteProcess getRemoteProcess() {
+ return this;
+ }
+
+ @Override
+ public <T extends Service> T getService(Class<T> service) {
+ if (service.isAssignableFrom(TCFProcess.class))
+ return service.cast(this);
+ return null;
+ }
+
+ @Override
+ public <T extends Service> boolean hasService(Class<T> service) {
+ return service.isAssignableFrom(TCFProcess.class);
+ }
+
+ public void connectStreams(TCFProcessStreams streams, boolean redirectStderr) throws IOException {
+ if (redirectStderr) {
+ fCombinedOutput = new PipedOutputStream();
+ fStdout = new PipedInputStream(fCombinedOutput);
+ fStderr = null;
+
+ new Thread(new StreamForwarder(streams.getStdout(), fCombinedOutput)).start();
+ new Thread(new StreamForwarder(streams.getStderr(), fCombinedOutput)).start();
+ } else {
+ fStdout = streams.getStdout();
+ fStderr = streams.getStderr();
+ }
+ fStdin = streams.getStdin();
+ }
+
+ protected void onProcReaderDone() {
+ synchronized (this) {
+ if (++fReadersDone == 2) {
+ try {
+ fCombinedOutput.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ @Override
+ public void destroy() {
+ synchronized(this) {
+ if (fCompleted)
+ return;
+ }
+
+ fLauncher.cancel();
+ fLauncher.terminate();
+ synchronized (this) {
+ if (!fCompleted) {
+ fExitValue = -1;
+ fCompleted = true;
+ notifyAll();
+ }
+ }
+ EventManager.getInstance().removeEventListener(this);
+ }
+
+ @Override
+ public int exitValue() {
+ return fExitValue;
+ }
+
+ @Override
+ public InputStream getErrorStream() {
+ return fStderr != null ? fStderr : new NullInputStream();
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return fStdout != null ? fStdout : new NullInputStream();
+ }
+
+ @Override
+ public OutputStream getOutputStream() {
+ return fStdin;
+ }
+
+ @Override
+ public int waitFor() throws InterruptedException {
+ synchronized (this) {
+ while (!isCompleted()) {
+ wait();
+ }
+ }
+ return exitValue();
+ }
+
+ @Override
+ public boolean isCompleted() {
+ return fCompleted;
+ }
+
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ProcessStateChangeEvent) {
+ ProcessStateChangeEvent pscEvent = (ProcessStateChangeEvent) event;
+ if (pscEvent.getEventId().equals(ProcessStateChangeEvent.EVENT_PROCESS_TERMINATED)) {
+ Object source = pscEvent.getSource();
+ if ((source instanceof ProcessContext)) {
+ ProcessContext context = (ProcessContext) fLauncher.getAdapter(ProcessContext.class);
+ if (context != null && ((ProcessContext) source).getID().equals(context.getID())) {
+ synchronized (this) {
+ fExitValue = pscEvent.getExitCode();
+ fCompleted = true;
+ notifyAll();
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcessBuilder.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcessBuilder.java
index b8cf8399a..b5cc9afe2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcessBuilder.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFProcessBuilder.java
@@ -1,130 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import static java.text.MessageFormat.format;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.remote.core.AbstractRemoteProcessBuilder;
-import org.eclipse.remote.core.IRemoteFileManager;
-import org.eclipse.remote.core.IRemoteProcess;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.interfaces.launcher.IProcessLauncher;
-import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
-import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationStartProcess;
-
-public class TCFProcessBuilder extends AbstractRemoteProcessBuilder {
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import static java.text.MessageFormat.format;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.remote.core.AbstractRemoteProcessBuilder;
+import org.eclipse.remote.core.IRemoteProcess;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.launcher.IProcessLauncher;
+import org.eclipse.tcf.te.tcf.processes.core.launcher.ProcessLauncher;
+import org.eclipse.tcf.te.tcf.remote.core.operation.TCFOperationStartProcess;
+
+public class TCFProcessBuilder extends AbstractRemoteProcessBuilder {
private final TCFConnection fConnection;
- private Map<String, String> fEnv;
-
- public TCFProcessBuilder(TCFConnection connection, List<String> command) {
- super(command);
- fConnection = connection;
- }
-
- public TCFProcessBuilder(TCFConnection connection, String... command) {
- this(connection, Arrays.asList(command));
- }
-
- @Override
- public IFileStore directory() {
- IFileStore dir = super.directory();
- if (dir == null) {
- IRemoteFileManager fileMgr = fConnection.getFileManager();
- if (fileMgr != null) {
- dir = fileMgr.getResource(fConnection.getWorkingDirectory());
- directory(dir);
- }
- }
- return dir;
- }
-
- @Override
- public Map<String, String> environment() {
- if (fEnv == null) {
- fEnv = new HashMap<String, String>(fConnection.getEnv());
- }
- return fEnv;
- }
-
- @Override
- public int getSupportedFlags() {
- return 0;
- }
-
- @Override
- public IRemoteProcess start(int flags) throws IOException {
- if (!fConnection.isOpen()) {
- throw new IOException(format(Messages.TCFProcessBuilder_errorConnectionClosed, fConnection.getName()));
- }
- IFileStore dirStore = super.directory();
- String dir;
- if (dirStore instanceof TCFFileStore) {
- dir = ((TCFFileStore) dirStore).getPath().toString();
- } else {
- dir = ""; //$NON-NLS-1$
- }
-
- List<String> cmd = command();
- if (cmd.size() < 1)
- throw new IOException(Messages.TCFProcessBuilder_errorNoCommand);
-
- String process= cmd.get(0);
- String[] args= cmd.subList(1, cmd.size()).toArray(new String[cmd.size()-1]);
-
- IPropertiesContainer launcherProps = new PropertiesContainer();
- launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_CWD, dir);
- launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_PATH, process);
- launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_ARGS, args);
- launcherProps.setProperty(IChannelManager.FLAG_FORCE_NEW, Boolean.FALSE);
- launcherProps.setProperty(ProcessLauncher.PROCESS_LAUNCH_FAILED_MESSAGE, format("Failed to launch process {0}" , process)); //$NON-NLS-1$
-
- TCFProcessStreams streamsProxy = new TCFProcessStreams();
- ProcessLauncher launcher = new ProcessLauncher(streamsProxy) {
- @SuppressWarnings("synthetic-access")
- @Override
- protected void mergeEnvironment(Map<String,String> processEnv, Map<String,String> processEnvDiff) {
- if (fEnv != null) {
- processEnv.clear();
- processEnv.putAll(fEnv);
- }
- }
- };
-
- TCFProcess remoteProcess = new TCFProcess(launcher);
- boolean ok = false;
- try {
- new TCFOperationStartProcess(fConnection.getPeerNode().getPeer(),
- launcher, launcherProps).execute(SubMonitor.convert(null));
+ private Map<String, String> fEnv;
+
+ public TCFProcessBuilder(TCFConnection connection, List<String> command) {
+ super(connection.getRemoteConnection(), command);
+ fConnection = connection;
+ }
+
+ public TCFProcessBuilder(TCFConnection connection, String... command) {
+ this(connection, Arrays.asList(command));
+ }
+
+ @Override
+ public IFileStore directory() {
+ IFileStore dir = super.directory();
+ if (dir == null) {
+ dir = fConnection.getResource(fConnection.getWorkingDirectory());
+ directory(dir);
+ }
+ return dir;
+ }
+
+ @Override
+ public Map<String, String> environment() {
+ if (fEnv == null) {
+ fEnv = new HashMap<String, String>(fConnection.getEnv());
+ }
+ return fEnv;
+ }
+
+ @Override
+ public int getSupportedFlags() {
+ return 0;
+ }
+
+ @Override
+ public IRemoteProcess start(int flags) throws IOException {
+ if (!fConnection.isOpen()) {
+ throw new IOException(format(Messages.TCFProcessBuilder_errorConnectionClosed, fConnection.getName()));
+ }
+ IFileStore dirStore = super.directory();
+ String dir;
+ if (dirStore instanceof TCFFileStore) {
+ dir = ((TCFFileStore) dirStore).getPath();
+ } else {
+ dir = ""; //$NON-NLS-1$
+ }
+
+ List<String> cmd = command();
+ if (cmd.size() < 1)
+ throw new IOException(Messages.TCFProcessBuilder_errorNoCommand);
+
+ String process= cmd.get(0);
+ String[] args= cmd.subList(1, cmd.size()).toArray(new String[cmd.size()-1]);
+
+ IPropertiesContainer launcherProps = new PropertiesContainer();
+ launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_CWD, dir);
+ launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_PATH, process);
+ launcherProps.setProperty(IProcessLauncher.PROP_PROCESS_ARGS, args);
+ launcherProps.setProperty(IChannelManager.FLAG_FORCE_NEW, Boolean.FALSE);
+ launcherProps.setProperty(ProcessLauncher.PROCESS_LAUNCH_FAILED_MESSAGE, format("Failed to launch process {0}" , process)); //$NON-NLS-1$
+
+ TCFProcessStreams streamsProxy = new TCFProcessStreams();
+ ProcessLauncher launcher = new ProcessLauncher(streamsProxy) {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ protected void mergeEnvironment(Map<String,String> processEnv, Map<String,String> processEnvDiff) {
+ if (fEnv != null) {
+ processEnv.clear();
+ processEnv.putAll(fEnv);
+ }
+ }
+ };
+
+ TCFProcess remoteProcess = new TCFProcess(this, launcher);
+ boolean ok = false;
+ try {
+ new TCFOperationStartProcess(fConnection.getPeerNode().getPeer(),
+ launcher, launcherProps).execute(SubMonitor.convert(null));
remoteProcess.connectStreams(streamsProxy, redirectErrorStream());
- ok = true;
+ ok = true;
return remoteProcess;
- } catch (OperationCanceledException e) {
- return null;
- } catch (CoreException e) {
- throw new IOException(Messages.TCFProcessBuilder_errorLaunchingProcess, e);
- } finally {
- if (!ok)
- remoteProcess.destroy();
- }
- }
+ } catch (OperationCanceledException e) {
+ return null;
+ } catch (CoreException e) {
+ throw new IOException(Messages.TCFProcessBuilder_errorLaunchingProcess, e);
+ } finally {
+ if (!ok)
+ remoteProcess.destroy();
+ }
+ }
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteConnectionType.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteConnectionType.java
new file mode 100644
index 000000000..871a38a0a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteConnectionType.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import org.eclipse.remote.core.IRemoteConnectionProviderService;
+import org.eclipse.remote.core.IRemoteConnectionType;
+
+public class TCFRemoteConnectionType implements IRemoteConnectionProviderService {
+ private final IRemoteConnectionType fConnectionType;
+
+ public TCFRemoteConnectionType(IRemoteConnectionType type) {
+ fConnectionType = type;
+ }
+
+ @Override
+ public IRemoteConnectionType getConnectionType() {
+ return fConnectionType;
+ }
+
+ @Override
+ public void init() {
+ TCFConnectionManager.INSTANCE.setConnectionType(fConnectionType);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteServices.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteServices.java
deleted file mode 100644
index c391b142e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFRemoteServices.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.remote.core.AbstractRemoteServices;
-import org.eclipse.remote.core.IRemoteServicesDescriptor;
-
-public class TCFRemoteServices extends AbstractRemoteServices {
- public static final String TCF_ID = "org.eclipse.tcf.te.tcf.remote.core.TCFService"; //$NON-NLS-1$
-
- private final TCFConnectionManager fConnectionManager = new TCFConnectionManager(this);
-
- public TCFRemoteServices(IRemoteServicesDescriptor descriptor) {
- super(descriptor);
- }
-
- @Override
- public TCFConnectionManager getConnectionManager() {
- return fConnectionManager;
- }
-
- @Override
- public boolean initialize(IProgressMonitor monitor) {
- fConnectionManager.initialize();
- return true;
- }
-
- @Override
- public int getCapabilities() {
- return 0;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFServicesFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFServicesFactory.java
index 11910f5e3..ff1380b73 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFServicesFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/TCFServicesFactory.java
@@ -1,22 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core;
-
-import org.eclipse.remote.core.IRemoteServices;
-import org.eclipse.remote.core.IRemoteServicesDescriptor;
-import org.eclipse.remote.core.IRemoteServicesFactory;
-
-public class TCFServicesFactory implements IRemoteServicesFactory {
- @Override
- public IRemoteServices getServices(IRemoteServicesDescriptor descriptor) {
- return new TCFRemoteServices(descriptor);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core;
+
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteProcess;
+
+public class TCFServicesFactory implements IRemoteConnectionType.Service.Factory,
+ IRemoteConnection.Service.Factory, IRemoteProcess.Service.Factory {
+
+ @Override
+ public <T extends IRemoteConnectionType.Service> T getService(IRemoteConnectionType connectionType, Class<T> service) {
+ if (service.isAssignableFrom(TCFRemoteConnectionType.class)) {
+ return service.cast(new TCFRemoteConnectionType(connectionType));
+ }
+ return null;
+ }
+
+ @Override
+ public <T extends IRemoteConnection.Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
+ if (service.isAssignableFrom(TCFConnection.class)) {
+ return service.cast(TCFConnectionManager.INSTANCE.mapConnection(remoteConnection));
+ }
+ return null;
+ }
+
+ @Override
+ public <T extends IRemoteProcess.Service> T getService(IRemoteProcess remoteProcess, Class<T> service) {
+ return remoteProcess.getService(service);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/activator/CoreBundleActivator.java
index a0eaf3066..7629f65a8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/activator/CoreBundleActivator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/activator/CoreBundleActivator.java
@@ -1,76 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core.activator;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CoreBundleActivator implements BundleActivator {
-
- // The bundle context
- private static BundleContext context;
- // The shared instance
- private static CoreBundleActivator plugin;
-
- /**
- * Returns the bundle context
- *
- * @return the bundle context
- */
- public static BundleContext getContext() {
- return context;
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static CoreBundleActivator getDefault() {
- return plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getContext() != null && getContext().getBundle() != null) {
- return getContext().getBundle().getSymbolicName();
- }
- return "org.eclipes.tcf.te.tcf.remote.core"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- context = bundleContext;
- plugin = this;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- context = null;
- plugin = null;
- }
-
-// public static void logError(String msg, Throwable th) {
-// Platform.getLog(Platform.getBundle(ID)).log(new Status(IStatus.ERROR, ID, msg, th));
-// }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core.activator;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CoreBundleActivator implements BundleActivator {
+
+ private static final String PLUGIN_ID = "org.eclipes.tcf.te.tcf.remote.core"; //$NON-NLS-1$
+ // The bundle context
+ private static BundleContext context;
+ // The shared instance
+ private static CoreBundleActivator plugin;
+
+ /**
+ * Returns the bundle context
+ *
+ * @return the bundle context
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CoreBundleActivator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ context = bundleContext;
+ plugin = this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ context = null;
+ plugin = null;
+ }
+
+ public static <T> T getService(Class<T> service) {
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
+
+ public static void logError(String msg, Throwable th) {
+ Platform.getLog(Platform.getBundle(PLUGIN_ID)).log(new Status(IStatus.ERROR, PLUGIN_ID, msg, th));
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFFileStoreOperation.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFFileStoreOperation.java
index f61f3b3a3..b8c5bcad4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFFileStoreOperation.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFFileStoreOperation.java
@@ -1,85 +1,85 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tcf.te.tcf.remote.core.operation;
-
-import static java.text.MessageFormat.format;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.tcf.services.IFileSystem;
-import org.eclipse.tcf.services.IFileSystem.DoneStat;
-import org.eclipse.tcf.services.IFileSystem.FileAttrs;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
-import org.eclipse.tcf.te.tcf.remote.core.nls.Messages;
-import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetFileSystem;
-import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetUser;
-
-public abstract class TCFFileStoreOperation<T> extends TCFOperation<T> {
- private static final Map<String, PeerInfo> fPeerInfos = new HashMap<String, PeerInfo>();
-
- private final TCFFileStore fFileStore;
-
- protected TCFFileStoreOperation(TCFFileStore fileStore) {
- fFileStore = fileStore;
- }
-
- protected final TCFFileStore getFileStore() {
- return fFileStore;
- }
-
- protected final String getPath() {
- return fFileStore.getPath().toString();
- }
-
- protected final IPeerNode getPeerNode() {
- return fFileStore.getConnection().getPeerNode();
- }
-
- private final PeerInfo getPeerInfo(IPeerNode peerNode) {
- String key = peerNode.getName();
- PeerInfo result = fPeerInfos.get(key);
- if (result == null) {
- result = new PeerInfo();
- fPeerInfos.put(key, result);
- }
- return result;
- }
-
- protected final void getFileSystem(DoneGetFileSystem callback) {
- IPeerNode peerNode = getPeerNode();
- if (peerNode == null) {
- setError(createStatus(format(Messages.TCFFileStoreOperation_errorNotConnected, fFileStore.getConnection().getName()), null));
- } else {
- getPeerInfo(peerNode).getFileSystem(peerNode, callback);
- }
- }
-
- protected final void getUser(IFileSystem fileSystem, DoneGetUser callback) {
- IPeerNode peerNode = getPeerNode();
- if (peerNode == null) {
- setError(createStatus(format(Messages.TCFFileStoreOperation_errorNotConnected, fFileStore.getConnection().getName()), null));
- } else {
- getPeerInfo(peerNode).getUser(fileSystem, callback);
- }
- }
-
- protected final void stat(IFileSystem fileSystem, TCFFileStore fileStore, DoneStat doneStat) {
- FileAttrs attrs = fileStore.getAttributes();
- if (attrs != null) {
- doneStat.doneStat(null, null, attrs);
- } else {
- fileSystem.stat(fileStore.getPath().toString(), doneStat);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.tcf.remote.core.operation;
+
+import static java.text.MessageFormat.format;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneStat;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
+import org.eclipse.tcf.te.tcf.remote.core.nls.Messages;
+import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetFileSystem;
+import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetUser;
+
+public abstract class TCFFileStoreOperation<T> extends TCFOperation<T> {
+ private static final Map<String, PeerInfo> fPeerInfos = new HashMap<String, PeerInfo>();
+
+ private final TCFFileStore fFileStore;
+
+ protected TCFFileStoreOperation(TCFFileStore fileStore) {
+ fFileStore = fileStore;
+ }
+
+ protected final TCFFileStore getFileStore() {
+ return fFileStore;
+ }
+
+ protected final String getPath() {
+ return fFileStore.getPath();
+ }
+
+ protected final IPeerNode getPeerNode() {
+ return fFileStore.getConnection().getPeerNode();
+ }
+
+ private final PeerInfo getPeerInfo(IPeerNode peerNode) {
+ String key = peerNode.getName();
+ PeerInfo result = fPeerInfos.get(key);
+ if (result == null) {
+ result = new PeerInfo();
+ fPeerInfos.put(key, result);
+ }
+ return result;
+ }
+
+ protected final void getFileSystem(DoneGetFileSystem callback) {
+ IPeerNode peerNode = getPeerNode();
+ if (peerNode == null) {
+ setError(createStatus(format(Messages.TCFFileStoreOperation_errorNotConnected, fFileStore.getConnection().getName()), null));
+ } else {
+ getPeerInfo(peerNode).getFileSystem(peerNode, callback);
+ }
+ }
+
+ protected final void getUser(IFileSystem fileSystem, DoneGetUser callback) {
+ IPeerNode peerNode = getPeerNode();
+ if (peerNode == null) {
+ setError(createStatus(format(Messages.TCFFileStoreOperation_errorNotConnected, fFileStore.getConnection().getName()), null));
+ } else {
+ getPeerInfo(peerNode).getUser(fileSystem, callback);
+ }
+ }
+
+ protected final void stat(IFileSystem fileSystem, TCFFileStore fileStore, DoneStat doneStat) {
+ FileAttrs attrs = fileStore.getAttributes();
+ if (attrs != null) {
+ doneStat.doneStat(null, null, attrs);
+ } else {
+ fileSystem.stat(fileStore.getPath(), doneStat);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationChildStores.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationChildStores.java
index bc26a8fe1..1ec700ee8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationChildStores.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationChildStores.java
@@ -71,6 +71,7 @@ public class TCFOperationChildStores extends TCFFileStoreOperation<IFileStore[]>
@Override
public void doneOpen(IToken token, FileSystemException error, IFileHandle handle) {
if (error != null && (path.length() == 0 || path.equals("/"))) { //$NON-NLS-1$
+ getFileStore().setIsArtificialRoot();
readRoots();
} else if (!shallAbort(error)) {
setFileHandle(handle);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
index 293b4c339..a110bcfb1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.core.operation;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IFileSystem;
-import org.eclipse.tcf.services.IFileSystem.DoneMkDir;
-import org.eclipse.tcf.services.IFileSystem.DoneStat;
-import org.eclipse.tcf.services.IFileSystem.FileAttrs;
-import org.eclipse.tcf.services.IFileSystem.FileSystemException;
-import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
-import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetFileSystem;
-
-public final class TCFOperationMkDir extends TCFFileStoreOperation<Object> {
-
- protected final boolean fShallow;
-
- public TCFOperationMkDir(TCFFileStore filestore, boolean shallow) {
- super(filestore);
- fShallow = shallow;
- }
-
- @Override
- protected void doExecute() {
- getFileSystem(new DoneGetFileSystem() {
- @Override
- public void done(final IFileSystem fileSystem, IStatus status) {
- if (shallAbort(status))
- return;
-
- DoneMkDir callback = new DoneMkDir() {
- @Override
- public void doneMkDir(IToken token, FileSystemException error) {
- if (shallAbort(error))
- return;
- setResult(null);
- }
- };
- mkdir(fileSystem, getFileStore(), callback);
- }
- });
- }
-
- protected void mkdir(final IFileSystem fs, final TCFFileStore fileStore, final DoneMkDir callback) {
- stat(fs, fileStore, new DoneStat() {
- @Override
- public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
- if (error == null) {
- fileStore.setAttributes(attrs);
- }
- if (error == null && attrs.isDirectory()) {
- // Directory exists, ok.
- callback.doneMkDir(token, null);
- } else if (error != null && error.getStatus() != IFileSystem.STATUS_NO_SUCH_FILE) {
- // Error and file exists
- callback.doneMkDir(token, error);
- } else {
- // Directory does not exist
- final IFileStore parent = fShallow ? null : fileStore.getParent();
- if (parent instanceof TCFFileStore) {
- mkdir(fs, (TCFFileStore) parent, new DoneMkDir() {
- @Override
- public void doneMkDir(IToken token, FileSystemException error) {
- if (error != null) {
- callback.doneMkDir(token, error);
- } else {
- fs.mkdir(fileStore.getPath().toString(), null, callback);
- }
- }
- });
- } else {
- fs.mkdir(fileStore.getPath().toString(), null, callback);
- }
- }
- }
- });
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.core.operation;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneMkDir;
+import org.eclipse.tcf.services.IFileSystem.DoneStat;
+import org.eclipse.tcf.services.IFileSystem.FileAttrs;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
+import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetFileSystem;
+
+public final class TCFOperationMkDir extends TCFFileStoreOperation<Object> {
+
+ protected final boolean fShallow;
+
+ public TCFOperationMkDir(TCFFileStore filestore, boolean shallow) {
+ super(filestore);
+ fShallow = shallow;
+ }
+
+ @Override
+ protected void doExecute() {
+ getFileSystem(new DoneGetFileSystem() {
+ @Override
+ public void done(final IFileSystem fileSystem, IStatus status) {
+ if (shallAbort(status))
+ return;
+
+ DoneMkDir callback = new DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException error) {
+ if (shallAbort(error))
+ return;
+ setResult(null);
+ }
+ };
+ mkdir(fileSystem, getFileStore(), callback);
+ }
+ });
+ }
+
+ protected void mkdir(final IFileSystem fs, final TCFFileStore fileStore, final DoneMkDir callback) {
+ stat(fs, fileStore, new DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) {
+ if (error == null) {
+ fileStore.setAttributes(attrs);
+ }
+ if (error == null && attrs.isDirectory()) {
+ // Directory exists, ok.
+ callback.doneMkDir(token, null);
+ } else if (error != null && error.getStatus() != IFileSystem.STATUS_NO_SUCH_FILE) {
+ // Error and file exists
+ callback.doneMkDir(token, error);
+ } else {
+ // Directory does not exist
+ final IFileStore parent = fShallow ? null : fileStore.getParent();
+ if (parent instanceof TCFFileStore) {
+ mkdir(fs, (TCFFileStore) parent, new DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException error) {
+ if (error != null) {
+ callback.doneMkDir(token, error);
+ } else {
+ fs.mkdir(fileStore.getPath(), null, callback);
+ }
+ }
+ });
+ } else {
+ fs.mkdir(fileStore.getPath(), null, callback);
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/META-INF/MANIFEST.MF
index eaf245022..94e96509a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/META-INF/MANIFEST.MF
@@ -1,21 +1,21 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tcf.te.tcf.remote.ui;singleton:=true
-Bundle-Version: 1.4.0.qualifier
-Bundle-Activator: org.eclipse.tcf.te.tcf.remote.ui.activator.UIPlugin
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.remote.ui;bundle-version="1.1.0",
- org.eclipse.remote.core;bundle-version="1.0.0",
- org.eclipse.tcf.te.tcf.remote.core;bundle-version="1.4.0",
- org.eclipse.core.filesystem;bundle-version="1.3.200",
- org.eclipse.ui;bundle-version="3.8.0",
- org.eclipse.ui.ide;bundle-version="3.8.1",
- org.eclipse.tcf.te.tcf.locator;bundle-version="1.4.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Export-Package: org.eclipse.tcf.te.tcf.remote.ui,
- org.eclipse.tcf.te.tcf.remote.ui.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.remote.ui.nls;x-internal:=true
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.tcf.remote.ui;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.tcf.remote.ui.activator.UIPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.remote.ui;bundle-version="2.0.0",
+ org.eclipse.remote.core;bundle-version="2.0.0",
+ org.eclipse.tcf.te.tcf.remote.core;bundle-version="1.4.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.200",
+ org.eclipse.ui;bundle-version="3.8.0",
+ org.eclipse.ui.ide;bundle-version="3.8.1",
+ org.eclipse.tcf.te.tcf.locator;bundle-version="1.4.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.tcf.remote.ui,
+ org.eclipse.tcf.te.tcf.remote.ui.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.remote.ui.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/plugin.xml
index f2c9ed343..901d88cae 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/plugin.xml
@@ -1,21 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.remote.ui.remoteUIServices">
- <remoteUIServices
- class="org.eclipse.tcf.te.tcf.remote.ui.TCFUIServicesFactory"
- id="org.eclipse.tcf.te.tcf.remote.core.TCFService"
- name="TCF">
- </remoteUIServices>
- </extension>
- <extension
- point="org.eclipse.ui.ide.filesystemSupport">
- <filesystemContributor
- class="org.eclipse.tcf.te.tcf.remote.ui.TCFFileSystemContributor"
- label="TCF"
- scheme="tcf">
- </filesystemContributor>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.ide.filesystemSupport">
+ <filesystemContributor
+ class="org.eclipse.tcf.te.tcf.remote.ui.TCFFileSystemContributor"
+ label="TCF"
+ scheme="tcf">
+ </filesystemContributor>
+ </extension>
+ <extension
+ point="org.eclipse.remote.core.remoteServices">
+ <connectionTypeService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.ui.TCFUIServicesFactory"
+ service="org.eclipse.remote.ui.IRemoteUIFileService">
+ </connectionTypeService>
+ <connectionTypeService
+ connectionTypeId="org.eclipse.tcf.te.tcf.remote"
+ factory="org.eclipse.tcf.te.tcf.remote.ui.TCFUIServicesFactory"
+ service="org.eclipse.remote.ui.IRemoteUIConnectionService">
+ </connectionTypeService>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFFileSystemContributor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFFileSystemContributor.java
index 6d66e4ba4..e18a4c79b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFFileSystemContributor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFFileSystemContributor.java
@@ -1,88 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.ui;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.core.IRemotePreferenceConstants;
-import org.eclipse.remote.core.IRemoteServices;
-import org.eclipse.remote.core.RemoteServices;
-import org.eclipse.remote.ui.IRemoteUIFileManager;
-import org.eclipse.remote.ui.IRemoteUIServices;
-import org.eclipse.remote.ui.RemoteUIServices;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.tcf.remote.core.TCFConnection;
-import org.eclipse.tcf.te.tcf.remote.core.TCFEclipseFileSystem;
-import org.eclipse.tcf.te.tcf.remote.core.TCFRemoteServices;
-import org.eclipse.tcf.te.tcf.remote.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.remote.ui.nls.Messages;
-import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
-
-public class TCFFileSystemContributor extends FileSystemContributor {
- private static final String REMOTE_CORE_PLUGIN_ID = "org.eclipse.remote.core"; //$NON-NLS-1$
-
- @Override
- public URI browseFileSystem(String initialPath, Shell shell) {
- IRemoteServices services = RemoteServices.getRemoteServices(TCFRemoteServices.TCF_ID);
- IRemoteUIServices uiServices = RemoteUIServices.getRemoteUIServices(services);
- IRemoteUIFileManager uiFileMgr = uiServices.getUIFileManager();
- uiFileMgr.showConnections(true);
- String original = setPreferredService(TCFRemoteServices.TCF_ID);
- try {
- String path = uiFileMgr.browseDirectory(shell, Messages.TCFFileSystemContributor_browseFileSystem_title, initialPath, 0);
- if (path != null) {
- IRemoteConnection conn = uiFileMgr.getConnection();
- if (conn instanceof TCFConnection) {
- TCFConnection tcfConn = (TCFConnection) conn;
- try {
- return TCFEclipseFileSystem.getURIFor(tcfConn, path);
- } catch (URISyntaxException e) {
- Platform.getLog(UIPlugin.getDefault().getBundle()).log(
- new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), NLS.bind(Messages.TCFFileSystemContributor_errorCreateURIForPath, conn.getName(), path), e));
- }
- }
- }
- } finally {
- setPreferredService(original);
- }
- return null;
- }
-
- private String setPreferredService(String id) {
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode(REMOTE_CORE_PLUGIN_ID);
- String key = IRemotePreferenceConstants.PREF_REMOTE_SERVICES_ID;
- String old = node.get(key, null);
- if (id == null) {
- node.remove(key);
- } else {
- node.put(key, id);
- }
- return old;
- }
-
- @Override
- public URI getURI(String string) {
- try {
- return new URI(string);
- } catch (URISyntaxException e) {
- // Ignore
- }
- return null;
- }
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.ui;
+
+import java.net.URI;
+
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemotePreferenceConstants;
+import org.eclipse.remote.core.IRemoteServicesManager;
+import org.eclipse.remote.internal.core.RemotePath;
+import org.eclipse.remote.ui.IRemoteUIFileService;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.remote.core.TCFConnection;
+import org.eclipse.tcf.te.tcf.remote.core.TCFConnectionManager;
+import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
+import org.eclipse.tcf.te.tcf.remote.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.remote.ui.nls.Messages;
+import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
+
+public class TCFFileSystemContributor extends FileSystemContributor {
+ private static final String REMOTE_CORE_PLUGIN_ID = "org.eclipse.remote.core"; //$NON-NLS-1$
+
+ @Override
+ public URI browseFileSystem(String initialPath, Shell shell) {
+ IRemoteServicesManager manager = UIPlugin.getService(IRemoteServicesManager.class);
+ if (manager == null)
+ return null;
+ IRemoteConnectionType connectionType = manager.getConnectionType(TCFConnection.CONNECTION_TYPE_ID);
+ if (connectionType == null)
+ return null;
+
+ IRemoteUIFileService uiFileMgr = connectionType.getService(IRemoteUIFileService.class);
+
+ uiFileMgr.showConnections(true);
+ String original = setPreferredService(TCFConnection.CONNECTION_TYPE_ID);
+ try {
+ String path = uiFileMgr.browseDirectory(shell, Messages.TCFFileSystemContributor_browseFileSystem_title, initialPath, 0);
+ if (path != null) {
+ path = workaroundBug472329(path);
+ TCFConnection conn = TCFConnectionManager.INSTANCE.mapConnection(uiFileMgr.getConnection());
+ if (conn != null) {
+ return TCFFileStore.toURI(conn, path);
+ }
+ }
+ } finally {
+ setPreferredService(original);
+ }
+ return null;
+ }
+
+ private String workaroundBug472329(String path) {
+ return TCFFileStore.stripNoSlashMarker(path);
+ }
+
+ private String setPreferredService(String id) {
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(REMOTE_CORE_PLUGIN_ID);
+ String key = IRemotePreferenceConstants.PREF_CONNECTION_TYPE_ID;
+ String old = node.get(key, null);
+ if (id == null) {
+ node.remove(key);
+ } else {
+ node.put(key, id);
+ }
+ return old;
+ }
+
+ @Override
+ public URI getURI(String string) {
+ return URIUtil.toURI(RemotePath.forPosix(string).toString());
+ }
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIConnectionService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIConnectionService.java
new file mode 100644
index 000000000..080b68eff
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIConnectionService.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.ui;
+
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.ui.AbstractRemoteUIConnectionService;
+import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class TCFUIConnectionService extends AbstractRemoteUIConnectionService {
+
+ private IRemoteConnectionType fConnectionType;
+
+ public TCFUIConnectionService(IRemoteConnectionType connectionType) {
+ fConnectionType = connectionType;
+ }
+
+ @Override
+ public IRemoteUIConnectionWizard getConnectionWizard(Shell shell) {
+ return null;
+ }
+
+ @Override
+ public IRemoteConnectionType getConnectionType() {
+ return fConnectionType;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileService.java
index 0f4862e0d..55a9f2d3e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIFileService.java
@@ -1,100 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation 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:
- * IBM Corporation - Initial API and implementation
- * Markus Schorn - Adapted for TCF remote service
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.jface.window.Window;
-import org.eclipse.remote.core.IRemoteConnection;
-import org.eclipse.remote.ui.IRemoteUIFileManager;
-import org.eclipse.remote.ui.dialogs.RemoteResourceBrowser;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-public class TCFUIFileManager implements IRemoteUIFileManager {
- private IRemoteConnection fConnection = null;
- private boolean fShowConnections = false;
-
- @Override
- public String browseDirectory(Shell shell, String message, String filterPath, int flags) {
- RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.SINGLE);
- browser.setType(RemoteResourceBrowser.DIRECTORY_BROWSER);
- browser.setInitialPath(filterPath);
- browser.setTitle(message);
- browser.showConnections(fShowConnections);
- browser.setConnection(fConnection);
- if (browser.open() == Window.CANCEL) {
- return null;
- }
- fConnection = browser.getConnection();
- IFileStore resource = browser.getResource();
- if (resource == null) {
- return null;
- }
- return resource.toURI().getPath();
- }
-
- @Override
- public String browseFile(Shell shell, String message, String filterPath, int flags) {
- RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.SINGLE);
- browser.setType(RemoteResourceBrowser.FILE_BROWSER);
- browser.setInitialPath(filterPath);
- browser.setTitle(message);
- browser.showConnections(fShowConnections);
- browser.setConnection(fConnection);
- if (browser.open() == Window.CANCEL) {
- return null;
- }
- fConnection = browser.getConnection();
- IFileStore resource = browser.getResource();
- if (resource == null) {
- return null;
- }
- return resource.toURI().getPath();
- }
-
- @Override
- public List<String> browseFiles(Shell shell, String message, String filterPath, int flags) {
- RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.MULTI);
- browser.setType(RemoteResourceBrowser.FILE_BROWSER);
- browser.setInitialPath(filterPath);
- browser.setTitle(message);
- browser.showConnections(fShowConnections);
- browser.setConnection(fConnection);
- if (browser.open() == Window.CANCEL) {
- return null;
- }
- fConnection = browser.getConnection();
- List<String> paths = new ArrayList<String>();
- for (IFileStore store : browser.getResources()) {
- paths.add(store.toURI().getPath());
- }
- return paths;
- }
-
- @Override
- public IRemoteConnection getConnection() {
- return fConnection;
- }
-
- @Override
- public void setConnection(IRemoteConnection connection) {
- this.fConnection = connection;
- }
-
- @Override
- public void showConnections(boolean enable) {
- fShowConnections = enable;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2007, 2015 IBM Corporation 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:
+ * IBM Corporation - Initial API and implementation
+ * Markus Schorn - Adapted for TCF remote service
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.jface.window.Window;
+import org.eclipse.remote.core.IRemoteConnection;
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.ui.IRemoteUIFileService;
+import org.eclipse.remote.ui.dialogs.RemoteResourceBrowser;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
+
+public class TCFUIFileService implements IRemoteUIFileService {
+ private IRemoteConnection fConnection = null;
+ private boolean fShowConnections = false;
+ private final IRemoteConnectionType fConnectionType;
+
+ public TCFUIFileService(IRemoteConnectionType connectionType) {
+ fConnectionType = connectionType;
+ }
+
+ @Override
+ public IRemoteConnectionType getConnectionType() {
+ return fConnectionType;
+ }
+
+ @Override
+ public String browseDirectory(Shell shell, String message, String filterPath, int flags) {
+ RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.SINGLE);
+ browser.setType(RemoteResourceBrowser.DIRECTORY_BROWSER);
+ browser.setInitialPath(filterPath);
+ browser.setTitle(message);
+ browser.showConnections(fShowConnections);
+ browser.setConnection(fConnection);
+ if (browser.open() == Window.CANCEL) {
+ return null;
+ }
+ fConnection = browser.getConnection();
+ IFileStore resource = browser.getResource();
+ if (resource == null) {
+ return null;
+ }
+ return TCFFileStore.toPath(resource.toURI());
+ }
+
+ @Override
+ public String browseFile(Shell shell, String message, String filterPath, int flags) {
+ RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.SINGLE);
+ browser.setType(RemoteResourceBrowser.FILE_BROWSER);
+ browser.setInitialPath(filterPath);
+ browser.setTitle(message);
+ browser.showConnections(fShowConnections);
+ browser.setConnection(fConnection);
+ if (browser.open() == Window.CANCEL) {
+ return null;
+ }
+ fConnection = browser.getConnection();
+ IFileStore resource = browser.getResource();
+ if (resource == null) {
+ return null;
+ }
+ return TCFFileStore.toPath(resource.toURI());
+ }
+
+ @Override
+ public List<String> browseFiles(Shell shell, String message, String filterPath, int flags) {
+ RemoteResourceBrowser browser = new RemoteResourceBrowser(shell, SWT.MULTI);
+ browser.setType(RemoteResourceBrowser.FILE_BROWSER);
+ browser.setInitialPath(filterPath);
+ browser.setTitle(message);
+ browser.showConnections(fShowConnections);
+ browser.setConnection(fConnection);
+ if (browser.open() == Window.CANCEL) {
+ return null;
+ }
+ fConnection = browser.getConnection();
+ List<String> paths = new ArrayList<String>();
+ for (IFileStore store : browser.getResources()) {
+ paths.add(TCFFileStore.toPath(store.toURI()));
+ }
+ return paths;
+ }
+
+ @Override
+ public IRemoteConnection getConnection() {
+ return fConnection;
+ }
+
+ @Override
+ public void setConnection(IRemoteConnection connection) {
+ this.fConnection = connection;
+ }
+
+ @Override
+ public void showConnections(boolean enable) {
+ fShowConnections = enable;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServices.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServices.java
deleted file mode 100644
index bd74a8e3b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServices.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 IBM Corporation 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:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.ui;
-
-import org.eclipse.remote.core.IRemoteServices;
-import org.eclipse.remote.ui.IRemoteUIConnectionManager;
-import org.eclipse.remote.ui.IRemoteUIFileManager;
-import org.eclipse.remote.ui.IRemoteUIServices;
-import org.eclipse.tcf.te.tcf.remote.core.TCFRemoteServices;
-
-
-public class TCFUIServices implements IRemoteUIServices {
-
- private TCFRemoteServices fServices;
-
- public TCFUIServices(IRemoteServices services) {
- fServices = (TCFRemoteServices) services;
- }
-
- @Override
- public String getId() {
- return fServices.getId();
- }
-
- @Override
- public String getName() {
- return fServices.getName();
- }
-
- @Override
- public IRemoteUIConnectionManager getUIConnectionManager() {
- return null;
- }
-
- @Override
- public IRemoteUIFileManager getUIFileManager() {
- return new TCFUIFileManager();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServicesFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServicesFactory.java
index e325a4be3..90c3a8eee 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServicesFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/TCFUIServicesFactory.java
@@ -1,22 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.ui;
-
-import org.eclipse.remote.core.IRemoteServices;
-import org.eclipse.remote.ui.IRemoteUIServices;
-import org.eclipse.remote.ui.IRemoteUIServicesFactory;
-
-public class TCFUIServicesFactory implements IRemoteUIServicesFactory {
- @Override
- public IRemoteUIServices getServices(IRemoteServices services) {
- return new TCFUIServices(services);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.ui;
+
+import org.eclipse.remote.core.IRemoteConnectionType;
+import org.eclipse.remote.core.IRemoteConnectionType.Service;
+
+public class TCFUIServicesFactory implements IRemoteConnectionType.Service.Factory {
+
+ @Override
+ public <T extends Service> T getService(IRemoteConnectionType connectionType, Class<T> service) {
+ if (service.isAssignableFrom(TCFUIFileService.class))
+ return service.cast(new TCFUIFileService(connectionType));
+ if (service.isAssignableFrom(TCFUIConnectionService.class))
+ return service.cast(new TCFUIConnectionService(connectionType));
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/activator/UIPlugin.java
index c4e7c2cc2..194819ddd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.ui/src/org/eclipse/tcf/te/tcf/remote/ui/activator/UIPlugin.java
@@ -1,66 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Wind River Systems, Inc.
- * 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:
- * Markus Schorn - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tcf.remote.ui.activator;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class UIPlugin extends AbstractUIPlugin {
- // The shared instance
- private static UIPlugin plugin;
-
- /**
- * The constructor
- */
- public UIPlugin() {
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static UIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.tcf.remote.ui"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc.
+ * 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:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.remote.ui.activator;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIPlugin extends AbstractUIPlugin {
+ private static final String PLUGIN_ID = "org.eclipse.tcf.te.tcf.remote.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static UIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UIPlugin() {
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static <T> T getService(Class<T> service) {
+ if (plugin == null)
+ return null;
+ BundleContext context = plugin.getBundle().getBundleContext();
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
+}

Back to the top