|
31 | 31 | import org.eclipse.core.runtime.preferences.InstanceScope; |
32 | 32 | import org.eclipse.debug.core.ILaunchConfiguration; |
33 | 33 | import org.eclipse.launchbar.core.ILaunchBarManager; |
| 34 | +import org.eclipse.launchbar.core.target.ILaunchTarget; |
34 | 35 | import org.osgi.service.prefs.BackingStoreException; |
35 | 36 |
|
36 | 37 | import com.espressif.idf.core.IDFConstants; |
37 | 38 | import com.espressif.idf.core.IDFCorePlugin; |
38 | 39 | import com.espressif.idf.core.IDFEnvironmentVariables; |
39 | 40 | import com.espressif.idf.core.ProcessBuilderFactory; |
40 | 41 | import com.espressif.idf.core.SystemExecutableFinder; |
| 42 | +import com.espressif.idf.core.build.IDFLaunchConstants; |
41 | 43 | import com.espressif.idf.core.logging.Logger; |
42 | 44 | import com.espressif.idf.core.toolchain.ESPToolChainManager; |
43 | 45 |
|
@@ -337,6 +339,31 @@ public static String getXtensaToolchainExecutablePath(IProject project) |
337 | 339 | } |
338 | 340 | return getXtensaToolchainExecutablePathByTarget(projectEspTarget); |
339 | 341 | } |
| 342 | + |
| 343 | + public static String getXtensaToolchainExePathForActiveTarget() |
| 344 | + { |
| 345 | + ILaunchBarManager launchBarManager = IDFCorePlugin.getService(ILaunchBarManager.class); |
| 346 | + try |
| 347 | + { |
| 348 | + ILaunchTarget launchTarget = launchBarManager.getActiveLaunchTarget(); |
| 349 | + if (launchTarget != null) |
| 350 | + { |
| 351 | + File file = new ESPToolChainManager() |
| 352 | + .findCompiler(launchTarget.getAttribute(IDFLaunchConstants.ATTR_IDF_TARGET, StringUtil.EMPTY)); |
| 353 | + if (file != null) |
| 354 | + { |
| 355 | + return file.getAbsolutePath(); |
| 356 | + } |
| 357 | + |
| 358 | + } |
| 359 | + } |
| 360 | + catch (CoreException e) |
| 361 | + { |
| 362 | + Logger.log(e); |
| 363 | + } |
| 364 | + |
| 365 | + return null; |
| 366 | + } |
340 | 367 |
|
341 | 368 | public static String getXtensaToolchainExecutablePathByTarget(String projectEspTarget) |
342 | 369 | { |
|
0 commit comments