1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 460059 - Add handling of file scheme for Local connection.

LocalFileManager is renamed to LocalFileService to fit in with the
standard naming.

Change-Id: I2ac49c64346709bdde0f3b38034cefaea3df913f
Signed-off-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
Doug Schaefer 2015-02-16 18:29:48 -05:00
parent e97eb96c5d
commit cf2f51f8ff
3 changed files with 36 additions and 3 deletions

View file

@ -23,6 +23,16 @@
factory="org.eclipse.remote.internal.core.services.local.LocalConnectionPropertyService$Factory"
service="org.eclipse.remote.core.IRemoteConnectionPropertyService">
</connectionService>
<connectionService
connectionTypeId="org.eclipse.remote.LocalServices"
factory="org.eclipse.remote.internal.core.services.local.LocalFileService$Factory"
service="org.eclipse.remote.core.IRemoteFileService">
</connectionService>
<connectionService
connectionTypeId="org.eclipse.remote.LocalServices"
factory="org.eclipse.remote.internal.core.services.local.LocalProcessService$Factory"
service="org.eclipse.remote.core.IRemoteProcessService">
</connectionService>
</extension>
<extension
point="org.eclipse.core.runtime.adapters">

View file

@ -196,7 +196,18 @@ public class RemoteConnectionType implements IRemoteConnectionType {
@Override
public IRemoteConnection getConnection(URI uri) {
return connections.get(uri.getAuthority());
IRemoteConnection connection = connections.get(uri.getAuthority());
if (connection != null) {
return connection;
}
// If it's a file: scheme we must be the local connection type, just return our
// hopefully one connection, the Local connection.
if (uri.getScheme().equals("file") && !connections.isEmpty()) { //$NON-NLS-1$
return connections.values().iterator().next();
}
return null;
}
@Override

View file

@ -20,15 +20,27 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteFileService;
import org.eclipse.remote.core.IRemoteProcessService;
import org.eclipse.remote.core.IRemoteConnection.Service;
public class LocalFileManager implements IRemoteFileService {
public class LocalFileService implements IRemoteFileService {
private final IRemoteConnection connection;
public LocalFileManager(IRemoteConnection connection) {
public LocalFileService(IRemoteConnection connection) {
this.connection = connection;
}
public static class Factory implements IRemoteFileService.Factory {
@SuppressWarnings("unchecked")
@Override
public <T extends Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
if (IRemoteFileService.class.equals(service)) {
return (T) new LocalFileService(remoteConnection);
}
return null;
}
}
@Override
public IRemoteConnection getRemoteConnection() {
return connection;