1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Bug in the PathEntyrManager, the container

entries where not resolved.
This commit is contained in:
Alain Magloire 2004-05-07 18:24:06 +00:00
parent 83ff50fe27
commit 003e8f5546
3 changed files with 51 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2004-05-07 Alain Magloire
Bug in the PathEntyrManager, the container
entries where not resolved.
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
* model/org/eclipse/cdt/internal/core/model/PathEntryStore.java
2004-04-04 Alain Magloire 2004-04-04 Alain Magloire
Race condition causing deadlocks fix. Race condition causing deadlocks fix.

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.cdt.core.model.ILibraryEntry; import org.eclipse.cdt.core.model.ILibraryEntry;
import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IMacroEntry;
import org.eclipse.cdt.core.model.IOutputEntry;
import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer; import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.model.IProjectEntry; import org.eclipse.cdt.core.model.IProjectEntry;
@ -103,7 +104,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
IPathEntry[] containerEntries = container.getPathEntries(); IPathEntry[] containerEntries = container.getPathEntries();
if (containerEntries != null) { if (containerEntries != null) {
for (int j = 0; j < containerEntries.length; j++) { for (int j = 0; j < containerEntries.length; j++) {
list.add(containerEntries[j]); IPathEntry newEntry = cloneEntry(cproject.getPath(), containerEntries[j]);
list.add(newEntry);
} }
} }
} }
@ -481,7 +483,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
return null; return null;
} }
public IPathEntryContainer containerGet(ICProject project, IPath containerPath) { public synchronized IPathEntryContainer containerGet(ICProject project, IPath containerPath) {
Map projectContainers = (Map) Containers.get(project); Map projectContainers = (Map) Containers.get(project);
if (projectContainers == null) { if (projectContainers == null) {
projectContainers = new HashMap(); projectContainers = new HashMap();
@ -491,7 +493,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
return container; return container;
} }
public void containerPut(ICProject project, IPath containerPath, IPathEntryContainer container) { public synchronized void containerPut(ICProject project, IPath containerPath, IPathEntryContainer container) {
Map projectContainers = (Map) Containers.get(project); Map projectContainers = (Map) Containers.get(project);
if (projectContainers == null) { if (projectContainers == null) {
projectContainers = new HashMap(); projectContainers = new HashMap();
@ -760,4 +762,42 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
processDelta(affectedChildren[i]); processDelta(affectedChildren[i]);
} }
} }
protected IPathEntry cloneEntry(IPath rpath, IPathEntry entry) {
IPath entryPath = entry.getPath();
IPath resourcePath = (entryPath == null || entryPath.isEmpty()) ? rpath : entryPath;
switch(entry.getEntryKind()) {
case IPathEntry.CDT_INCLUDE: {
IIncludeEntry include = (IIncludeEntry)entry;
return CoreModel.newIncludeEntry(resourcePath, include.getBasePath(), include.getIncludePath(),
include.isSystemInclude(), include.getExclusionPatterns(), include.isExported());
}
case IPathEntry.CDT_LIBRARY: {
ILibraryEntry library = (ILibraryEntry)entry;
return CoreModel.newLibraryEntry(resourcePath, library.getBasePath(), library.getLibraryPath(),
library.getSourceAttachmentPath(), library.getSourceAttachmentRootPath(),
library.getSourceAttachmentPrefixMapping(), library.isExported());
}
case IPathEntry.CDT_MACRO: {
IMacroEntry macro = (IMacroEntry)entry;
return CoreModel.newMacroEntry(resourcePath, macro.getMacroName(), macro.getMacroValue(),
macro.getExclusionPatterns(), macro.isExported());
}
case IPathEntry.CDT_OUTPUT: {
IOutputEntry out = (IOutputEntry)entry;
return CoreModel.newOutputEntry(out.getPath(), out.getExclusionPatterns());
}
case IPathEntry.CDT_PROJECT: {
IProjectEntry projEntry = (IProjectEntry)entry;
return CoreModel.newProjectEntry(projEntry.getPath(), projEntry.isExported());
}
case IPathEntry.CDT_SOURCE: {
ISourceEntry source = (ISourceEntry)entry;
return CoreModel.newSourceEntry(source.getPath(), source.getExclusionPatterns());
}
case IPathEntry.CDT_CONTAINER:
default:
return CoreModel.newContainerEntry(entry.getPath(), entry.isExported());
}
}
} }

View file

@ -146,7 +146,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
// exclusion patterns (optional) // exclusion patterns (optional)
String exclusion = element.getAttribute(ATTRIBUTE_EXCLUDING); String exclusion = element.getAttribute(ATTRIBUTE_EXCLUDING);
IPath[] exclusionPatterns = APathEntry.NO_EXCLUSION_PATTERNS; IPath[] exclusionPatterns = APathEntry.NO_EXCLUSION_PATTERNS;
if (!exclusion.equals("")) { //$NON-NLS-1$ if (exclusion != null && exclusion.length() > 0) {
char[][] patterns = CharOperation.splitOn('|', exclusion.toCharArray()); char[][] patterns = CharOperation.splitOn('|', exclusion.toCharArray());
int patternCount; int patternCount;
if ((patternCount = patterns.length) > 0) { if ((patternCount = patterns.length) > 0) {