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

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

This commit is contained in:
Greg Watson 2015-02-17 12:19:21 -05:00 committed by Gerrit Code Review @ Eclipse.org
commit 72289d3ce6
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" factory="org.eclipse.remote.internal.core.services.local.LocalConnectionPropertyService$Factory"
service="org.eclipse.remote.core.IRemoteConnectionPropertyService"> service="org.eclipse.remote.core.IRemoteConnectionPropertyService">
</connectionService> </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>
<extension <extension
point="org.eclipse.core.runtime.adapters"> point="org.eclipse.core.runtime.adapters">

View file

@ -196,7 +196,18 @@ public class RemoteConnectionType implements IRemoteConnectionType {
@Override @Override
public IRemoteConnection getConnection(URI uri) { 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 @Override

View file

@ -20,15 +20,27 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.remote.core.IRemoteConnection; import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteFileService; import org.eclipse.remote.core.IRemoteFileService;
import org.eclipse.remote.core.IRemoteProcessService; 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; private final IRemoteConnection connection;
public LocalFileManager(IRemoteConnection connection) { public LocalFileService(IRemoteConnection connection) {
this.connection = 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 @Override
public IRemoteConnection getRemoteConnection() { public IRemoteConnection getRemoteConnection() {
return connection; return connection;