Author: adietish
Date: 2010-11-16 09:18:39 -0500 (Tue, 16 Nov 2010)
New Revision: 26615
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
Log:
[JBIDE-7603] removed duplicate RSE related code
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-16 13:49:06
UTC (rev 26614)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-16 14:18:39
UTC (rev 26615)
@@ -1,5 +1,9 @@
2010-11-16 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/ui/RSEUtils.java (createHostName):
+ [JBIDE-7603] added null check
+ * src/org/jboss/tools/deltacloud/ui/views/PerformInstanceActionThread.java (run):
+ [JBIDE-7365] moved state waiting to delta cloud, removed duplilcate code
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
(refreshToolbarCommandStates):
* src/org/jboss/tools/deltacloud/ui/commands/InstancePropertyTester.java (test):
[JBIDE-7365] changed property tester to test available actions (tested state and guessed
the available actions from it),
@@ -10,6 +14,8 @@
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard2.java
(WatchCreateJob.run):
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
(WatchCreateJob.run):
[JBIDE-7603] moved (duplicate) instance state waiting code to delta cloud and removed
duplication
+ (WatchCreateJob.run):
+ [JBIDE-7603] removed duplicate RSE related code
* src/org/jboss/tools/deltacloud/ui/commands/ShowInRemoteSystemExplorerHandler.java
(execute):
[JBIDE-7603] unified RSE related (duplicate) code with code in NewConnectionHandler2
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java:
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-11-16
13:49:06 UTC (rev 26614)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-11-16
14:18:39 UTC (rev 26615)
@@ -52,6 +52,9 @@
}
public static String createHostName(DeltaCloudInstance instance) {
+ if (instance == null) {
+ return null;
+ }
return instance.getHostName();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-11-16
13:49:06 UTC (rev 26614)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-11-16
14:18:39 UTC (rev 26615)
@@ -22,20 +22,15 @@
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.IRSECoreRegistry;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.core.subsystems.IConnectorService;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.RSEUtils;
import org.osgi.service.prefs.Preferences;
/**
@@ -51,7 +46,6 @@
private final static String DONT_SHOW_THIS_AGAIN_MSG =
"DontShowThisAgain.msg"; //$NON-NLS-1$
private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg";
//$NON-NLS-1$
private final static String STARTING_INSTANCE_TITLE =
"StartingInstance.title"; //$NON-NLS-1$
- private final static String RSE_CONNECTING_MSG = "ConnectingRSE.msg";
//$NON-NLS-1$
private NewInstancePage mainPage;
@@ -103,45 +97,17 @@
} finally {
cloud.replaceInstance(instance);
cloud.removeInstanceJob(instanceId, this);
- String hostname = instance.getHostName();
+ String hostname = RSEUtils.createHostName(instance);
Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
boolean autoConnect =
prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
if (hostname != null && hostname.length() > 0 && autoConnect) {
- ISystemRegistry registry = SystemStartHere.getSystemRegistry();
- RSECorePlugin rsep = RSECorePlugin.getDefault();
- IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
- IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
- IRSESystemType sshType = null;
- for (IRSESystemType sysType : sysTypes) {
- if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
- sshType = sysType;
- }
- String connectionName = instance.getName() + " [" + instance.getId() +
"]"; //$NON-NLS-1$ //$NON-NLS-2$
try {
- IHost host = registry.createHost(sshType, connectionName, hostname, null);
- if (host != null) {
- host.setDefaultUserId("root"); //$NON-NLS-1$
- IConnectorService[] services = host.getConnectorServices();
- if (services.length > 0) {
- final IConnectorService service = services[0];
- Job connect = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG,
connectionName)) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- service.connect(monitor);
- return Status.OK_STATUS;
- } catch(Exception e) {
- return Status.CANCEL_STATUS;
- }
- }
- };
- connect.setUser(true);
- connect.schedule();
- }
- }
+ String connectionName = RSEUtils.createConnectionName(instance);
+ IHost host = RSEUtils.createHost(connectionName,
RSEUtils.createHostName(instance));
+ RSEUtils.launchRemoteSystemExplorer(instance.getName(), connectionName, host);
} catch (Exception e) {
- // TODO Auto-generated catch block
- Activator.log(e);
+ ErrorUtils.openErrorDialog("Error", "Could not launch remote system
explorer for instance \"" + instance.getName() + "\"", e,
getShell());
+ return Status.OK_STATUS;
}
}
pm.done();
Show replies by date