Skip to content

Commit 8c45066

Browse files
authored
IEP-1311 Ensure that the our runActionHandler only works on our configurations (#1034)
* fix: ensure runActionHandler to execute only on our configs * fix: fixing empty execution with no project configs
1 parent 8718d5d commit 8c45066

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/RunActionHandler.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,23 @@ public Object execute(ExecutionEvent event) throws ExecutionException
4848
{
4949
ILaunchBarManager launchBarManager = UIPlugin.getService(ILaunchBarManager.class);
5050
new StopLaunchBuildHandler().stop();
51+
5152
ILaunchConfiguration config = launchBarManager.getActiveLaunchConfiguration();
5253
if (config == null)
5354
{
5455
return Status.OK_STATUS;
5556
}
5657

58+
boolean isEspLaunchConfig = config.getType().getIdentifier()
59+
.contentEquals(IDFLaunchConstants.RUN_LAUNCH_CONFIG_TYPE);
60+
boolean isEspDebugConfig = config.getType().getIdentifier()
61+
.contentEquals(IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE);
62+
63+
if (!isEspLaunchConfig && !isEspDebugConfig)
64+
{
65+
return super.execute(event);
66+
}
67+
5768
ILaunchMode launchMode = launchBarManager.getActiveLaunchMode();
5869
if (launchMode == null)
5970
{
@@ -74,8 +85,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException
7485
}
7586
return Status.CANCEL_STATUS;
7687
}
77-
if (launchMode.getIdentifier().equals(ILaunchManager.DEBUG_MODE)
78-
&& config.getType().getIdentifier().contentEquals(IDFLaunchConstants.RUN_LAUNCH_CONFIG_TYPE))
88+
if (launchMode.getIdentifier().equals(ILaunchManager.DEBUG_MODE) && isEspLaunchConfig)
7989
{
8090
List<String> suitableDescNames = findSuitableDescNames(projectName,
8191
IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE);
@@ -86,8 +96,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException
8696
}
8797
returnCode = runActionBasedOnDescCount(launchBarManager, suitableDescNames);
8898
}
89-
else if (launchMode.getIdentifier().equals(ILaunchManager.RUN_MODE)
90-
&& config.getType().getIdentifier().contentEquals(IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE))
99+
else if (launchMode.getIdentifier().equals(ILaunchManager.RUN_MODE) && isEspDebugConfig)
91100
{
92101
List<String> suitableDescNames = findSuitableDescNames(projectName,
93102
IDFLaunchConstants.RUN_LAUNCH_CONFIG_TYPE);

0 commit comments

Comments
 (0)