[Esbox-commits] r826 - in trunk: common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui

lwang at garage.maemo.org lwang at garage.maemo.org
Wed Oct 1 21:28:18 EEST 2008


Author: lwang
Date: 2008-10-01 21:28:17 +0300 (Wed, 01 Oct 2008)
New Revision: 826

Added:
   trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractConnectionConfigPage.java
   trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/IConnectionConfigPage.java
   trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/RawConnectionConfigPage.java
Modified:
   trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java
   trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java
Log:
1. Separate out the connection configuration page from SSHLaunchProtocolPage, preparing for integrating other connection configuration method (e.g. RSE). 
2. improved the layout of UI components in the existing raw connection config page.

Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractConnectionConfigPage.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractConnectionConfigPage.java	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractConnectionConfigPage.java	2008-10-01 18:28:17 UTC (rev 826)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Oct 1, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+
+/**
+ * Offer functionality of "initializing" flag control.
+ * 
+ * @author LWang
+ *
+ */
+public abstract class AbstractConnectionConfigPage extends
+		AbstractLaunchConfigurationTab implements IConnectionConfigPage {
+
+	private boolean fIsInitializing;
+
+	protected boolean isInitializing() {
+		return fIsInitializing;
+	}
+
+	protected void setInitializing( boolean isInitializing ) {
+		fIsInitializing = isInitializing;
+	}
+}


Property changes on: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/AbstractConnectionConfigPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/IConnectionConfigPage.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/IConnectionConfigPage.java	                        (rev 0)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/IConnectionConfigPage.java	2008-10-01 18:28:17 UTC (rev 826)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Oct 1, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.launch.ui;
+
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+/**
+ * interface for UI page/pane in Launch configuration dialog that 
+ * handles remote connection configuration. 
+ * 
+ * @author LWang
+ *
+ */
+public interface IConnectionConfigPage extends ILaunchConfigurationTab {
+
+}


Property changes on: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/IConnectionConfigPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/RawConnectionConfigPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/RawConnectionConfigPage.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/RawConnectionConfigPage.java	2008-10-01 18:28:17 UTC (rev 826)
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Oct 1, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.core.ESboxException;
+import org.maemo.esbox.core.GeneralUtils;
+import org.maemo.esbox.device.launch.SSHLaunchProtocolType;
+import org.maemo.esbox.launch.IESboxLaunchConfigurationConstants;
+import org.maemo.esbox.launch.ui.AbstractConnectionConfigPage;
+import org.maemo.esbox.ui.common.DialogField;
+import org.maemo.esbox.ui.common.IDialogFieldListener;
+import org.maemo.esbox.ui.common.StringDialogField;
+
+/**
+ * A UI page that allows user to enter IP address and port number for both
+ * host and target.
+ * 
+ * @author LWang
+ *
+ */
+public class RawConnectionConfigPage extends AbstractConnectionConfigPage {
+
+	private StringDialogField hostIPAddressField;
+	private StringDialogField hostPortField;
+	private StringDialogField targetIPAddressField;
+	private StringDialogField targetPortField;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite page = SSHLaunchProtocolPage.createCompositeEx( parent, 4, GridData.FILL_BOTH );
+		
+		GridLayout gd =(GridLayout)page.getLayout(); 
+		gd.marginHeight = 0;
+		gd.marginWidth = 0;
+
+		hostIPAddressField = new StringDialogField();
+		hostIPAddressField.setLabelText("Host address:");
+		hostIPAddressField.doFillIntoGrid(page, 2);
+		Text textField = hostIPAddressField.getTextControl(page);
+		textField.setToolTipText("Specify the address of the host as seen from the device, as an IP address or host name.");
+		GridData gridData = new GridData(/*GridData.FILL_HORIZONTAL*/);
+		gridData.widthHint = 200;
+		textField.setLayoutData(gridData);
+	
+		hostPortField = new StringDialogField();
+		hostPortField.setLabelText("Host port:");
+		hostPortField.doFillIntoGrid(page, 2);
+		textField = hostPortField.getTextControl(page);
+		textField.setToolTipText("Specify the SSH port for the host as seen from the device.");
+		gridData = new GridData();
+		gridData.widthHint = 60;
+		textField.setLayoutData(gridData);
+
+		targetIPAddressField = new StringDialogField();
+		targetIPAddressField.setLabelText("Target address:");
+		targetIPAddressField.doFillIntoGrid(page, 2);
+		textField = targetIPAddressField.getTextControl(page);
+		textField.setToolTipText("Specify the address of the device, as an IP address or host name.");
+		gridData = new GridData();
+		gridData.widthHint = 200;
+		textField.setLayoutData(gridData);
+		
+		targetPortField = new StringDialogField();
+		targetPortField.setLabelText("Target port:");
+		targetPortField.doFillIntoGrid(page, 2);
+		textField = targetPortField.getTextControl(page);
+		textField.setToolTipText("Specify the SSH port for the device.");
+		gridData = new GridData();
+		gridData.widthHint = 60;
+		textField.setLayoutData(gridData);
+		
+		IDialogFieldListener validator = new IDialogFieldListener() {
+
+			public void dialogFieldChanged(DialogField field) {
+				if (!isInitializing()) {
+					updateLaunchConfigurationDialog();
+				}
+			}
+			
+		};
+		targetIPAddressField.setDialogFieldListener(validator);
+		hostIPAddressField.setDialogFieldListener(validator);
+		targetPortField.setDialogFieldListener(validator);
+		hostPortField.setDialogFieldListener(validator);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+	 */
+	public String getName() {
+		return "internal RawConnectionConfigPage";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+	 */
+	public void initializeFrom(ILaunchConfiguration configuration) {
+		setInitializing(true);
+
+		initializeField(hostIPAddressField, configuration,
+				SSHLaunchProtocolType.ATTR_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+		initializeField(hostPortField, configuration,
+				SSHLaunchProtocolType.ATTR_HOST_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+		initializeField(targetIPAddressField, configuration,
+				SSHLaunchProtocolType.ATTR_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+		initializeField(targetPortField, configuration,
+				SSHLaunchProtocolType.ATTR_TARGET_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+
+		setInitializing(false);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+	 */
+	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+		configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_IP, hostIPAddressField.getText());
+		configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_PORT, hostPortField.getText());
+		configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_IP, targetIPAddressField.getText());
+		configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_PORT, targetPortField.getText());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+	 */
+	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+		// do nothing
+	}
+
+	@Override
+	public boolean isValid(ILaunchConfiguration launchConfig) {
+		setErrorMessage(null);
+		setMessage(null);
+
+		// Validate SSH settings.
+		try {
+			validate(launchConfig);
+		}
+		catch (ESboxException e) {
+			setErrorMessage(e.getMessage());
+			return false;
+		}
+		
+		return true;
+	}
+
+	private void validate(ILaunchConfiguration config) throws ESboxException {
+
+		String hostIP;
+		try {
+			hostIP = config.getAttribute(
+					SSHLaunchProtocolType.ATTR_HOST_IP, 
+					IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
+		} catch (CoreException e1) {
+			throw new ESboxException("Host address is unknown.");
+		}
+		
+		if (!GeneralUtils.isValidNameOrIP(hostIP)) {
+			throw new ESboxException("Host address is invalid: " + hostIP);
+		}
+		
+		String hostPort;
+		try {
+			hostPort = config.getAttribute(
+					SSHLaunchProtocolType.ATTR_HOST_PORT, 
+					IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+		} catch (CoreException e1) {
+			throw new ESboxException("Host port is unknown.");
+		}
+		if (!GeneralUtils.isValidPortNumber(hostPort)) {
+			throw new ESboxException("Host port is invalid: " + hostPort);
+		}
+		
+		String targetIP;
+		try {
+			targetIP = config.getAttribute(
+					SSHLaunchProtocolType.ATTR_TARGET_IP, 
+					IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
+		} catch (CoreException e1) {
+			throw new ESboxException("Target address is unknown.");
+		}
+
+		if (!GeneralUtils.isValidNameOrIP(targetIP)) {
+			throw new ESboxException("Target address is invalid: " + targetIP);
+		}
+
+		String targetPort;
+		try {
+			targetPort = config.getAttribute(
+					SSHLaunchProtocolType.ATTR_TARGET_PORT, 
+					IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
+		} catch (CoreException e1) {
+			throw new ESboxException("Target port is unknown.");
+		}
+		if (!GeneralUtils.isValidPortNumber(targetPort)) {
+			throw new ESboxException("Target port is invalid: " + targetPort);
+		}
+
+	}
+	
+	private void initializeField(StringDialogField field,
+			ILaunchConfiguration configuration, String key,
+			String defaultValue) {
+		try {
+			field.setText(configuration.getAttribute(key, defaultValue)); 
+		} catch (CoreException e) {
+			field.setText(defaultValue);
+		}
+	}
+
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/RawConnectionConfigPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java	2008-09-30 17:46:38 UTC (rev 825)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SBRSHLaunchProtocolPage.java	2008-10-01 18:28:17 UTC (rev 826)
@@ -128,7 +128,7 @@
 
 		createSeparator(fSBRSHPage, 2);
 		
-		// Stack page that will show either SSH page or SBRSH page.
+		// Stack page that will show either auto-config page or custom-config page.
 		fConfigMethodStack = new Composite(fSBRSHPage, SWT.NONE);
 		GridData gData = new GridData(GridData.FILL_BOTH);
 		gData.horizontalSpan = 2;

Modified: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java	2008-09-30 17:46:38 UTC (rev 825)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/ui/SSHLaunchProtocolPage.java	2008-10-01 18:28:17 UTC (rev 826)
@@ -12,9 +12,13 @@
 
 package org.maemo.esbox.device.launch.ui;
 
-import org.eclipse.core.runtime.*;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -22,17 +26,12 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Link;
-import org.maemo.esbox.core.ESboxException;
-import org.maemo.esbox.core.GeneralUtils;
 import org.maemo.esbox.device.launch.FileToTransfer;
 import org.maemo.esbox.device.launch.SSHLaunchProtocolType;
-import org.maemo.esbox.launch.*;
 import org.maemo.esbox.launch.ui.AbstractLaunchProtocolPage;
+import org.maemo.esbox.launch.ui.IConnectionConfigPage;
 import org.maemo.esbox.ssh.ui.SSHPreferenceUtils;
-import org.maemo.esbox.ui.common.*;
 
-import java.util.ArrayList;
-
 /**
  * @author LWang
  * @author eswartz
@@ -40,10 +39,8 @@
  */
 public class SSHLaunchProtocolPage extends AbstractLaunchProtocolPage {
 
-	private StringDialogField hostIPAddressField;
-	private StringDialogField hostPortField;
-	private StringDialogField targetIPAddressField;
-	private StringDialogField targetPortField;
+	private IConnectionConfigPage	fConnectionConfigPage;
+	
 	private FilesBlock 	fFilesBlock;
 
 	/**
@@ -67,46 +64,35 @@
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
 	 */
 	public void createControl(Composite parent) {
-		Composite page = createCompositeEx( parent, 2, GridData.FILL_BOTH );
+		// Connection configuration pane
+		//
+		Composite pane1 = createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL );
 		
-		GridLayout gd =(GridLayout)page.getLayout(); 
-		gd.marginHeight = 0;
-		gd.marginWidth = 0;
+		fConnectionConfigPage = createConnectionConfigPane(pane1);
 
-		hostIPAddressField = new StringDialogField();
-		hostIPAddressField.setLabelText("Host address:");
-		hostIPAddressField.doFillIntoGrid(page, 2);
-		hostIPAddressField.getTextControl(page).setToolTipText("Specify the address of the host as seen from the device, as an IP address or host name.");
+		createSeparator(parent, 1);
 		
-		hostPortField = new StringDialogField();
-		hostPortField.setLabelText("Host port:");
-		hostPortField.doFillIntoGrid(page, 2);
-		hostPortField.getTextControl(page).setToolTipText("Specify the SSH port for the host as seen from the device.");
+		// File table pane
+		//
+		Composite pane2 = createCompositeEx( parent, 1, GridData.FILL_HORIZONTAL );
+		createFileTablePane(pane2);
+	}
 
-		targetIPAddressField = new StringDialogField();
-		targetIPAddressField.setLabelText("Target address:");
-		targetIPAddressField.doFillIntoGrid(page, 2);
-		targetIPAddressField.getTextControl(page).setToolTipText("Specify the address of the device, as an IP address or host name.");
+	protected IConnectionConfigPage createConnectionConfigPane(Composite parent) {
+		IConnectionConfigPage page = new RawConnectionConfigPage();
+		page.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+		page.createControl(parent);
 		
-		targetPortField = new StringDialogField();
-		targetPortField.setLabelText("Target port:");
-		targetPortField.doFillIntoGrid(page, 2);
-		targetPortField.getTextControl(page).setToolTipText("Specify the SSH port for the device.");
+		return page;
+	}
+	
+	protected void createFileTablePane(Composite parent) {
+		Composite page = createCompositeEx( parent, 2, GridData.FILL_BOTH );
 		
-		IDialogFieldListener validator = new IDialogFieldListener() {
+		GridLayout gd =(GridLayout)page.getLayout(); 
+		gd.marginHeight = 0;
+		gd.marginWidth = 0;
 
-			public void dialogFieldChanged(DialogField field) {
-				if (!isInitializing()) {
-					updateLaunchConfigurationDialog();
-				}
-			}
-			
-		};
-		targetIPAddressField.setDialogFieldListener(validator);
-		hostIPAddressField.setDialogFieldListener(validator);
-		targetPortField.setDialogFieldListener(validator);
-		hostPortField.setDialogFieldListener(validator);
-
 	    Link noteWithLink = new Link(page, SWT.NONE);
 		noteWithLink.setText("(Note: If target path is relative, it's relative to the base folder in the global <a href=\"dummy\">SSH panel</a>)");
 		GridData data = new GridData(GridData.FILL, GridData.BEGINNING, true, false);
@@ -129,75 +115,22 @@
 
 	@Override
 	public boolean isValid(ILaunchConfiguration launchConfig) {
-		setErrorMessage(null);
-		setMessage(null);
-
-		// Validate SSH settings.
-		try {
-			validate(launchConfig);
-		}
-		catch (ESboxException e) {
-			setErrorMessage(e.getMessage());
-			return false;
-		}
-		
-		return true;
+		return fConnectionConfigPage.isValid(launchConfig);
 	}
 
-	private void validate(ILaunchConfiguration config) throws ESboxException {
-
-		String hostIP;
-		try {
-			hostIP = config.getAttribute(
-					SSHLaunchProtocolType.ATTR_HOST_IP, 
-					IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
-		} catch (CoreException e1) {
-			throw new ESboxException("Host address is unknown.");
+	/**
+	 * Overridden here so that any error message sub-tab gets
+	 * returned.
+	 * 
+	 * @see ILaunchConfigurationTab#getErrorMessage()
+	 */
+	public String getErrorMessage() {
+		if ( (super.getErrorMessage() != null) || (fConnectionConfigPage == null)) {
+			return super.getErrorMessage();
 		}
-		
-		if (!GeneralUtils.isValidNameOrIP(hostIP)) {
-			throw new ESboxException("Host address is invalid: " + hostIP);
-		}
-		
-		String hostPort;
-		try {
-			hostPort = config.getAttribute(
-					SSHLaunchProtocolType.ATTR_HOST_PORT, 
-					IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
-		} catch (CoreException e1) {
-			throw new ESboxException("Host port is unknown.");
-		}
-		if (!GeneralUtils.isValidPortNumber(hostPort)) {
-			throw new ESboxException("Host port is invalid: " + hostPort);
-		}
-		
-		String targetIP;
-		try {
-			targetIP = config.getAttribute(
-					SSHLaunchProtocolType.ATTR_TARGET_IP, 
-					IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
-		} catch (CoreException e1) {
-			throw new ESboxException("Target address is unknown.");
-		}
-
-		if (!GeneralUtils.isValidNameOrIP(targetIP)) {
-			throw new ESboxException("Target address is invalid: " + targetIP);
-		}
-
-		String targetPort;
-		try {
-			targetPort = config.getAttribute(
-					SSHLaunchProtocolType.ATTR_TARGET_PORT, 
-					IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
-		} catch (CoreException e1) {
-			throw new ESboxException("Target port is unknown.");
-		}
-		if (!GeneralUtils.isValidPortNumber(targetPort)) {
-			throw new ESboxException("Target port is invalid: " + targetPort);
-		}
-
+		return fConnectionConfigPage.getErrorMessage();
 	}
-	
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
 	 */
@@ -211,15 +144,8 @@
 	public void initializeFrom(ILaunchConfiguration configuration) {
 		setInitializing(true);
 
-		initializeField(hostIPAddressField, configuration,
-				SSHLaunchProtocolType.ATTR_HOST_IP, IESboxLaunchConfigurationConstants.DEFAULT_HOST_IP);
-		initializeField(hostPortField, configuration,
-				SSHLaunchProtocolType.ATTR_HOST_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
-		initializeField(targetIPAddressField, configuration,
-				SSHLaunchProtocolType.ATTR_TARGET_IP, IESboxLaunchConfigurationConstants.DEFAULT_TARGET_NAME);
-		initializeField(targetPortField, configuration,
-				SSHLaunchProtocolType.ATTR_TARGET_PORT, IESboxLaunchConfigurationConstants.DEFAULT_SSH_PORT_NUMBER);
-
+		fConnectionConfigPage.initializeFrom(configuration);
+		
 		ArrayList<FileToTransfer> files = SSHLaunchProtocolType.getFilesToDownload(configuration);
         String defaultHostPath = null;
         String defaultTargetPath = null;
@@ -243,24 +169,11 @@
         setInitializing(false);
 	}
 
-	private void initializeField(StringDialogField field,
-			ILaunchConfiguration configuration, String key,
-			String defaultValue) {
-		try {
-			field.setText(configuration.getAttribute(key, defaultValue)); 
-		} catch (CoreException e) {
-			field.setText(defaultValue);
-		}
-	}
-
 	/* (non-Javadoc)
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
 	 */
 	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
-		configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_IP, hostIPAddressField.getText());
-		configuration.setAttribute(SSHLaunchProtocolType.ATTR_HOST_PORT, hostPortField.getText());
-		configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_IP, targetIPAddressField.getText());
-		configuration.setAttribute(SSHLaunchProtocolType.ATTR_TARGET_PORT, targetPortField.getText());
+		fConnectionConfigPage.performApply(configuration);
 		SSHLaunchProtocolType.storeFilesToDownload(configuration, fFilesBlock.getFiles());
 	}
 



More information about the Esbox-commits mailing list