Author: rob.stryker(a)jboss.com
Date: 2010-10-05 08:32:02 -0400 (Tue, 05 Oct 2010)
New Revision: 25488
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
Log:
JBIDE-7221 - last patch to make sure hostname is autoselected in rse combo if one is
provided on page1 of new server wizard
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-10-05
12:13:48 UTC (rev 25487)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-10-05
12:32:02 UTC (rev 25488)
@@ -75,7 +75,7 @@
Composite child = new Composite(this, SWT.None);
child.setLayoutData(UIUtil.createFormData2(0, 0, null, 0, 0, 5, 100, 0));
child.setLayout(new GridLayout());
- String current = callback.getServer().getAttribute(RSEUtils.RSE_SERVER_HOST,
RSEUtils.RSE_SERVER_DEFAULT_HOST);
+ String current = discoverCurrentHost(callback);
combo = new CustomSystemHostCombo(child, SWT.NULL, current, "files");
//$NON-NLS-1$
comboMListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -121,6 +121,22 @@
callback.getServer().addPropertyChangeListener(this);
}
+ private String discoverCurrentHost(IServerModeUICallback callback) {
+ String current = callback.getServer().getAttribute(RSEUtils.RSE_SERVER_HOST,
(String)null);
+ if( current == null ) {
+ String serverHost = callback.getServer().getHost().toLowerCase();
+ IHost[] hosts =
RSECorePlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationCategory("files");
+ String name, hostName;
+ for( int i = 0; i < hosts.length; i++ ) {
+ name = hosts[i].getName();
+ hostName = hosts[i].getHostName();
+ if( hosts[i].getHostName().toLowerCase().equals(serverHost))
+ return hosts[i].getName();
+ }
+ }
+ return current;
+ }
+
@Override
public void dispose () {
super.dispose();
Show replies by date