|
85 | 85 |
|
86 | 86 | @SuppressWarnings("restriction") |
87 | 87 | public class CMakeMainTab2 extends GenericMainTab { |
| 88 | + private static final String LAUNCH_TARGET_NAME_ATTR = "com.espressif.idf.launch.serial.core.idfTarget"; //$NON-NLS-1$ |
88 | 89 | private static final int JOB_DELAY_MS = 100; |
89 | 90 | private static final String EMPTY_CONFIG_OPTIONS = "%s" + File.separator + "%s -s %s"; //$NON-NLS-1$ //$NON-NLS-2$ |
90 | 91 | private Combo flashOverComboButton; |
@@ -742,7 +743,7 @@ private ILaunchTarget findSuitableTargetForSelectedItem(String selectedItem) { |
742 | 743 | ILaunchTarget suitableTarget = null; |
743 | 744 |
|
744 | 745 | for (ILaunchTarget target : targets) { |
745 | | - String idfTarget = target.getAttribute("com.espressif.idf.launch.serial.core.idfTarget", null); //$NON-NLS-1$ |
| 746 | + String idfTarget = target.getAttribute(LAUNCH_TARGET_NAME_ATTR, null); |
746 | 747 | String targetSerialPort = target.getAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, |
747 | 748 | StringUtil.EMPTY); |
748 | 749 | if (idfTarget.contentEquals(selectedItem)) { |
@@ -869,9 +870,10 @@ protected IStatus run(IProgressMonitor monitor) { |
869 | 870 | .getAttribute(IDFLaunchConstants.TARGET_FOR_JTAG, StringUtil.EMPTY); |
870 | 871 | if (!targetName.isEmpty()) { |
871 | 872 | ILaunchTargetManager launchTargetManager = Activator.getService(ILaunchTargetManager.class); |
872 | | - ILaunchTarget selectedTarget = Stream.of(launchTargetManager.getLaunchTargets()) |
873 | | - .filter(target -> target.getId().contentEquals((targetName))).findFirst() |
874 | | - .orElseGet(() -> null); |
| 873 | + ILaunchTarget selectedTarget = Stream |
| 874 | + .of(launchTargetManager.getLaunchTargets()).filter(target -> target |
| 875 | + .getAttribute(LAUNCH_TARGET_NAME_ATTR, StringUtil.EMPTY).equals(targetName)) |
| 876 | + .findFirst().orElseGet(() -> null); |
875 | 877 | launchBarManager.setActiveLaunchTarget(selectedTarget); |
876 | 878 | } |
877 | 879 |
|
|
0 commit comments