1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[241279] - fix for values reverting to defaults

This commit is contained in:
Alena Laskavaia 2008-07-28 20:58:41 +00:00
parent b10d7e7586
commit 66b2e1ceee

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Andy Jin - Hardware debugging UI improvements, bug 229946 * Andy Jin - Hardware debugging UI improvements, bug 229946
* Anna Dushistova(MontaVista) - Hardware Debugging: Host name or ip address not saving in the debug configuration, bug 241279
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.gdbjtag.ui; package org.eclipse.cdt.debug.gdbjtag.ui;
@ -65,6 +66,8 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
private Text ipAddress; private Text ipAddress;
private Text portNumber; private Text portNumber;
private Combo jtagDevice; private Combo jtagDevice;
private String savedJtagDevice;
public String getName() { public String getName() {
return TAB_NAME; return TAB_NAME;
@ -302,24 +305,26 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
* @param text * @param text
*/ */
protected void updateDeviceIpPort(String selectedDeviceName) { protected void updateDeviceIpPort(String selectedDeviceName) {
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory. if (selectedDeviceName.equals(savedJtagDevice)) {
getInstance().getGDBJtagDeviceContribution(); return;
}
GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance()
.getGDBJtagDeviceContribution();
IGDBJtagDevice selectedDevice = null; IGDBJtagDevice selectedDevice = null;
for (int i = 0; i < availableDevices.length; i++) { for (int i = 0; i < availableDevices.length; i++) {
String name = availableDevices[i].getDeviceName(); String name = availableDevices[i].getDeviceName();
if (name.equals(selectedDeviceName)) { if (name.equals(selectedDeviceName)) {
try { selectedDevice = availableDevices[i].getDevice();
selectedDevice = availableDevices[i].getDevice(); if (selectedDevice != null) {
} catch (NullPointerException e) { String ip = selectedDevice.getDefaultIpAddress();
return; ipAddress.setText(ip);
String port = selectedDevice.getDefaultPortNumber();
portNumber.setText(port);
updateLaunchConfigurationDialog();
break;
} }
break;
} }
} }
String ip = selectedDevice.getDefaultIpAddress();
ipAddress.setText(ip);
String port = selectedDevice.getDefaultPortNumber();
portNumber.setText(port);
} }
private void useRemoteChanged() { private void useRemoteChanged() {
@ -366,15 +371,16 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER); int portNumberAttr = configuration.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, IGDBJtagConstants.DEFAULT_PORT_NUMBER);
portNumber.setText(String.valueOf(portNumberAttr)); portNumber.setText(String.valueOf(portNumberAttr));
String jtagDeviceString = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, ""); savedJtagDevice = configuration.getAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, "");
for (int i = 0; i < jtagDevice.getItemCount(); i++) { for (int i = 0; i < jtagDevice.getItemCount(); i++) {
if (jtagDevice.getItem(i).equals(jtagDeviceString)) { if (jtagDevice.getItem(i).equals(savedJtagDevice)) {
jtagDevice.select(i); jtagDevice.select(i);
} }
} }
} catch (CoreException e) { } catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus()); Activator.getDefault().getLog().log(e.getStatus());
} }
} }
public void performApply(ILaunchConfigurationWorkingCopy configuration) { public void performApply(ILaunchConfigurationWorkingCopy configuration) {
@ -382,7 +388,8 @@ public class GDBJtagDebuggerTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, commandFactory.getText()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, commandFactory.getText());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, miProtocol.getText()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, miProtocol.getText());
configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, verboseMode.getSelection()); configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_VERBOSE_MODE, verboseMode.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, jtagDevice.getText()); savedJtagDevice = jtagDevice.getText();
configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE, savedJtagDevice);
configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection()); configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, useRemote.getSelection());
configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim()); configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ipAddress.getText().trim());
try { try {