|
Lines 6-17
Link Here
|
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchDelegate |
9 |
* Ewa Matejska (PalmSource) - Adapted from LocalRunLaunchDelegate |
| 10 |
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API |
10 |
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API |
| 11 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
11 |
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry |
| 12 |
* Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error |
12 |
* Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error |
| 13 |
* Anna Dushistova (MontaVista) - [234490][remotecdt] Launching with disconnected target fails |
13 |
* Anna Dushistova (MontaVista) - [234490][remotecdt] Launching with disconnected target fails |
| 14 |
* Anna Dushistova (MontaVista) - [235298][remotecdt] Further improve progress reporting and cancellation of Remote CDT Launch |
14 |
* Anna Dushistova (MontaVista) - [235298][remotecdt] Further improve progress reporting and cancellation of Remote CDT Launch |
|
|
15 |
* Anna Dushistova (MontaVista) - [247282][remotecdt] Make remotecdt work over any subsystem that has service which can be adapted to IShellService |
| 15 |
*******************************************************************************/ |
16 |
*******************************************************************************/ |
| 16 |
|
17 |
|
| 17 |
|
18 |
|
|
Lines 262-268
Link Here
|
| 262 |
// Nothing to do. Download is skipped. |
263 |
// Nothing to do. Download is skipped. |
| 263 |
return null; |
264 |
return null; |
| 264 |
monitor.beginTask("Downloading remote file", 100); //$NON-NLS-1$ |
265 |
monitor.beginTask("Downloading remote file", 100); //$NON-NLS-1$ |
| 265 |
IFileService fileService = (IFileService) getConnectedRemoteService(config, FILE_SERVICE, new SubProgressMonitor(monitor, 10)); |
266 |
IFileService fileService = getConnectedRemoteFileService(config, |
|
|
267 |
new SubProgressMonitor(monitor, 10)); |
| 266 |
File file = new File(localExePath); |
268 |
File file = new File(localExePath); |
| 267 |
Path remotePath = new Path(remoteExePath); |
269 |
Path remotePath = new Path(remoteExePath); |
| 268 |
try { |
270 |
try { |
|
Lines 282-288
Link Here
|
| 282 |
return null; |
284 |
return null; |
| 283 |
} |
285 |
} |
| 284 |
|
286 |
|
| 285 |
protected String getRemoteHostname(ILaunchConfiguration config) throws CoreException { |
287 |
private IFileService getConnectedRemoteFileService( |
|
|
288 |
ILaunchConfiguration config, SubProgressMonitor monitor) |
| 289 |
throws CoreException { |
| 290 |
|
| 291 |
IHost currentConnection = getCurrentConnection(config); |
| 292 |
|
| 293 |
ISubSystem[] subSystems = currentConnection.getSubSystems(); |
| 294 |
int i = 0; |
| 295 |
for (i = 0; i < subSystems.length; i++) { |
| 296 |
if (subSystems[i] instanceof IFileServiceSubSystem) |
| 297 |
break; |
| 298 |
} |
| 299 |
|
| 300 |
if (i >= subSystems.length) |
| 301 |
abort(Messages.RemoteRunLaunchDelegate_4, null, |
| 302 |
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
| 303 |
|
| 304 |
final IFileServiceSubSystem subsystem = (IFileServiceSubSystem) subSystems[i]; |
| 305 |
|
| 306 |
try { |
| 307 |
subsystem.connect(monitor, false); |
| 308 |
} catch (CoreException e) { |
| 309 |
throw e; |
| 310 |
} catch (OperationCanceledException e) { |
| 311 |
throw new CoreException(Status.CANCEL_STATUS); |
| 312 |
} catch (Exception e) { |
| 313 |
throw new CoreException(new Status(IStatus.ERROR, getPluginID(), |
| 314 |
IStatus.OK, e.getLocalizedMessage(), e)); |
| 315 |
} |
| 316 |
|
| 317 |
if (!subsystem.isConnected()) |
| 318 |
abort(Messages.RemoteRunLaunchDelegate_5, null, |
| 319 |
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
| 320 |
return subsystem.getFileService(); |
| 321 |
} |
| 322 |
|
| 323 |
protected String getRemoteHostname(ILaunchConfiguration config) |
| 324 |
throws CoreException { |
| 286 |
IHost currentConnection = getCurrentConnection(config); |
325 |
IHost currentConnection = getCurrentConnection(config); |
| 287 |
return currentConnection.getHostName(); |
326 |
return currentConnection.getHostName(); |
| 288 |
} |
327 |
} |
|
Lines 297-304
Link Here
|
| 297 |
spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$ |
336 |
spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$ |
| 298 |
String remote_command = real_remote_command + CMD_DELIMITER + EXIT_CMD; |
337 |
String remote_command = real_remote_command + CMD_DELIMITER + EXIT_CMD; |
| 299 |
|
338 |
|
| 300 |
|
339 |
IShellService shellService = getConnectedRemoteShellService(config, |
| 301 |
IShellService shellService = (IShellService) getConnectedRemoteService(config, SHELL_SERVICE, new SubProgressMonitor(monitor,7)); |
340 |
new SubProgressMonitor(monitor, 7)); |
| 302 |
|
341 |
|
| 303 |
// This is necessary because runCommand does not actually run the command right now. |
342 |
// This is necessary because runCommand does not actually run the command right now. |
| 304 |
String env[] = new String[0]; |
343 |
String env[] = new String[0]; |
|
Lines 318-323
Link Here
|
| 318 |
|
357 |
|
| 319 |
} |
358 |
} |
| 320 |
|
359 |
|
|
|
360 |
private IShellService getConnectedRemoteShellService( |
| 361 |
ILaunchConfiguration config, SubProgressMonitor monitor) |
| 362 |
throws CoreException { |
| 363 |
|
| 364 |
IHost currentConnection = getCurrentConnection(config); |
| 365 |
|
| 366 |
ISubSystem subsystem = Activator |
| 367 |
.getSuitableSubSystem(currentConnection); |
| 368 |
if (subsystem == null) |
| 369 |
abort(Messages.RemoteRunLaunchDelegate_4, null, |
| 370 |
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
| 371 |
try { |
| 372 |
subsystem.connect(monitor, false); |
| 373 |
} catch (CoreException e) { |
| 374 |
throw e; |
| 375 |
} catch (OperationCanceledException e) { |
| 376 |
throw new CoreException(Status.CANCEL_STATUS); |
| 377 |
} catch (Exception e) { |
| 378 |
throw new CoreException(new Status(IStatus.ERROR, getPluginID(), |
| 379 |
IStatus.OK, e.getLocalizedMessage(), e)); |
| 380 |
} |
| 381 |
|
| 382 |
if (!subsystem.isConnected()) |
| 383 |
abort(Messages.RemoteRunLaunchDelegate_5, null, |
| 384 |
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
| 385 |
|
| 386 |
return (IShellService) subsystem.getSubSystemConfiguration() |
| 387 |
.getService(currentConnection).getAdapter(IShellService.class); |
| 388 |
} |
| 389 |
|
| 321 |
protected String getPluginID() { |
390 |
protected String getPluginID() { |
| 322 |
return "org.eclipse.rse.internal.remotecdt"; //$NON-NLS-1$ |
391 |
return "org.eclipse.rse.internal.remotecdt"; //$NON-NLS-1$ |
| 323 |
} |
392 |
} |