Skip to content

Commit a3e6a80

Browse files
committed
GDB Remote launch targets load attributes when editing.
* When a GDB Remote TCP or Serial launch target was openend for editing the current attribute values were not shown. * The "name" attribute (which is equal to the id) was not updated in the preferences.
1 parent a03e303 commit a3e6a80

File tree

5 files changed

+54
-21
lines changed

5 files changed

+54
-21
lines changed

dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-Vendor: %providerName
55
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
6-
Bundle-Version: 2.8.800.qualifier
6+
Bundle-Version: 2.8.900.qualifier
77
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
88
Bundle-Localization: plugin
99
Require-Bundle: org.eclipse.ui;bundle-version="[3.207.200,4)",

dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewGdbRemoteSerialTargetWizard.java

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 QNX Software Systems and others.
2+
* Copyright (c) 2019, 2025 QNX Software Systems and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -42,6 +42,7 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
4242
private Text nameText;
4343
private Combo portCombo;
4444
private Text baudText;
45+
private static final String DEFAULT_BAUD_RATE = "115200"; //$NON-NLS-1$
4546

4647
private class SerialPage extends WizardPage {
4748
public SerialPage() {
@@ -55,6 +56,28 @@ public void createControl(Composite parent) {
5556
Composite control = new Composite(parent, SWT.NONE);
5657
control.setLayout(new GridLayout());
5758

59+
String targetName = ""; //$NON-NLS-1$
60+
String serialPort = ""; //$NON-NLS-1$
61+
String[] portNames;
62+
String baudRate = DEFAULT_BAUD_RATE;
63+
ILaunchTarget launchTarget = getLaunchTarget();
64+
try {
65+
portNames = SerialPort.list();
66+
} catch (IOException e) {
67+
GdbUIPlugin.log(e);
68+
portNames = new String[0];
69+
}
70+
if (launchTarget == null) {
71+
if (portNames.length > 0) {
72+
targetName = portNames[0];
73+
serialPort = portNames[0];
74+
}
75+
} else {
76+
targetName = launchTarget.getId();
77+
serialPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, serialPort);
78+
baudRate = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, baudRate);
79+
}
80+
5881
// Target name
5982

6083
Group nameGroup = new Group(control, SWT.NONE);
@@ -77,14 +100,15 @@ public void widgetSelected(SelectionEvent e) {
77100
nameText.setEnabled(!same);
78101
}
79102
});
80-
sameAsPortname.setSelection(true);
103+
sameAsPortname.setSelection(targetName.equals(serialPort));
81104

82105
Label nameLabel = new Label(nameGroup, SWT.NONE);
83106
nameLabel.setText(LaunchUIMessages.getString("NewGDBRemoteSerialTargetWizard_TargetName")); //$NON-NLS-1$
84107

85108
nameText = new Text(nameGroup, SWT.BORDER);
109+
nameText.setText(targetName);
86110
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
87-
nameText.setEnabled(false);
111+
nameText.setEnabled(!targetName.equals(serialPort));
88112
nameText.addModifyListener(new ModifyListener() {
89113
@Override
90114
public void modifyText(ModifyEvent e) {
@@ -105,17 +129,11 @@ public void modifyText(ModifyEvent e) {
105129
portCombo = new Combo(connGroup, SWT.NONE);
106130
portCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
107131

108-
try {
109-
String[] portNames = SerialPort.list();
110-
for (String portName : portNames) {
111-
portCombo.add(portName);
112-
}
113-
if (portNames.length > 0) {
114-
portCombo.select(0);
115-
nameText.setText(portCombo.getText());
116-
}
117-
} catch (IOException e) {
118-
GdbUIPlugin.log(e);
132+
for (String portName : portNames) {
133+
portCombo.add(portName);
134+
}
135+
if (portNames.length > 0) {
136+
portCombo.setText(serialPort);
119137
}
120138

121139
portCombo.addModifyListener(new ModifyListener() {
@@ -133,7 +151,7 @@ public void modifyText(ModifyEvent e) {
133151

134152
baudText = new Text(connGroup, SWT.BORDER);
135153
baudText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
136-
baudText.setText("115200"); //$NON-NLS-1$
154+
baudText.setText(baudRate);
137155
baudText.addModifyListener(new ModifyListener() {
138156
@Override
139157
public void modifyText(ModifyEvent e) {

dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/NewGdbRemoteTCPTargetWizard.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 QNX Software Systems and others.
2+
* Copyright (c) 2019, 2025 QNX Software Systems and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -50,6 +50,16 @@ public void createControl(Composite parent) {
5050
Composite control = new Composite(parent, SWT.NONE);
5151
control.setLayout(new GridLayout());
5252

53+
String targetName = ""; //$NON-NLS-1$
54+
String targetHostName = ""; //$NON-NLS-1$
55+
String targetPort = ""; //$NON-NLS-1$
56+
ILaunchTarget launchTarget = getLaunchTarget();
57+
if (launchTarget != null) {
58+
targetName = launchTarget.getId();
59+
targetHostName = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, targetHostName);
60+
targetPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, targetPort);
61+
}
62+
5363
// Target name
5464

5565
Group nameGroup = new Group(control, SWT.NONE);
@@ -72,14 +82,15 @@ public void widgetSelected(SelectionEvent e) {
7282
nameText.setEnabled(!same);
7383
}
7484
});
75-
sameAsHostname.setSelection(true);
85+
sameAsHostname.setSelection(targetName.equals(targetHostName));
7686

7787
Label nameLabel = new Label(nameGroup, SWT.NONE);
7888
nameLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.TargetName")); //$NON-NLS-1$
7989

8090
nameText = new Text(nameGroup, SWT.BORDER);
91+
nameText.setText(targetName);
8192
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
82-
nameText.setEnabled(false);
93+
nameText.setEnabled(!targetName.equals(targetHostName));
8394
nameText.addModifyListener(new ModifyListener() {
8495
@Override
8596
public void modifyText(ModifyEvent e) {
@@ -98,6 +109,7 @@ public void modifyText(ModifyEvent e) {
98109
hostLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.HostName")); //$NON-NLS-1$
99110

100111
hostText = new Text(connGroup, SWT.BORDER);
112+
hostText.setText(targetHostName);
101113
hostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
102114
hostText.addModifyListener(new ModifyListener() {
103115
@Override
@@ -113,6 +125,8 @@ public void modifyText(ModifyEvent e) {
113125
portLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.Port")); //$NON-NLS-1$
114126

115127
portText = new Text(connGroup, SWT.BORDER);
128+
portText.setText(targetPort);
129+
116130
portText.addModifyListener(new ModifyListener() {
117131
@Override
118132
public void modifyText(ModifyEvent e) {

launchbar/org.eclipse.launchbar.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.launchbar.core;singleton:=true
5-
Bundle-Version: 3.0.100
5+
Bundle-Version: 3.0.200
66
Bundle-Activator: org.eclipse.launchbar.core.internal.Activator
77
Bundle-Vendor: %providerName
88
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.33.0,4)",

launchbar/org.eclipse.launchbar.core/src/org/eclipse/launchbar/core/internal/target/LaunchTargetWorkingCopy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2016 QNX Software Systems and others.
2+
* Copyright (c) 2016, 2025 QNX Software Systems and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -102,6 +102,7 @@ public ILaunchTarget save() {
102102
target.attributes.remove(key);
103103
}
104104
}
105+
target.attributes.put("name", target.getId()); //$NON-NLS-1$
105106
target.attributes.flush();
106107
return target;
107108
} catch (BackingStoreException e) {

0 commit comments

Comments
 (0)