Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorChris Recoskie2010-05-11 18:50:20 -0400
committerChris Recoskie2010-05-11 18:50:20 -0400
commit947eedd5bc0599f5cc39c7646cca25e656169621 (patch)
tree81a4d4d2c0adc5afea2f132034f8fea0cd8f1b7c /build
parenta9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0 (diff)
downloadorg.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.tar.gz
org.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.tar.xz
org.eclipse.cdt-947eedd5bc0599f5cc39c7646cca25e656169621.zip
- Merged changes from cdt_5_0 to HEAD. Too many to mention individually.
- Reworked IFileSystem utility so that now it is noimplement/noextend. Clients should now extend from concrete class FileSystemUtility instead to better insulate them from future API changes. - Reworked the resulting concurrency fixes - indexing and scanner discovery now synchronize on the project root as a scheduling rule. Original HEAD behaviour was to synch on the project's .settings folder for indexing, but that deadlocked with scanner discovery. - Fixed remote indexing. Changes on HEAD that deprecated CodeReader broke the ability for remote translation units to provide the path to load the file content from. Added API to ITranslationUnit for this purpose.
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java45
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java38
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java82
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java58
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties2
7 files changed, 174 insertions, 83 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
index df1a9d2a37..d9ca8d3b44 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig;
@@ -247,11 +248,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
fireUpdate(INFO_CHANGED, info);
if(updateContainer){
-// ICProject cProject = CoreModel.getDefault().create(info.getProject());
-// if (cProject != null) {
-// CoreModel.setPathEntryContainer(new ICProject[]{cProject},
-// new DiscoveredPathContainer(info.getProject()), null);
-// }
+
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
String profileId = buildInfo.getSelectedProfileId();
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
@@ -265,6 +262,44 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
}
}
}
+
+ /**
+ * Allows one to update the discovered information for a particular scanner discovery profile ID.
+ * TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from.
+ *
+ * @param context
+ * @param info
+ * @param updateContainer
+ * @param changedResources
+ * @param profileId
+ * @throws CoreException
+ */
+ public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List<IResource> changedResources, String profileId) throws CoreException {
+ DiscoveredInfoHolder holder = getHolder(info.getProject(), true);
+ IDiscoveredPathInfo oldInfo = holder.getInfo(context);
+ if (oldInfo != null) {
+ IDiscoveredScannerInfoSerializable serializable = info.getSerializable();
+ if (serializable != null) {
+ holder.setInfo(context, info);
+ IProject project = info.getProject();
+ DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable);
+ fireUpdate(INFO_CHANGED, info);
+
+ if(updateContainer){
+
+ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+
+ ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
+ getSCProfileConfiguration(profileId).getProfileScope();
+ changeDiscoveredContainer(project, profileScope, changedResources);
+ }
+ }
+ else {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,
+ MakeMessages.getString("DiscoveredPathManager.Info_Not_Serializable"), null)); //$NON-NLS-1$
+ }
+ }
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 1210a94d4d..5174c9d274 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,25 +34,25 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class CCommandDSC {
- private final static String SINGLE_SPACE = " "; //$NON-NLS-1$
- private final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
- private final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
- private final static String OPTION_ELEM = "option"; //$NON-NLS-1$
- private final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
- private final static String KEY_ATTR = "key"; //$NON-NLS-1$
- private final static String VALUE_ATTR = "value"; //$NON-NLS-1$
- private final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
- private final static String KIND_ATTR = "kind"; //$NON-NLS-1$
+ protected final static String SINGLE_SPACE = " "; //$NON-NLS-1$
+ protected final static String CMD_DESCRIPTION_ELEM = "commandDescription"; //$NON-NLS-1$
+ protected final static String CMD_SI_ELEM = "commandScannerInfo"; //$NON-NLS-1$
+ protected final static String OPTION_ELEM = "option"; //$NON-NLS-1$
+ protected final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
+ protected final static String KEY_ATTR = "key"; //$NON-NLS-1$
+ protected final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ protected final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
+ protected final static String KIND_ATTR = "kind"; //$NON-NLS-1$
- private int commandId;
- private List<KVStringPair> compilerCommand; // members are KVStringPair objects
- private boolean discovered;
- private boolean cppFileType; // C or C++ file type
- private IProject project;
+ protected int commandId;
+ protected List<KVStringPair> compilerCommand; // members are KVStringPair objects
+ protected boolean discovered;
+ protected boolean cppFileType; // C or C++ file type
+ protected IProject project;
- private List<String> symbols;
- private List<String> includes;
- private List<String> quoteIncludes;
+ protected List<String> symbols;
+ protected List<String> includes;
+ protected List<String> quoteIncludes;
public CCommandDSC(boolean cppFileType) {
this(cppFileType, null);
@@ -394,7 +394,7 @@ public class CCommandDSC {
return path;
}
- private static IResource findResource(IProject project, IPath path) {
+ protected static IResource findResource(IProject project, IPath path) {
IResource resource = project.findMember(path, false);
if (resource == null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index bde4988df1..61ee97fa0f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -60,15 +60,15 @@ import org.w3c.dom.NodeList;
* @author vhirsl
*/
public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner {
- private static final int INCLUDE_PATH = 1;
- private static final int QUOTE_INCLUDE_PATH = 2;
- private static final int INCLUDE_FILE = 3;
- private static final int MACROS_FILE = 4;
+ protected static final int INCLUDE_PATH = 1;
+ protected static final int QUOTE_INCLUDE_PATH = 2;
+ protected static final int INCLUDE_FILE = 3;
+ protected static final int MACROS_FILE = 4;
- private class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
- private final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
- private final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
- private final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
+ protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable {
+ protected final Map<Integer, Set<IFile>> commandIdToFilesMap; // command id and set of files it applies to
+ protected final Map<IFile, Integer> fileToCommandIdMap; // maps each file to the corresponding command id
+ protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
public ScannerInfoData() {
commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command]
@@ -150,7 +150,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
- private static class ProjectScannerInfo {
+ protected static class ProjectScannerInfo {
IPath[] includePaths;
IPath[] quoteIncludePaths;
IPath[] includeFiles;
@@ -166,28 +166,28 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$
- private static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
- private static final String ID_ATTR = "id"; //$NON-NLS-1$
- private static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
- private static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
- private static final String FILE_ELEM = "file"; //$NON-NLS-1$
- private static final String PATH_ATTR = "path"; //$NON-NLS-1$
+ protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$
+ protected static final String ID_ATTR = "id"; //$NON-NLS-1$
+ protected static final String FILE_TYPE_ATTR = "fileType"; //$NON-NLS-1$
+ protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$
+ protected static final String FILE_ELEM = "file"; //$NON-NLS-1$
+ protected static final String PATH_ATTR = "path"; //$NON-NLS-1$
- private IProject project;
- private InfoContext context;
+ protected IProject project;
+ protected InfoContext context;
- private ScannerInfoData sid; // scanner info data
- private ProjectScannerInfo psi = null; // sum of all scanner info
+ protected ScannerInfoData sid; // scanner info data
+ protected ProjectScannerInfo psi = null; // sum of all scanner info
-// private List siChangedForFileList; // list of files for which scanner info has changed
- private final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
- private final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
+// protected List siChangedForFileList; // list of files for which scanner info has changed
+ protected final Map<IFile, Integer> siChangedForFileMap; // (file, comandId) map for deltas
+ protected final List<Integer> siChangedForCommandIdList; // list of command ids for which scanner info has changed
- private final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
- private int commandIdCounter = 0;
+ protected final SortedSet<Integer> freeCommandIdPool; // sorted set of free command ids
+ protected int commandIdCounter = 0;
/** monitor for data access */
- private final Object fLock = new Object();
+ protected final Object fLock = new Object();
/**
*
@@ -277,7 +277,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
+ protected void addScannerInfo(Integer commandId, Map<ScannerInfoTypes, List<String>> scannerInfo) {
assert Thread.holdsLock(fLock);
CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
if (cmd != null) {
@@ -296,7 +296,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addCompilerCommand(IFile file, CCommandDSC cmd) {
+ protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values());
int index = existingCommands.indexOf(cmd);
@@ -320,7 +320,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
generateFileDelta(file, cmd);
}
- private void generateFileDelta(IFile file, CCommandDSC cmd) {
+ protected void generateFileDelta(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock);
Integer commandId = cmd.getCommandIdAsInteger();
Integer oldCommandId = sid.fileToCommandIdMap.get(file);
@@ -335,7 +335,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void applyFileDeltas() {
+ protected void applyFileDeltas() {
assert Thread.holdsLock(fLock);
Set<IFile> resources = siChangedForFileMap.keySet();
for (IFile file : resources) {
@@ -381,7 +381,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
generateProjectScannerInfo();
}
- private void generateProjectScannerInfo() {
+ protected void generateProjectScannerInfo() {
assert Thread.holdsLock(fLock);
psi = new ProjectScannerInfo();
psi.includePaths = getAllIncludePaths(INCLUDE_PATH);
@@ -391,7 +391,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
psi.definedSymbols = getAllSymbols();
}
- private void removeUnusedCommands() {
+ protected void removeUnusedCommands() {
assert Thread.holdsLock(fLock);
Set<Entry<Integer, Set<IFile>>> entrySet = sid.commandIdToFilesMap.entrySet();
for (Entry<Integer, Set<IFile>> entry : entrySet) {
@@ -417,7 +417,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
+ protected void addScannerInfo(ScannerInfoTypes type, List<CCommandDSC> delta) {
// TODO Auto-generated method stub
}
@@ -467,7 +467,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return new PerFileDiscoveredPathInfo();
}
- private boolean scannerInfoChanged() {
+ protected boolean scannerInfoChanged() {
assert Thread.holdsLock(fLock);
// return !siChangedForFileList.isEmpty();
return !siChangedForFileMap.isEmpty();
@@ -597,7 +597,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
*
* @author vhirsl
*/
- private class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
+ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
*/
@@ -772,7 +772,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
- private Map<IResource, PathInfo> calculatePathInfoMap(){
+ protected Map<IResource, PathInfo> calculatePathInfoMap(){
assert Thread.holdsLock(fLock);
Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1);
@@ -800,7 +800,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return map;
}
- private static PathInfo createFilePathInfo(CCommandDSC cmd){
+ protected static PathInfo createFilePathInfo(CCommandDSC cmd){
IPath[] includes = stringListToPathArray(cmd.getIncludes());
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
@@ -816,7 +816,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
}
- private CCommandDSC getCommand(IPath path) {
+ protected CCommandDSC getCommand(IPath path) {
try {
IFile file = project.getWorkspace().getRoot().getFile(path);
return getCommand(file);
@@ -826,7 +826,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
}
}
- private CCommandDSC getCommand(IFile file) {
+ protected CCommandDSC getCommand(IFile file) {
CCommandDSC cmd = null;
if (file != null) {
Integer cmdId = sid.fileToCommandIdMap.get(file);
@@ -847,7 +847,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
*
* @return list of IPath(s).
*/
- private IPath[] getAllIncludePaths(int type) {
+ protected IPath[] getAllIncludePaths(int type) {
List<String> allIncludes = new ArrayList<String>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
for (Integer cmdId : cmdIds) {
@@ -884,7 +884,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return stringListToPathArray(allIncludes);
}
- private static IPath[] stringListToPathArray(List<String> discovered) {
+ protected static IPath[] stringListToPathArray(List<String> discovered) {
List<Path> allIncludes = new ArrayList<Path>(discovered.size());
for (String include : discovered) {
if (!allIncludes.contains(include)) {
@@ -894,7 +894,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
return allIncludes.toArray(new IPath[allIncludes.size()]);
}
- private Map<String, String> getAllSymbols() {
+ protected Map<String, String> getAllSymbols() {
assert Thread.holdsLock(fLock);
Map<String, String> symbols = new HashMap<String, String>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
index 21a9d6bf69..8f624530cc 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig2;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -44,6 +45,10 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -280,8 +285,27 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
newPersistedIncludes.put(include, persistedIncludes.get(include));
}
else {
- newPersistedIncludes.put(include,
- ((new Path(include)).toFile().exists()) ? Boolean.FALSE : Boolean.TRUE);
+ // the paths may be on EFS resources, not local
+ Boolean includePathExists = true;
+ URI projectLocationURI = discPathInfo.getProject().getLocationURI();
+
+ // use the project's location... create a URI that uses the same provider but that points to the include path
+ URI includeURI = FileSystemUtilityManager.getDefault().replacePath(projectLocationURI, include);
+
+ // ask EFS if the path exists
+ try {
+ IFileStore fileStore = EFS.getStore(includeURI);
+ IFileInfo info = fileStore.fetchInfo();
+ if(!info.exists()) {
+ includePathExists = false;
+ }
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
+
+ // if the include path doesn't exist, then we tell the scanner config system that the folder
+ // has been "removed", and thus it won't show up in the UI
+ newPersistedIncludes.put(include, !includePathExists);
}
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
index 0750897a3b..356bc1ab26 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigBuilder.java
@@ -199,7 +199,9 @@ public class ScannerConfigBuilder extends ACBuilder {
// update and persist scanner configuration
CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30));
- CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
+ // this erroneously removes the infor right after it gets created... bad
+ //CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
+
if((flags & PERFORM_CORE_UPDATE) != 0)
CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg});
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
index 15295bbf6f..cd32ab4447 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Intel Corporation and others.
+ * Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.build.internal.core.scannerconfig;
@@ -59,6 +60,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
public class CfgDiscoveredPathManager implements IResourceChangeListener {
@@ -67,6 +69,39 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
private IDiscoveredPathManager fBaseMngr;
+
+ private class GetDiscoveredInfoRunnable implements IWorkspaceRunnable {
+
+ private PathInfo fPathInfo;
+ private ContextInfo fContextInfo;
+ private IProject fProject;
+ private CfgInfoContext fContext;
+
+ public GetDiscoveredInfoRunnable(ContextInfo cInfo, IProject project, CfgInfoContext context) {
+ fContextInfo = cInfo;
+ fProject = project;
+ fContext = context;
+ }
+
+ public void run(IProgressMonitor monitor) throws CoreException {
+
+ fPathInfo = getCachedPathInfo(fContextInfo);
+
+ if(fPathInfo == null){
+ IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(fProject, fContext.getConfiguration(), fContextInfo);
+
+ fPathInfo = resolveCacheBaseDiscoveredInfo(fContextInfo, baseInfo);
+ }
+
+ }
+
+ public PathInfo getPathInfo() {
+ return fPathInfo;
+ }
+
+ };
+
+
private static class ContextInfo {
public ContextInfo() {
@@ -161,21 +196,16 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
PathInfo info = getCachedPathInfo(cInfo);
if (info == null) {
- synchronized (this) {
- info = getCachedPathInfo(cInfo);
+ // Change synchronization to be a lock on the project, otherwise
+ // if the project description is queried from a project change listener, it will deadlock
+
+ GetDiscoveredInfoRunnable runnable = new GetDiscoveredInfoRunnable(cInfo, project, context);
+ ISchedulingRule rule = project;
- if(info == null){
- IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(project, context.getConfiguration(), cInfo);
-
- info = resolveCacheBaseDiscoveredInfo(cInfo, baseInfo);
- }
- }
+ ResourcesPlugin.getWorkspace().run(runnable, rule, IWorkspace.AVOID_UPDATE, null);
+
+ info = runnable.getPathInfo();
-// setCachedPathInfo(context, info);
-// if(info instanceof DiscoveredPathInfo && !((DiscoveredPathInfo)info).isLoadded()){
-// info = createPathInfo(project, context);
-// setCachedPathInfo(context, info);
-// }
}
return info;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index f08762cb4d..cb4ff40b0b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2002, 2007 Rational Software Corporation and others.
+# Copyright (c) 2002, 2010 Rational Software Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at

Back to the top