From d70521fcf848c714bee4c0656f549ea3afa1cac7 Mon Sep 17 00:00:00 2001 From: John Dallaway Date: Sun, 16 Feb 2020 11:34:44 +0000 Subject: [PATCH] Bug 560186: Sort JTAG device list Change-Id: Ieff78b4b527418ff2e4e06c8f3850605e397f619 --- .../.settings/.api_filters | 11 +++++++++++ .../debug/gdbjtag/core/IGDBJtagConstants.java | 5 +++-- .../META-INF/MANIFEST.MF | 2 +- .../debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java | 17 +++++++++++------ 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters new file mode 100644 index 00000000000..4b5a8592252 --- /dev/null +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/.settings/.api_filters @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java index 1e9f5ed1c35..5d947efd894 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.core/src/org/eclipse/cdt/debug/gdbjtag/core/IGDBJtagConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 - 2018 QNX Software Systems and others. + * Copyright (c) 2007 - 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,6 +13,7 @@ * Andy Jin - Hardware debugging UI improvements, bug 229946 * John Dallaway - Disable reset and halt by default, bug 529171 * Torbjörn Svensson (STMicroelectronics) - Bug 535024 + * John Dallaway - Sort JTAG device list, bug 560186 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.core; @@ -101,7 +102,7 @@ public interface IGDBJtagConstants { /** @since 7.0 */ public static final String DEFAULT_STOP_AT = ""; //$NON-NLS-1$ /** @since 9.2 */ - public static final String DEFAULT_JTAG_DEVICE_ID = ""; //$NON-NLS-1$ + public static final String DEFAULT_JTAG_DEVICE_ID = "org.eclipse.cdt.debug.gdbjtag.core.jtagdevice.genericDevice"; //$NON-NLS-1$ /** @since 9.2 */ public static final String DEFAULT_JTAG_DEVICE_NAME = ""; //$NON-NLS-1$ /** diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF index f1d3e5f4492..d8fc6c7e863 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.debug.gdbjtag.ui;singleton:=true -Bundle-Version: 8.1.100.qualifier +Bundle-Version: 8.1.200.qualifier Bundle-Activator: org.eclipse.cdt.debug.gdbjtag.ui.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, diff --git a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java index c2913f739df..40efd5e8d54 100644 --- a/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java +++ b/jtag/org.eclipse.cdt.debug.gdbjtag.ui/src/org/eclipse/cdt/debug/gdbjtag/ui/GDBJtagDSFDebuggerTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 QNX Software Systems and others. + * Copyright (c) 2007, 2020 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -20,6 +20,7 @@ * allow connections via serial ports and pipes). * John Dallaway - Ensure correct SessionType enabled, bug 334110 * Torbjörn Svensson (STMicroelectronics) - Bug 535024 + * John Dallaway - Sort JTAG device list, bug 560186 *******************************************************************************/ package org.eclipse.cdt.debug.gdbjtag.ui; @@ -27,6 +28,7 @@ package org.eclipse.cdt.debug.gdbjtag.ui; import java.io.File; import java.net.URI; import java.net.URISyntaxException; +import java.util.Arrays; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.gdbjtag.core.Activator; @@ -256,9 +258,8 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance() .getGDBJtagDeviceContribution(); - for (int i = 0; i < availableDevices.length; i++) { - jtagDevice.add(availableDevices[i].getDeviceName()); - } + Arrays.stream(availableDevices).map(GDBJtagDeviceContribution::getDeviceName).sorted() + .forEach(name -> jtagDevice.add(name)); jtagDevice.addModifyListener(new ModifyListener() { @Override @@ -564,8 +565,11 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { } else { String ip = ipAddress.getText().trim(); configuration.setAttribute(IGDBJtagConstants.ATTR_IP_ADDRESS, ip); - int port = Integer.valueOf(portNumber.getText().trim()).intValue(); - configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port); + String port = portNumber.getText().trim(); + if (!port.isEmpty()) { + configuration.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, + Integer.valueOf(port).intValue()); + } } } catch (URISyntaxException e) { Activator.log(e); @@ -589,6 +593,7 @@ public class GDBJtagDSFDebuggerTab extends AbstractLaunchConfigurationTab { configuration.setAttribute(IGDBJtagConstants.ATTR_USE_REMOTE_TARGET, IGDBJtagConstants.DEFAULT_USE_REMOTE_TARGET); + configuration.setAttribute(IGDBJtagConstants.ATTR_JTAG_DEVICE_ID, IGDBJtagConstants.DEFAULT_JTAG_DEVICE_ID); configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,