Author: jjohnstn
Date: 2010-10-01 12:54:18 -0400 (Fri, 01 Oct 2010)
New Revision: 25404
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
2010-10-01 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java: Add new
constant
for auto-connect to RSE.
* src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
(performOk): Add
auto-connect support.
(createContents): Ditto.
* src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties: Add
message for
auto-connect preference.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
(WatchCreateJob.run): If
auto-connect is true, connect to RSE.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
message
for auto-connect progress.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-01 16:46:53
UTC (rev 25403)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-01 16:54:18
UTC (rev 25404)
@@ -1,3 +1,17 @@
+2010-10-01 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java: Add new
constant
+ for auto-connect to RSE.
+ * src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
(performOk): Add
+ auto-connect support.
+ (createContents): Ditto.
+ * src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties: Add
message for
+ auto-connect preference.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
(WatchCreateJob.run): If
+ auto-connect is true, connect to RSE.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
message
+ for auto-connect progress.
+
2010-09-29 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (makeActions):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java 2010-10-01
16:46:53 UTC (rev 25403)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java 2010-10-01
16:54:18 UTC (rev 25404)
@@ -13,6 +13,7 @@
public interface IDeltaCloudPreferenceConstants {
public final static String DONT_CONFIRM_CREATE_INSTANCE =
"dont_confirm_create_instance"; //$NON-NLS-1$
+ public final static String AUTO_CONNECT_INSTANCE = "auto_connect_instance";
//$NON-NLS-1$
public final static String LAST_EC2_KEYNAME = "last_ec2_keyname";
//$NON-NLS-1$
public final static String DEFAULT_KEY_DIR = "default_key_directory";
//$NON-NLS-1$
public final static String LAST_CLOUD_INSTANCE_VIEW =
"last_cloud_instance_view"; //$NON-NLS-1$
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java 2010-10-01
16:46:53 UTC (rev 25403)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java 2010-10-01
16:54:18 UTC (rev 25404)
@@ -14,6 +14,8 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
@@ -29,8 +31,10 @@
IWorkbenchPreferencePage {
private final static String LAUNCH_WARN = "LaunchWarnPreference.msg";
//$NON-NLS-1$
+ private final static String AUTO_CONNECT = "AutoConnectPreference.msg";
//$NON-NLS-1$
private Button warnLaunch;
+ private Button autoConnect;
public DeltaCloudPreferencePage() {
// TODO Auto-generated constructor stub
@@ -61,6 +65,11 @@
prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE,
warnLaunch.getSelection());
}
+ boolean oldConnect =
prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
+ if (oldConnect != autoConnect.getSelection()) {
+ prefs.putBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE,
autoConnect.getSelection());
+ }
+
try {
prefs.flush();
} catch (BackingStoreException e) {
@@ -82,7 +91,16 @@
warnLaunch = new Button(container, SWT.CHECK);
warnLaunch.setText(PreferenceMessages.getString(LAUNCH_WARN));
warnLaunch.setSelection(prefs.getBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE,
false));
+
+ autoConnect = new Button(container, SWT.CHECK);
+ autoConnect.setText(PreferenceMessages.getString(AUTO_CONNECT));
+ autoConnect.setSelection(prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE,
true));
+ FormData f = new FormData();
+ f.top = new FormAttachment(warnLaunch, 10);
+ f.left = new FormAttachment(warnLaunch, 0, SWT.LEFT);
+ autoConnect.setLayoutData(f);
+
return container;
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties 2010-10-01
16:46:53 UTC (rev 25403)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties 2010-10-01
16:54:18 UTC (rev 25404)
@@ -8,4 +8,5 @@
# Contributors:
# Red Hat Incorporated - initial API and implementation
#################################################################################
-LaunchWarnPreference.msg=Do not warn me when launching an instance
\ No newline at end of file
+LaunchWarnPreference.msg=Do not warn me when launching an instance
+AutoConnectPreference.msg=Automatically connect to RSE when creating an instance
\ No newline at end of file
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-10-01
16:46:53 UTC (rev 25403)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-10-01
16:54:18 UTC (rev 25404)
@@ -22,12 +22,20 @@
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.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
import org.osgi.service.prefs.Preferences;
public class NewInstance extends Wizard {
@@ -40,6 +48,8 @@
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;
@@ -99,6 +109,47 @@
} finally {
cloud.addReplaceInstance(instance);
cloud.removeActionJob(instanceId, this);
+ String hostname = instance.getHostName();
+ 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();
+ }
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
pm.done();
}
return Status.OK_STATUS;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-10-01
16:46:53 UTC (rev 25403)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-10-01
16:54:18 UTC (rev 25404)
@@ -79,4 +79,5 @@
ConfirmKeyDelete.msg=Confirm deletion of key: {0}
StartingInstance.title=Starting Instance
-StartingInstance.msg=Starting Instance: {0}
\ No newline at end of file
+StartingInstance.msg=Starting Instance: {0}
+ConnectingRSE.msg=Connecting instance as: {0}
Show replies by date