|
11 | 11 | import org.eclipse.cdt.core.envvar.IContributedEnvironment;
|
12 | 12 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
13 | 13 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
| 14 | +import org.eclipse.cdt.core.model.CoreModel; |
14 | 15 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
15 | 16 | import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
16 | 17 | import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
@@ -203,7 +204,6 @@ public void run(IProgressMonitor internalMonitor) throws CoreException {
|
203 | 204 | return root.getProject(realProjectName);
|
204 | 205 | }
|
205 | 206 |
|
206 |
| - |
207 | 207 | @SuppressWarnings("nls")
|
208 | 208 | private HashMap<String, String> getEnvVars(ICConfigurationDescription confDesc) {
|
209 | 209 | IProject project = confDesc.getProjectDescription().getProject();
|
@@ -237,10 +237,8 @@ private HashMap<String, String> getEnvVars(ICConfigurationDescription confDesc)
|
237 | 237 | + pathDelimiter + systemroot + pathDelimiter + systemroot + "\\system32\\Wbem"
|
238 | 238 | + pathDelimiter + makeEnvironmentVar("sloeber_path_extension"));
|
239 | 239 | } else {
|
240 |
| - allVars.put("PATH", |
241 |
| - makeEnvironmentVar(ENV_KEY_COMPILER_PATH) + pathDelimiter |
242 |
| - + makeEnvironmentVar(ENV_KEY_BUILD_GENERIC_PATH) + pathDelimiter |
243 |
| - + makeEnvironmentVar("PATH")); |
| 240 | + allVars.put("PATH", makeEnvironmentVar(ENV_KEY_COMPILER_PATH) + pathDelimiter |
| 241 | + + makeEnvironmentVar(ENV_KEY_BUILD_GENERIC_PATH) + pathDelimiter + makeEnvironmentVar("PATH")); |
244 | 242 | }
|
245 | 243 |
|
246 | 244 | // Set the codeAnalyzer compile commands
|
@@ -477,7 +475,6 @@ private static void setEnvVars(ICConfigurationDescription confDesc, Map<String,
|
477 | 475 | }
|
478 | 476 | }
|
479 | 477 |
|
480 |
| - |
481 | 478 | /**
|
482 | 479 | * get the Arduino project description based on a project description
|
483 | 480 | *
|
@@ -548,43 +545,55 @@ public void setOtherDescription(ICConfigurationDescription confDesc, OtherDescri
|
548 | 545 | */
|
549 | 546 | public BoardDescription getBoardDescription(ICConfigurationDescription confDesc, boolean allowNull) {
|
550 | 547 | if (!allowNull) {
|
551 |
| - configureProject(); |
| 548 | + configureProject(); |
552 | 549 | }
|
553 | 550 | return myBoardDescriptions.get(confDesc.getId());
|
554 | 551 | }
|
555 | 552 |
|
556 | 553 | public CompileDescription getCompileDescription(ICConfigurationDescription confDesc, boolean allowNull) {
|
557 | 554 | if (!allowNull) {
|
558 |
| - configureProject(); |
| 555 | + configureProject(); |
559 | 556 | }
|
560 | 557 | return myCompileDescriptions.get(confDesc.getId());
|
561 | 558 | }
|
562 | 559 |
|
563 |
| - |
564 | 560 | public OtherDescription getOtherDescription(ICConfigurationDescription confDesc, boolean allowNull) {
|
565 | 561 | if (!allowNull) {
|
566 |
| - configureProject(); |
| 562 | + configureProject(); |
567 | 563 | }
|
568 | 564 | return myOtherDescriptions.get(confDesc.getId());
|
569 | 565 | }
|
570 | 566 |
|
571 |
| - public String getDecoratedText(ICConfigurationDescription confDesc, String text) { |
572 |
| - // do not use getBoardDescriptor below as this will cause a infinite loop at |
573 |
| - // project creation |
574 |
| - BoardDescription boardDescriptor = myBoardDescriptions.get(confDesc.getId()); |
575 |
| - if (boardDescriptor == null) { |
576 |
| - return text + " Project not configured"; //$NON-NLS-1$ |
577 |
| - } |
578 |
| - String boardName = boardDescriptor.getBoardName(); |
579 |
| - String portName = boardDescriptor.getActualUploadPort(); |
580 |
| - if (portName.isEmpty()) { |
581 |
| - portName = Messages.decorator_no_port; |
582 |
| - } |
583 |
| - if (boardName.isEmpty()) { |
584 |
| - boardName = Messages.decorator_no_platform; |
585 |
| - } |
586 |
| - return text + ' ' + boardName + ' ' + ':' + portName; |
| 567 | + /** |
| 568 | + * get the text for the decorator |
| 569 | + * |
| 570 | + * @param text |
| 571 | + * @return |
| 572 | + */ |
| 573 | + public String getDecoratedText(String text) { |
| 574 | + ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(myProject); |
| 575 | + if (prjDesc != null) { |
| 576 | + ICConfigurationDescription confDesc = prjDesc.getActiveConfiguration(); |
| 577 | + if (confDesc != null) { |
| 578 | + // do not use getBoardDescriptor below as this will cause a infinite loop at |
| 579 | + // project creation |
| 580 | + BoardDescription boardDescriptor = myBoardDescriptions.get(confDesc.getId()); |
| 581 | + if (boardDescriptor == null) { |
| 582 | + return text + " Project not configured"; //$NON-NLS-1$ |
| 583 | + } |
| 584 | + String boardName = boardDescriptor.getBoardName(); |
| 585 | + String portName = boardDescriptor.getActualUploadPort(); |
| 586 | + if (portName.isEmpty()) { |
| 587 | + portName = Messages.decorator_no_port; |
| 588 | + } |
| 589 | + if (boardName.isEmpty()) { |
| 590 | + boardName = Messages.decorator_no_platform; |
| 591 | + } |
587 | 592 |
|
| 593 | + return text + ' ' + boardName + ' ' + ':' + portName; |
| 594 | + } |
| 595 | + } |
| 596 | + return text; |
588 | 597 | }
|
589 | 598 |
|
590 | 599 | private static String getBoardPrefix(ICConfigurationDescription confDesc) {
|
|
0 commit comments