1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 13:55:39 +02:00

GDB Remote launch targets load attributes when editing. (#1207)

* 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.
This commit is contained in:
ewaterlander 2025-07-14 22:33:20 +01:00 committed by GitHub
parent b79728af95
commit b29198a8ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 54 additions and 21 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
Bundle-Version: 2.8.800.qualifier
Bundle-Version: 2.8.900.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.207.200,4)",

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 QNX Software Systems and others.
* Copyright (c) 2019, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -42,6 +42,7 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
private Text nameText;
private Combo portCombo;
private Text baudText;
private static final String DEFAULT_BAUD_RATE = "115200"; //$NON-NLS-1$
private class SerialPage extends WizardPage {
public SerialPage() {
@ -55,6 +56,28 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new GridLayout());
String targetName = ""; //$NON-NLS-1$
String serialPort = ""; //$NON-NLS-1$
String[] portNames;
String baudRate = DEFAULT_BAUD_RATE;
ILaunchTarget launchTarget = getLaunchTarget();
try {
portNames = SerialPort.list();
} catch (IOException e) {
GdbUIPlugin.log(e);
portNames = new String[0];
}
if (launchTarget == null) {
if (portNames.length > 0) {
targetName = portNames[0];
serialPort = portNames[0];
}
} else {
targetName = launchTarget.getId();
serialPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV, serialPort);
baudRate = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEV_SPEED, baudRate);
}
// Target name
Group nameGroup = new Group(control, SWT.NONE);
@ -77,14 +100,15 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
nameText.setEnabled(!same);
}
});
sameAsPortname.setSelection(true);
sameAsPortname.setSelection(targetName.equals(serialPort));
Label nameLabel = new Label(nameGroup, SWT.NONE);
nameLabel.setText(LaunchUIMessages.getString("NewGDBRemoteSerialTargetWizard_TargetName")); //$NON-NLS-1$
nameText = new Text(nameGroup, SWT.BORDER);
nameText.setText(targetName);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
nameText.setEnabled(false);
nameText.setEnabled(!targetName.equals(serialPort));
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
@ -105,17 +129,11 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
portCombo = new Combo(connGroup, SWT.NONE);
portCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
try {
String[] portNames = SerialPort.list();
for (String portName : portNames) {
portCombo.add(portName);
}
if (portNames.length > 0) {
portCombo.select(0);
nameText.setText(portCombo.getText());
}
} catch (IOException e) {
GdbUIPlugin.log(e);
for (String portName : portNames) {
portCombo.add(portName);
}
if (portNames.length > 0) {
portCombo.setText(serialPort);
}
portCombo.addModifyListener(new ModifyListener() {
@ -133,7 +151,7 @@ public class NewGdbRemoteSerialTargetWizard extends LaunchTargetWizard {
baudText = new Text(connGroup, SWT.BORDER);
baudText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
baudText.setText("115200"); //$NON-NLS-1$
baudText.setText(baudRate);
baudText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 QNX Software Systems and others.
* Copyright (c) 2019, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -50,6 +50,16 @@ public class NewGdbRemoteTCPTargetWizard extends LaunchTargetWizard {
Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new GridLayout());
String targetName = ""; //$NON-NLS-1$
String targetHostName = ""; //$NON-NLS-1$
String targetPort = ""; //$NON-NLS-1$
ILaunchTarget launchTarget = getLaunchTarget();
if (launchTarget != null) {
targetName = launchTarget.getId();
targetHostName = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, targetHostName);
targetPort = launchTarget.getAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT, targetPort);
}
// Target name
Group nameGroup = new Group(control, SWT.NONE);
@ -72,14 +82,15 @@ public class NewGdbRemoteTCPTargetWizard extends LaunchTargetWizard {
nameText.setEnabled(!same);
}
});
sameAsHostname.setSelection(true);
sameAsHostname.setSelection(targetName.equals(targetHostName));
Label nameLabel = new Label(nameGroup, SWT.NONE);
nameLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.TargetName")); //$NON-NLS-1$
nameText = new Text(nameGroup, SWT.BORDER);
nameText.setText(targetName);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
nameText.setEnabled(false);
nameText.setEnabled(!targetName.equals(targetHostName));
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
@ -98,6 +109,7 @@ public class NewGdbRemoteTCPTargetWizard extends LaunchTargetWizard {
hostLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.HostName")); //$NON-NLS-1$
hostText = new Text(connGroup, SWT.BORDER);
hostText.setText(targetHostName);
hostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
hostText.addModifyListener(new ModifyListener() {
@Override
@ -113,6 +125,8 @@ public class NewGdbRemoteTCPTargetWizard extends LaunchTargetWizard {
portLabel.setText(LaunchUIMessages.getString("NewGdbRemoteTCPTargetWizard.Port")); //$NON-NLS-1$
portText = new Text(connGroup, SWT.BORDER);
portText.setText(targetPort);
portText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.launchbar.core;singleton:=true
Bundle-Version: 3.0.100
Bundle-Version: 3.0.200
Bundle-Activator: org.eclipse.launchbar.core.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.33.0,4)",

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 QNX Software Systems and others.
* Copyright (c) 2016, 2025 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -102,6 +102,7 @@ public class LaunchTargetWorkingCopy extends PlatformObject implements ILaunchTa
target.attributes.remove(key);
}
}
target.attributes.put("name", target.getId()); //$NON-NLS-1$
target.attributes.flush();
return target;
} catch (BackingStoreException e) {