diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java index e3c90e9cfa4..8f9938389c6 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java @@ -787,21 +787,13 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang if (project != null) { ICProject cproject = create(project); if (cproject != null) { - // Let the function remove the children - // but it has the side of effect of removing the CProject also - // so we have to recall create again. - try { - cproject.close(); - } catch (CModelException e) { - CCorePlugin.log(e); + if (binaryParsersMap.remove(project) != null) { + // Fired and ICElementDelta.PARSER_CHANGED + CElementDelta delta = new CElementDelta(getCModel()); + delta.binaryParserChanged(cproject); + registerCModelDelta(delta); + fire(ElementChangedEvent.POST_CHANGE); } - binaryParsersMap.remove(project); - - // Fired and ICElementDelta.PARSER_CHANGED - CElementDelta delta = new CElementDelta(getCModel()); - delta.binaryParserChanged(cproject); - registerCModelDelta(delta); - fire(ElementChangedEvent.POST_CHANGE); } } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java index ff4d69aad60..148f4d5bac6 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java @@ -48,6 +48,8 @@ import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IncludeExportPatterns; import org.eclipse.cdt.core.resources.IConsole; +import org.eclipse.cdt.internal.core.model.BinaryRunner; +import org.eclipse.cdt.internal.core.model.CModelManager; import org.eclipse.cdt.internal.core.parser.ParserSettings2; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IBuildConfiguration; @@ -246,6 +248,20 @@ public abstract class CBuildConfiguration extends PlatformObject outputs.add(binary); } } + + if (outputs.isEmpty()) { + // Give the binary runner a kick and try again. + BinaryRunner runner = CModelManager.getDefault().getBinaryRunner(cproject); + runner.start(); + runner.waitIfRunning(); + + for (IBinary binary : binaries.getBinaries()) { + if (binary.isExecutable() && outputPath.isPrefixOf(binary.getPath())) { + outputs.add(binary); + } + } + } + return outputs.toArray(new IBinary[outputs.size()]); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java index ebe71c5b998..3a492c7b870 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java @@ -161,6 +161,9 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager, synchronized (configs) { configs.put(buildConfig, cConfig); } + + // reset the binary parsers + CModelManager.getDefault().resetBinaryParser(buildConfig.getProject()); } @Override @@ -193,7 +196,8 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager, config = provider.getCBuildConfiguration(buildConfig, configName); if (config != null) { configs.put(buildConfig, config); - // Also make sure we reset the binary parser cache for the new config + // Also make sure we reset the binary parser cache + // for the new config resetBinaryParser = true; } }