Author: rob.stryker(a)jboss.com
Date: 2011-02-10 19:26:13 -0500 (Thu, 10 Feb 2011)
New Revision: 29107
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
Log:
JBIDE-8372
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2011-02-10
17:08:23 UTC (rev 29106)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2011-02-11
00:26:13 UTC (rev 29107)
@@ -26,8 +26,9 @@
org.jboss.tools.deltacloud.core,
org.jboss.tools.deltacloud.ui,
org.jboss.ide.eclipse.as.core,
- org.eclipse.core.resources;bundle-version="[3.6.0,4.0.0)",
- org.jboss.ide.eclipse.as.rse.core;bundle-version="[0.9.0,2.0.0)",
- org.eclipse.wst.server.core;bundle-version="[1.1.204,2.0.0)",
- org.eclipse.wst.server.ui;bundle-version="[1.1.205,2.0.0)",
- org.eclipse.jsch.core;bundle-version="1.1.200"
+ org.eclipse.core.resources,
+ org.jboss.ide.eclipse.as.rse.core,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jsch.core,
+ com.jcraft.jsch
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java 2011-02-10
17:08:23 UTC (rev 29106)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java 2011-02-11
00:26:13 UTC (rev 29107)
@@ -29,6 +29,7 @@
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.eclipse.rse.services.clientserver.messages.SystemOperationFailedException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
@@ -39,6 +40,8 @@
import org.jboss.tools.deltacloud.integration.wizard.CreateServerFromRSEJob;
import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
+import com.jcraft.jsch.JSchException;
+
/**
* @author André Dietisheim
*/
@@ -137,6 +140,15 @@
monitor.done();
return Status.CANCEL_STATUS;
} catch (Exception e) {
+ if( e instanceof SystemOperationFailedException) {
+ Throwable t = ((SystemOperationFailedException) e).getRemoteException();
+ if( t instanceof JSchException) {
+ // User clicked no on accept hostkey
+ if(t.getMessage().contains("reject HostKey:"))
+ return Status.CANCEL_STATUS;
+ }
+ }
+
monitor.worked(getProgress(current, last, scale));
last = current;
if (current < start + timeout) {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java 2011-02-10
17:08:23 UTC (rev 29106)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/CreateRSEFromInstanceJob.java 2011-02-11
00:26:13 UTC (rev 29107)
@@ -12,12 +12,14 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.services.clientserver.messages.SystemOperationFailedException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
@@ -29,6 +31,8 @@
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
import org.osgi.service.prefs.Preferences;
+import com.jcraft.jsch.JSchException;
+
public class CreateRSEFromInstanceJob extends AbstractInstanceJob {
/** the timeout for trying to connect to the new instance */
private static final long CONNECT_TIMEOUT = 3 * 60 * 1000;
@@ -60,8 +64,11 @@
((CreateServerFromRSEJob)nextJob2).setHost(host);
}
monitor.worked(10);
- triggerCredentialsDialog(host, new SubProgressMonitor(monitor, 10));
- return RSEUtils.connect(RSEUtils.getConnectorService(host), CONNECT_TIMEOUT, new
SubProgressMonitor(monitor, 80));
+ IStatus credentials =
+ triggerCredentialsDialog(host, new SubProgressMonitor(monitor, 10));
+ if( credentials.isOK())
+ return RSEUtils.connect(RSEUtils.getConnectorService(host), CONNECT_TIMEOUT, new
SubProgressMonitor(monitor, 80));
+ return credentials;
} catch (Exception e) {
return ErrorUtils.handleError(Messages.ERROR,
NLS.bind(Messages.COULD_NOT_LAUNCH_RSE_EXPLORER2, instance.getName()),
@@ -71,15 +78,25 @@
return Status.OK_STATUS;
}
- private void triggerCredentialsDialog(IHost host, IProgressMonitor monitor) {
+ private IStatus triggerCredentialsDialog(IHost host, IProgressMonitor monitor) {
try {
IRemoteFileSubSystem system = RSEUtils.findRemoteFileSubSystem(host);
system.connect(monitor, true /* force credentials dialog */);
} catch(Exception e) {
- // ignore, expected, the server probably isn't up yet.
+ if( e instanceof OperationCanceledException)
+ return Status.CANCEL_STATUS;
+ if( e instanceof SystemOperationFailedException ) {
+ Exception f = ((SystemOperationFailedException) e).getRemoteException();
+ if( f != null && f instanceof JSchException) {
+ // User selected No on accept hostkey
+ if(f.getMessage().contains("reject HostKey:"))
+ return Status.CANCEL_STATUS;
+ }
+ }
} finally {
monitor.done();
}
+ return Status.OK_STATUS;
}
private boolean isAutoconnect() {