mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Bug 483923 - Opening ssh connection should not depend on sftp
- move aborting logic from opening connection to retrieval of file service Change-Id: Ided36954880e535243783ed704d2fac161d42b59 Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
This commit is contained in:
parent
edb1a9bd2b
commit
08fc8e1b4d
2 changed files with 47 additions and 36 deletions
|
@ -973,9 +973,13 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
|
||||||
isFullySetup = true;
|
isFullySetup = true;
|
||||||
// getCwd checks the exec channel before checkConfiguration checks the sftp channel
|
// getCwd checks the exec channel before checkConfiguration checks the sftp channel
|
||||||
fWorkingDir = getCwd(subMon.newChild(10));
|
fWorkingDir = getCwd(subMon.newChild(10));
|
||||||
if (!checkConfiguration(fSessions.get(0), subMon.newChild(20))) {
|
try {
|
||||||
newSession(subMon.newChild(10));
|
if (!checkConfiguration(fSessions.get(0), subMon.newChild(20))) {
|
||||||
loadEnv(subMon.newChild(10));
|
newSession(subMon.newChild(10));
|
||||||
|
loadEnv(subMon.newChild(10));
|
||||||
|
}
|
||||||
|
} catch (RemoteConnectionException e) {
|
||||||
|
// Do not throw exception now, it will be thrown if FileService is accessed.
|
||||||
}
|
}
|
||||||
loadProperties(subMon.newChild(10));
|
loadProperties(subMon.newChild(10));
|
||||||
fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
|
fRemoteConnection.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_OPENED);
|
||||||
|
|
|
@ -20,12 +20,13 @@ import org.eclipse.remote.core.IRemoteConnection.Service;
|
||||||
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.RemoteServicesUtils;
|
import org.eclipse.remote.core.RemoteServicesUtils;
|
||||||
|
import org.eclipse.remote.core.exception.RemoteConnectionException;
|
||||||
|
import org.eclipse.remote.internal.jsch.core.messages.Messages;
|
||||||
|
|
||||||
public class JSchFileManager implements IRemoteFileService {
|
public class JSchFileManager implements IRemoteFileService {
|
||||||
|
|
||||||
private final IRemoteConnection fConnection;
|
private final IRemoteConnection fConnection;
|
||||||
|
|
||||||
public JSchFileManager(IRemoteConnection connection) {
|
private JSchFileManager(IRemoteConnection connection) {
|
||||||
fConnection = connection;
|
fConnection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +35,13 @@ public class JSchFileManager implements IRemoteFileService {
|
||||||
@Override
|
@Override
|
||||||
public <T extends Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
|
public <T extends Service> T getService(IRemoteConnection remoteConnection, Class<T> service) {
|
||||||
if (IRemoteFileService.class.equals(service)) {
|
if (IRemoteFileService.class.equals(service)) {
|
||||||
|
if (remoteConnection instanceof JSchConnection)
|
||||||
|
try {
|
||||||
|
((JSchConnection) remoteConnection).getSftpChannel();
|
||||||
|
} catch (RemoteConnectionException e) {
|
||||||
|
throw new UnsupportedOperationException(
|
||||||
|
Messages.JSchConnection_Remote_host_does_not_support_sftp);
|
||||||
|
}
|
||||||
return (T) new JSchFileManager(remoteConnection);
|
return (T) new JSchFileManager(remoteConnection);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -87,5 +95,4 @@ public class JSchFileManager implements IRemoteFileService {
|
||||||
public URI toURI(String path) {
|
public URI toURI(String path) {
|
||||||
return toURI(RemoteServicesUtils.posixPath(path));
|
return toURI(RemoteServicesUtils.posixPath(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue