mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Provide better scanner-info for files parsed up-front.
This commit is contained in:
parent
95b0b06cd7
commit
a0221e80c5
3 changed files with 231 additions and 220 deletions
|
@ -96,7 +96,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
* pathentry containers pool accessing the Container is done synch with the
|
* pathentry containers pool accessing the Container is done synch with the
|
||||||
* class
|
* class
|
||||||
*/
|
*/
|
||||||
private static HashMap Containers = new HashMap(5);
|
private static HashMap<ICProject, Map<IPath, IPathEntryContainer>> Containers = new HashMap<ICProject, Map<IPath, IPathEntryContainer>>(5);
|
||||||
|
|
||||||
static final IPathEntry[] NO_PATHENTRIES = new IPathEntry[0];
|
static final IPathEntry[] NO_PATHENTRIES = new IPathEntry[0];
|
||||||
|
|
||||||
|
@ -111,12 +111,12 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
static final IPathEntryContainer[] NO_PATHENTRYCONTAINERS = new IPathEntryContainer[0];
|
static final IPathEntryContainer[] NO_PATHENTRYCONTAINERS = new IPathEntryContainer[0];
|
||||||
|
|
||||||
// Synchronized the access of the cache entries.
|
// Synchronized the access of the cache entries.
|
||||||
protected Map resolvedMap = new Hashtable();
|
protected Map<ICProject, ArrayList<IPathEntry>> resolvedMap = new Hashtable<ICProject, ArrayList<IPathEntry>>();
|
||||||
private Map resolvedInfoMap = new Hashtable();
|
private Map<ICProject, PathEntryResolveInfo> resolvedInfoMap = new Hashtable<ICProject, PathEntryResolveInfo>();
|
||||||
private ThreadLocalMap resolveInfoValidState = new ThreadLocalMap();
|
private ThreadLocalMap resolveInfoValidState = new ThreadLocalMap();
|
||||||
|
|
||||||
// Accessing the map is synch with the class
|
// Accessing the map is synch with the class
|
||||||
private Map storeMap = new HashMap();
|
private Map<IProject, IPathEntryStore> storeMap = new HashMap<IProject, IPathEntryStore>();
|
||||||
|
|
||||||
private static PathEntryManager pathEntryManager;
|
private static PathEntryManager pathEntryManager;
|
||||||
private PathEntryManager() {
|
private PathEntryManager() {
|
||||||
|
@ -180,9 +180,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
// get project include file entries
|
// get project include file entries
|
||||||
List entryList = new ArrayList();
|
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
||||||
ICProject cproject = celement.getCProject();
|
ICProject cproject = celement.getCProject();
|
||||||
ArrayList resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
IPathEntry[] pathEntries= getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
IPathEntry[] pathEntries= getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
for (int i = 0; i < pathEntries.length; ++i) {
|
for (int i = 0; i < pathEntries.length; ++i) {
|
||||||
IPathEntry entry = pathEntries[i];
|
IPathEntry entry = pathEntries[i];
|
||||||
|
@ -190,15 +190,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IIncludeFileEntry[] incFiles = (IIncludeFileEntry[]) entryList.toArray(new IIncludeFileEntry[entryList.size()]);
|
IIncludeFileEntry[] incFiles = entryList.toArray(new IIncludeFileEntry[entryList.size()]);
|
||||||
return incFiles;
|
return incFiles;
|
||||||
}
|
}
|
||||||
return NO_INCLUDE_FILE_ENTRIES;
|
return NO_INCLUDE_FILE_ENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIncludeFileEntry[] getIncludeFileEntries(ITranslationUnit cunit) throws CModelException {
|
public IIncludeFileEntry[] getIncludeFileEntries(ITranslationUnit cunit) throws CModelException {
|
||||||
List list = getPathEntries(cunit, IPathEntry.CDT_INCLUDE_FILE);
|
List<IPathEntry> list = getPathEntries(cunit, IPathEntry.CDT_INCLUDE_FILE);
|
||||||
IIncludeFileEntry[] incFiles = (IIncludeFileEntry[]) list.toArray(new IIncludeFileEntry[list.size()]);
|
IIncludeFileEntry[] incFiles = list.toArray(new IIncludeFileEntry[list.size()]);
|
||||||
return incFiles;
|
return incFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,9 +209,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
// get project include entries
|
// get project include entries
|
||||||
List entryList = new ArrayList();
|
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
||||||
ICProject cproject = celement.getCProject();
|
ICProject cproject = celement.getCProject();
|
||||||
ArrayList resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
IPathEntry[] pathEntries= getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
IPathEntry[] pathEntries= getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
for (int i = 0; i < pathEntries.length; ++i) {
|
for (int i = 0; i < pathEntries.length; ++i) {
|
||||||
IPathEntry entry = pathEntries[i];
|
IPathEntry entry = pathEntries[i];
|
||||||
|
@ -219,15 +219,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IIncludeEntry[] includes = (IIncludeEntry[]) entryList.toArray(new IIncludeEntry[entryList.size()]);
|
IIncludeEntry[] includes = entryList.toArray(new IIncludeEntry[entryList.size()]);
|
||||||
return includes;
|
return includes;
|
||||||
}
|
}
|
||||||
return NO_INCLUDE_ENTRIES;
|
return NO_INCLUDE_ENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIncludeEntry[] getIncludeEntries(ITranslationUnit cunit) throws CModelException {
|
public IIncludeEntry[] getIncludeEntries(ITranslationUnit cunit) throws CModelException {
|
||||||
List list = getPathEntries(cunit, IPathEntry.CDT_INCLUDE);
|
List<IPathEntry> list = getPathEntries(cunit, IPathEntry.CDT_INCLUDE);
|
||||||
IIncludeEntry[] includes = (IIncludeEntry[]) list.toArray(new IIncludeEntry[list.size()]);
|
IIncludeEntry[] includes = list.toArray(new IIncludeEntry[list.size()]);
|
||||||
return includes;
|
return includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,17 +236,32 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (celement instanceof ITranslationUnit) {
|
if (celement instanceof ITranslationUnit) {
|
||||||
return getMacroEntries((ITranslationUnit)celement);
|
return getMacroEntries((ITranslationUnit)celement);
|
||||||
}
|
}
|
||||||
|
if (celement != null) {
|
||||||
|
// get project macro entries
|
||||||
|
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
||||||
|
ICProject cproject = celement.getCProject();
|
||||||
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
|
IPathEntry[] pathEntries= getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
|
for (int i = 0; i < pathEntries.length; ++i) {
|
||||||
|
IPathEntry entry = pathEntries[i];
|
||||||
|
if ((entry.getEntryKind() & IPathEntry.CDT_MACRO) != 0) {
|
||||||
|
entryList.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IMacroEntry[] macros= entryList.toArray(new IMacroEntry[entryList.size()]);
|
||||||
|
return macros;
|
||||||
|
}
|
||||||
return NO_MACRO_ENTRIES;
|
return NO_MACRO_ENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMacroEntry[] getMacroEntries(ITranslationUnit cunit) throws CModelException {
|
private IMacroEntry[] getMacroEntries(ITranslationUnit cunit) throws CModelException {
|
||||||
ArrayList macroList = new ArrayList();
|
ArrayList<IPathEntry> macroList = new ArrayList<IPathEntry>();
|
||||||
ICProject cproject = cunit.getCProject();
|
ICProject cproject = cunit.getCProject();
|
||||||
IPath resPath = cunit.getPath();
|
IPath resPath = cunit.getPath();
|
||||||
// Do this first so the containers get inialized.
|
// Do this first so the containers get inialized.
|
||||||
ArrayList resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
for (int i = 0; i < resolvedListEntries.size(); ++i) {
|
for (int i = 0; i < resolvedListEntries.size(); ++i) {
|
||||||
IPathEntry entry = (IPathEntry)resolvedListEntries.get(i);
|
IPathEntry entry = resolvedListEntries.get(i);
|
||||||
if (entry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
if (entry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||||
macroList.add(entry);
|
macroList.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +275,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMacroEntry[] macros = (IMacroEntry[]) macroList.toArray(new IMacroEntry[macroList.size()]);
|
IMacroEntry[] macros = macroList.toArray(new IMacroEntry[macroList.size()]);
|
||||||
macroList.clear();
|
macroList.clear();
|
||||||
|
|
||||||
// For the macros the closest symbol will override
|
// For the macros the closest symbol will override
|
||||||
|
@ -269,15 +284,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
//
|
//
|
||||||
// We will use NDEBUG=1 only
|
// We will use NDEBUG=1 only
|
||||||
int count = resPath.segmentCount();
|
int count = resPath.segmentCount();
|
||||||
Map symbolMap = new HashMap();
|
Map<String, IMacroEntry> symbolMap = new HashMap<String, IMacroEntry>();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
IPath newPath = resPath.removeLastSegments(i);
|
IPath newPath = resPath.removeLastSegments(i);
|
||||||
for (int j = 0; j < macros.length; j++) {
|
for (IMacroEntry macro : macros) {
|
||||||
IPath otherPath = macros[j].getPath();
|
IPath otherPath = macro.getPath();
|
||||||
if (newPath.equals(otherPath)) {
|
if (newPath.equals(otherPath)) {
|
||||||
String key = macros[j].getMacroName();
|
String key = macro.getMacroName();
|
||||||
if (!symbolMap.containsKey(key)) {
|
if (!symbolMap.containsKey(key)) {
|
||||||
symbolMap.put(key, macros[j]);
|
symbolMap.put(key, macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,15 +300,14 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
// Add the Project contributions last.
|
// Add the Project contributions last.
|
||||||
for (int i = 0; i < resolvedListEntries.size(); i++) {
|
for (int i = 0; i < resolvedListEntries.size(); i++) {
|
||||||
IPathEntry entry = (IPathEntry)resolvedListEntries.get(i);
|
IPathEntry entry = resolvedListEntries.get(i);
|
||||||
if (entry != null && entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
if (entry != null && entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
||||||
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(entry.getPath());
|
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(entry.getPath());
|
||||||
if (res != null && res.getType() == IResource.PROJECT) {
|
if (res != null && res.getType() == IResource.PROJECT) {
|
||||||
ICProject refCProject = CoreModel.getDefault().create((IProject)res);
|
ICProject refCProject = CoreModel.getDefault().create((IProject)res);
|
||||||
if (refCProject != null) {
|
if (refCProject != null) {
|
||||||
IPathEntry[] projEntries = refCProject.getResolvedPathEntries();
|
IPathEntry[] projEntries = refCProject.getResolvedPathEntries();
|
||||||
for (int j = 0; j < projEntries.length; j++) {
|
for (IPathEntry projEntry : projEntries) {
|
||||||
IPathEntry projEntry = projEntries[j];
|
|
||||||
if (projEntry.isExported()) {
|
if (projEntry.isExported()) {
|
||||||
if (projEntry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
if (projEntry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||||
IMacroEntry macro = (IMacroEntry)entry;
|
IMacroEntry macro = (IMacroEntry)entry;
|
||||||
|
@ -309,7 +323,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IMacroEntry[])symbolMap.values().toArray(NO_MACRO_ENTRIES);
|
return symbolMap.values().toArray(NO_MACRO_ENTRIES);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,19 +336,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMacroFileEntry[] getMacroFileEntries(ITranslationUnit cunit) throws CModelException {
|
public IMacroFileEntry[] getMacroFileEntries(ITranslationUnit cunit) throws CModelException {
|
||||||
List list = getPathEntries(cunit, IPathEntry.CDT_MACRO_FILE);
|
List<IPathEntry> list = getPathEntries(cunit, IPathEntry.CDT_MACRO_FILE);
|
||||||
IMacroFileEntry[] macFiles = (IMacroFileEntry[]) list.toArray(new IMacroFileEntry[list.size()]);
|
IMacroFileEntry[] macFiles = list.toArray(new IMacroFileEntry[list.size()]);
|
||||||
return macFiles;
|
return macFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getPathEntries(ITranslationUnit cunit, int type) throws CModelException {
|
private List<IPathEntry> getPathEntries(ITranslationUnit cunit, int type) throws CModelException {
|
||||||
ArrayList entryList = new ArrayList();
|
ArrayList<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
||||||
ICProject cproject = cunit.getCProject();
|
ICProject cproject = cunit.getCProject();
|
||||||
IPath resPath = cunit.getPath();
|
IPath resPath = cunit.getPath();
|
||||||
// Do this first so the containers get inialized.
|
// Do this first so the containers get inialized.
|
||||||
ArrayList resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
for (int i = 0; i < resolvedListEntries.size(); ++i) {
|
for (int i = 0; i < resolvedListEntries.size(); ++i) {
|
||||||
IPathEntry entry = (IPathEntry)resolvedListEntries.get(i);
|
IPathEntry entry = resolvedListEntries.get(i);
|
||||||
if ((entry.getEntryKind() & type) != 0) {
|
if ((entry.getEntryKind() & type) != 0) {
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -348,7 +362,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IPathEntry[] entries = (IPathEntry[]) entryList.toArray(new IPathEntry[entryList.size()]);
|
IPathEntry[] entries = entryList.toArray(new IPathEntry[entryList.size()]);
|
||||||
// Clear the list since we are reusing it.
|
// Clear the list since we are reusing it.
|
||||||
entryList.clear();
|
entryList.clear();
|
||||||
|
|
||||||
|
@ -362,10 +376,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
int count = resPath.segmentCount();
|
int count = resPath.segmentCount();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
IPath newPath = resPath.removeLastSegments(i);
|
IPath newPath = resPath.removeLastSegments(i);
|
||||||
for (int j = 0; j < entries.length; j++) {
|
for (IPathEntry entrie : entries) {
|
||||||
IPath otherPath = entries[j].getPath();
|
IPath otherPath = entrie.getPath();
|
||||||
if (newPath.equals(otherPath)) {
|
if (newPath.equals(otherPath)) {
|
||||||
entryList.add(entries[j]);
|
entryList.add(entrie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,15 +387,14 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
// Since the include that comes from a project contribution are not
|
// Since the include that comes from a project contribution are not
|
||||||
// tied to a resource they are added last.
|
// tied to a resource they are added last.
|
||||||
for (int i = 0; i < resolvedListEntries.size(); i++) {
|
for (int i = 0; i < resolvedListEntries.size(); i++) {
|
||||||
IPathEntry entry = (IPathEntry)resolvedListEntries.get(i);
|
IPathEntry entry = resolvedListEntries.get(i);
|
||||||
if (entry != null && entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
if (entry != null && entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
||||||
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(entry.getPath());
|
IResource res = cproject.getCModel().getWorkspace().getRoot().findMember(entry.getPath());
|
||||||
if (res != null && res.getType() == IResource.PROJECT) {
|
if (res != null && res.getType() == IResource.PROJECT) {
|
||||||
ICProject refCProject = CoreModel.getDefault().create((IProject)res);
|
ICProject refCProject = CoreModel.getDefault().create((IProject)res);
|
||||||
if (refCProject != null) {
|
if (refCProject != null) {
|
||||||
IPathEntry[] projEntries = refCProject.getResolvedPathEntries();
|
IPathEntry[] projEntries = refCProject.getResolvedPathEntries();
|
||||||
for (int j = 0; j < projEntries.length; j++) {
|
for (IPathEntry projEntry : projEntries) {
|
||||||
IPathEntry projEntry = projEntries[j];
|
|
||||||
if (projEntry.isExported()) {
|
if (projEntry.isExported()) {
|
||||||
if ((projEntry.getEntryKind() & type) != 0) {
|
if ((projEntry.getEntryKind() & type) != 0) {
|
||||||
entryList.add(projEntry);
|
entryList.add(projEntry);
|
||||||
|
@ -398,10 +411,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
/**
|
/**
|
||||||
* Return the cached entries, if no cache null.
|
* Return the cached entries, if no cache null.
|
||||||
* @param cproject
|
* @param cproject
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected IPathEntry[] getCachedResolvedPathEntries(ICProject cproject) {
|
protected IPathEntry[] getCachedResolvedPathEntries(ICProject cproject) {
|
||||||
ArrayList resolvedListEntries = (ArrayList)resolvedMap.get(cproject);
|
ArrayList<IPathEntry> resolvedListEntries = resolvedMap.get(cproject);
|
||||||
if (resolvedListEntries != null) {
|
if (resolvedListEntries != null) {
|
||||||
try {
|
try {
|
||||||
return getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
return getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
|
@ -413,10 +425,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathEntryResolveInfo getResolveInfo(ICProject cproject, boolean useCache) throws CModelException{
|
public PathEntryResolveInfo getResolveInfo(ICProject cproject, boolean useCache) throws CModelException{
|
||||||
PathEntryResolveInfo info = (PathEntryResolveInfo)resolvedInfoMap.get(cproject);
|
PathEntryResolveInfo info = resolvedInfoMap.get(cproject);
|
||||||
if(info == null && useCache){
|
if(info == null && useCache){
|
||||||
getResolvedPathEntries(cproject);
|
getResolvedPathEntries(cproject);
|
||||||
info = (PathEntryResolveInfo)resolvedInfoMap.get(cproject);
|
info = resolvedInfoMap.get(cproject);
|
||||||
}
|
}
|
||||||
if(info == null || !useCache || !getResolveInfoValidState(cproject)){
|
if(info == null || !useCache || !getResolveInfoValidState(cproject)){
|
||||||
Object[] resolved = getResolvedPathEntries(cproject, false, false);
|
Object[] resolved = getResolvedPathEntries(cproject, false, false);
|
||||||
|
@ -436,7 +448,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IPathEntry[] removeCachedResolvedPathEntries(ICProject cproject) {
|
protected IPathEntry[] removeCachedResolvedPathEntries(ICProject cproject) {
|
||||||
ArrayList resolvedListEntries = (ArrayList)resolvedMap.remove(cproject);
|
ArrayList<IPathEntry> resolvedListEntries = resolvedMap.remove(cproject);
|
||||||
resolvedInfoMap.remove(cproject);
|
resolvedInfoMap.remove(cproject);
|
||||||
if (resolvedListEntries != null) {
|
if (resolvedListEntries != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -448,12 +460,12 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPathEntry[] getCachedResolvedPathEntries(ArrayList resolvedListEntries, ICProject cproject) throws CModelException {
|
private IPathEntry[] getCachedResolvedPathEntries(ArrayList<IPathEntry> resolvedListEntries, ICProject cproject) throws CModelException {
|
||||||
IPathEntry[] entries = (IPathEntry[])resolvedListEntries.toArray(NO_PATHENTRIES);
|
IPathEntry[] entries = resolvedListEntries.toArray(NO_PATHENTRIES);
|
||||||
boolean hasContainerExtension = false;
|
boolean hasContainerExtension = false;
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
IContainerEntry centry = (IContainerEntry)entries[i];
|
IContainerEntry centry = (IContainerEntry)entrie;
|
||||||
IPathEntryContainer container = getPathEntryContainer(centry, cproject);
|
IPathEntryContainer container = getPathEntryContainer(centry, cproject);
|
||||||
if (container instanceof IPathEntryContainerExtension) {
|
if (container instanceof IPathEntryContainerExtension) {
|
||||||
hasContainerExtension = true;
|
hasContainerExtension = true;
|
||||||
|
@ -463,7 +475,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (hasContainerExtension) {
|
if (hasContainerExtension) {
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
ArrayList listEntries = new ArrayList(entries.length);
|
ArrayList<IPathEntry> listEntries = new ArrayList<IPathEntry>(entries.length);
|
||||||
for (int i = 0; i < entries.length; ++i) {
|
for (int i = 0; i < entries.length; ++i) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
if (entries[i].getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
IContainerEntry centry = (IContainerEntry)entries[i];
|
IContainerEntry centry = (IContainerEntry)entries[i];
|
||||||
|
@ -471,8 +483,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] containerEntries = container.getPathEntries();
|
IPathEntry[] containerEntries = container.getPathEntries();
|
||||||
if (containerEntries != null) {
|
if (containerEntries != null) {
|
||||||
for (int j = 0; j < containerEntries.length; j++) {
|
for (IPathEntry containerEntrie : containerEntries) {
|
||||||
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, containerEntries[j]);
|
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, containerEntrie);
|
||||||
listEntries.add(newEntry);
|
listEntries.add(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,14 +493,14 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
listEntries.add(entries[i]);
|
listEntries.add(entries[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entries = (IPathEntry[])listEntries.toArray(NO_PATHENTRIES);
|
entries = listEntries.toArray(NO_PATHENTRIES);
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry[] getResolvedPathEntries(ICProject cproject) throws CModelException {
|
public IPathEntry[] getResolvedPathEntries(ICProject cproject) throws CModelException {
|
||||||
boolean treeLock = cproject.getProject().getWorkspace().isTreeLocked();
|
boolean treeLock = cproject.getProject().getWorkspace().isTreeLocked();
|
||||||
ArrayList resolvedListEntries = getResolvedPathEntries(cproject, !treeLock);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, !treeLock);
|
||||||
return getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
return getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,27 +512,27 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
* @return
|
* @return
|
||||||
* @throws CModelException
|
* @throws CModelException
|
||||||
*/
|
*/
|
||||||
private ArrayList getResolvedPathEntries(ICProject cproject, boolean generateMarkers) throws CModelException {
|
@SuppressWarnings("unchecked")
|
||||||
|
private ArrayList<IPathEntry> getResolvedPathEntries(ICProject cproject, boolean generateMarkers) throws CModelException {
|
||||||
Object[] result = getResolvedPathEntries(cproject, generateMarkers, true);
|
Object[] result = getResolvedPathEntries(cproject, generateMarkers, true);
|
||||||
if(result != null)
|
if(result != null)
|
||||||
return (ArrayList)result[0];
|
return (ArrayList<IPathEntry>)result[0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] getResolvedPathEntries(ICProject cproject, boolean generateMarkers, boolean useCache) throws CModelException {
|
private Object[] getResolvedPathEntries(ICProject cproject, boolean generateMarkers, boolean useCache) throws CModelException {
|
||||||
ArrayList resolvedEntries = null;
|
ArrayList<IPathEntry> resolvedEntries = null;
|
||||||
PathEntryResolveInfo rInfo = null;
|
PathEntryResolveInfo rInfo = null;
|
||||||
if(useCache){
|
if(useCache){
|
||||||
resolvedEntries = (ArrayList)resolvedMap.get(cproject);
|
resolvedEntries = resolvedMap.get(cproject);
|
||||||
rInfo = (PathEntryResolveInfo)resolvedInfoMap.get(cproject);
|
rInfo = resolvedInfoMap.get(cproject);
|
||||||
}
|
}
|
||||||
if (resolvedEntries == null) {
|
if (resolvedEntries == null) {
|
||||||
List resolveInfoList = new ArrayList();
|
List<PathEntryResolveInfoElement> resolveInfoList = new ArrayList<PathEntryResolveInfoElement>();
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
||||||
resolvedEntries = new ArrayList();
|
resolvedEntries = new ArrayList<IPathEntry>();
|
||||||
for (int i = 0; i < rawEntries.length; i++) {
|
for (IPathEntry entry : rawEntries) {
|
||||||
IPathEntry entry = rawEntries[i];
|
|
||||||
// Expand the containers.
|
// Expand the containers.
|
||||||
if (entry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
if (entry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
IContainerEntry centry = (IContainerEntry)entry;
|
IContainerEntry centry = (IContainerEntry)entry;
|
||||||
|
@ -530,10 +542,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
// are not IPathEntryContainerExtension.
|
// are not IPathEntryContainerExtension.
|
||||||
if (!(container instanceof IPathEntryContainerExtension)) {
|
if (!(container instanceof IPathEntryContainerExtension)) {
|
||||||
IPathEntry[] containerEntries = container.getPathEntries();
|
IPathEntry[] containerEntries = container.getPathEntries();
|
||||||
List resolvedList = new ArrayList();
|
List<IPathEntry> resolvedList = new ArrayList<IPathEntry>();
|
||||||
if (containerEntries != null) {
|
if (containerEntries != null) {
|
||||||
for (int j = 0; j < containerEntries.length; j++) {
|
for (IPathEntry containerEntrie : containerEntries) {
|
||||||
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, containerEntries[j]);
|
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, containerEntrie);
|
||||||
resolvedEntries.add(newEntry);
|
resolvedEntries.add(newEntry);
|
||||||
resolvedList.add(newEntry);
|
resolvedList.add(newEntry);
|
||||||
}
|
}
|
||||||
|
@ -557,14 +569,14 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
resolvedEntries.trimToSize();
|
resolvedEntries.trimToSize();
|
||||||
|
|
||||||
if (generateMarkers) {
|
if (generateMarkers) {
|
||||||
IPathEntry[] finalEntries = (IPathEntry[])resolvedEntries.toArray(NO_PATHENTRIES);
|
IPathEntry[] finalEntries = resolvedEntries.toArray(NO_PATHENTRIES);
|
||||||
ArrayList problemList = new ArrayList();
|
ArrayList<ICModelStatus> problemList = new ArrayList<ICModelStatus>();
|
||||||
ICModelStatus status = validatePathEntry(cproject, finalEntries);
|
ICModelStatus status = validatePathEntry(cproject, finalEntries);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
problemList.add(status);
|
problemList.add(status);
|
||||||
}
|
}
|
||||||
for (int j = 0; j < finalEntries.length; j++) {
|
for (IPathEntry finalEntrie : finalEntries) {
|
||||||
status = PathEntryUtil.validatePathEntry(cproject, finalEntries[j], true, false);
|
status = PathEntryUtil.validatePathEntry(cproject, finalEntrie, true, false);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
problemList.add(status);
|
problemList.add(status);
|
||||||
}
|
}
|
||||||
|
@ -578,7 +590,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplication in the sources
|
// Check for duplication in the sources
|
||||||
List dups = PathEntryUtil.checkForDuplication(resolvedEntries, IPathEntry.CDT_SOURCE);
|
List<IPathEntry> dups = PathEntryUtil.checkForDuplication(resolvedEntries, IPathEntry.CDT_SOURCE);
|
||||||
if (dups.size() > 0) {
|
if (dups.size() > 0) {
|
||||||
resolvedEntries.removeAll(dups);
|
resolvedEntries.removeAll(dups);
|
||||||
}
|
}
|
||||||
|
@ -627,8 +639,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
// if no source is specified we return the project
|
// if no source is specified we return the project
|
||||||
boolean foundSource = false;
|
boolean foundSource = false;
|
||||||
boolean foundOutput = false;
|
boolean foundOutput = false;
|
||||||
for (int i = 0; i < pathEntries.length; i++) {
|
for (IPathEntry rawEntry : pathEntries) {
|
||||||
IPathEntry rawEntry = pathEntries[i];
|
|
||||||
if (rawEntry.getEntryKind() == IPathEntry.CDT_SOURCE) {
|
if (rawEntry.getEntryKind() == IPathEntry.CDT_SOURCE) {
|
||||||
foundSource = true;
|
foundSource = true;
|
||||||
}
|
}
|
||||||
|
@ -668,10 +679,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
public synchronized IPathEntryContainer[] getPathEntryContainers(ICProject cproject) {
|
public synchronized IPathEntryContainer[] getPathEntryContainers(ICProject cproject) {
|
||||||
IPathEntryContainer[] pcs = NO_PATHENTRYCONTAINERS;
|
IPathEntryContainer[] pcs = NO_PATHENTRYCONTAINERS;
|
||||||
Map projectContainers = (Map)Containers.get(cproject);
|
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
||||||
if (projectContainers != null) {
|
if (projectContainers != null) {
|
||||||
Collection collection = projectContainers.values();
|
Collection<IPathEntryContainer> collection = projectContainers.values();
|
||||||
pcs = (IPathEntryContainer[]) collection.toArray(NO_PATHENTRYCONTAINERS);
|
pcs= collection.toArray(NO_PATHENTRYCONTAINERS);
|
||||||
}
|
}
|
||||||
return pcs;
|
return pcs;
|
||||||
}
|
}
|
||||||
|
@ -762,13 +773,13 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
IExtension[] extensions = extension.getExtensions();
|
IExtension[] extensions = extension.getExtensions();
|
||||||
for (int i = 0; i < extensions.length; i++) {
|
for (IExtension extension2 : extensions) {
|
||||||
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
|
IConfigurationElement[] configElements = extension2.getConfigurationElements();
|
||||||
for (int j = 0; j < configElements.length; j++) {
|
for (IConfigurationElement configElement : configElements) {
|
||||||
String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$
|
String initializerID = configElement.getAttribute("id"); //$NON-NLS-1$
|
||||||
if (initializerID != null && initializerID.equals(containerID)) {
|
if (initializerID != null && initializerID.equals(containerID)) {
|
||||||
try {
|
try {
|
||||||
Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
|
Object execExt = configElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
if (execExt instanceof PathEntryContainerInitializer) {
|
if (execExt instanceof PathEntryContainerInitializer) {
|
||||||
return (PathEntryContainerInitializer)execExt;
|
return (PathEntryContainerInitializer)execExt;
|
||||||
}
|
}
|
||||||
|
@ -785,12 +796,12 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized IPathEntryContainer containerGet(ICProject cproject, IPath containerPath, boolean bCreateLock) {
|
synchronized IPathEntryContainer containerGet(ICProject cproject, IPath containerPath, boolean bCreateLock) {
|
||||||
Map projectContainers = (Map)Containers.get(cproject);
|
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
||||||
if (projectContainers == null) {
|
if (projectContainers == null) {
|
||||||
projectContainers = new HashMap();
|
projectContainers = new HashMap<IPath, IPathEntryContainer>();
|
||||||
Containers.put(cproject, projectContainers);
|
Containers.put(cproject, projectContainers);
|
||||||
}
|
}
|
||||||
IPathEntryContainer container = (IPathEntryContainer)projectContainers.get(containerPath);
|
IPathEntryContainer container = projectContainers.get(containerPath);
|
||||||
// Initialize the first time with a lock
|
// Initialize the first time with a lock
|
||||||
if (bCreateLock && container == null) {
|
if (bCreateLock && container == null) {
|
||||||
container = new PathEntryContainerLock();
|
container = new PathEntryContainerLock();
|
||||||
|
@ -800,16 +811,16 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void containerPut(ICProject cproject, IPath containerPath, IPathEntryContainer container) {
|
synchronized void containerPut(ICProject cproject, IPath containerPath, IPathEntryContainer container) {
|
||||||
Map projectContainers = (Map)Containers.get(cproject);
|
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
||||||
if (projectContainers == null) {
|
if (projectContainers == null) {
|
||||||
projectContainers = new HashMap();
|
projectContainers = new HashMap<IPath, IPathEntryContainer>();
|
||||||
Containers.put(cproject, projectContainers);
|
Containers.put(cproject, projectContainers);
|
||||||
}
|
}
|
||||||
IPathEntryContainer oldContainer;
|
IPathEntryContainer oldContainer;
|
||||||
if (container == null) {
|
if (container == null) {
|
||||||
oldContainer = (IPathEntryContainer)projectContainers.remove(containerPath);
|
oldContainer = projectContainers.remove(containerPath);
|
||||||
} else {
|
} else {
|
||||||
oldContainer = (IPathEntryContainer)projectContainers.put(containerPath, container);
|
oldContainer = projectContainers.put(containerPath, container);
|
||||||
}
|
}
|
||||||
if (oldContainer instanceof PathEntryContainerLock) {
|
if (oldContainer instanceof PathEntryContainerLock) {
|
||||||
synchronized (oldContainer) {
|
synchronized (oldContainer) {
|
||||||
|
@ -835,10 +846,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
public String[] projectPrerequisites(IPathEntry[] entries) throws CModelException {
|
public String[] projectPrerequisites(IPathEntry[] entries) throws CModelException {
|
||||||
if (entries != null) {
|
if (entries != null) {
|
||||||
ArrayList prerequisites = new ArrayList();
|
ArrayList<String> prerequisites = new ArrayList<String>();
|
||||||
for (int i = 0, length = entries.length; i < length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_PROJECT) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
||||||
IProjectEntry entry = (IProjectEntry)entries[i];
|
IProjectEntry entry = (IProjectEntry)entrie;
|
||||||
prerequisites.add(entry.getPath().lastSegment());
|
prerequisites.add(entry.getPath().lastSegment());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -858,15 +869,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
entries = NO_PATHENTRIES;
|
entries = NO_PATHENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList list = new ArrayList(entries.length);
|
ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(entries.length);
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
IPathEntry entry;
|
IPathEntry entry;
|
||||||
|
|
||||||
int kind = entries[i].getEntryKind();
|
int kind = entrie.getEntryKind();
|
||||||
|
|
||||||
// translate the project prefix.
|
// translate the project prefix.
|
||||||
IPath resourcePath = entries[i].getPath();
|
IPath resourcePath = entrie.getPath();
|
||||||
if (resourcePath == null) {
|
if (resourcePath == null) {
|
||||||
resourcePath = Path.EMPTY;
|
resourcePath = Path.EMPTY;
|
||||||
}
|
}
|
||||||
|
@ -890,7 +901,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
// Specifics to the entries
|
// Specifics to the entries
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case IPathEntry.CDT_INCLUDE : {
|
case IPathEntry.CDT_INCLUDE : {
|
||||||
IIncludeEntry include = (IIncludeEntry)entries[i];
|
IIncludeEntry include = (IIncludeEntry)entrie;
|
||||||
IPath baseRef = include.getBaseReference();
|
IPath baseRef = include.getBaseReference();
|
||||||
if (baseRef == null || baseRef.isEmpty()) {
|
if (baseRef == null || baseRef.isEmpty()) {
|
||||||
entry = CoreModel.newIncludeEntry(resourcePath, include.getBasePath(), include.getIncludePath(),
|
entry = CoreModel.newIncludeEntry(resourcePath, include.getBasePath(), include.getIncludePath(),
|
||||||
|
@ -901,14 +912,14 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_INCLUDE_FILE : {
|
case IPathEntry.CDT_INCLUDE_FILE : {
|
||||||
IIncludeFileEntry includeFile = (IIncludeFileEntry)entries[i];
|
IIncludeFileEntry includeFile = (IIncludeFileEntry)entrie;
|
||||||
entry = CoreModel.newIncludeFileEntry(resourcePath, includeFile.getBasePath(),
|
entry = CoreModel.newIncludeFileEntry(resourcePath, includeFile.getBasePath(),
|
||||||
includeFile.getBaseReference(), includeFile.getIncludeFilePath(),
|
includeFile.getBaseReference(), includeFile.getIncludeFilePath(),
|
||||||
includeFile.getExclusionPatterns(), includeFile.isExported());
|
includeFile.getExclusionPatterns(), includeFile.isExported());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_LIBRARY : {
|
case IPathEntry.CDT_LIBRARY : {
|
||||||
ILibraryEntry library = (ILibraryEntry)entries[i];
|
ILibraryEntry library = (ILibraryEntry)entrie;
|
||||||
IPath sourcePath = library.getSourceAttachmentPath();
|
IPath sourcePath = library.getSourceAttachmentPath();
|
||||||
if (sourcePath != null) {
|
if (sourcePath != null) {
|
||||||
// translate to project relative from absolute
|
// translate to project relative from absolute
|
||||||
|
@ -930,7 +941,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO : {
|
case IPathEntry.CDT_MACRO : {
|
||||||
IMacroEntry macro = (IMacroEntry)entries[i];
|
IMacroEntry macro = (IMacroEntry)entrie;
|
||||||
IPath baseRef = macro.getBaseReference();
|
IPath baseRef = macro.getBaseReference();
|
||||||
if (baseRef == null || baseRef.isEmpty()) {
|
if (baseRef == null || baseRef.isEmpty()) {
|
||||||
entry = CoreModel.newMacroEntry(resourcePath, macro.getMacroName(), macro.getMacroValue(),
|
entry = CoreModel.newMacroEntry(resourcePath, macro.getMacroName(), macro.getMacroValue(),
|
||||||
|
@ -941,32 +952,32 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO_FILE : {
|
case IPathEntry.CDT_MACRO_FILE : {
|
||||||
IMacroFileEntry macro = (IMacroFileEntry)entries[i];
|
IMacroFileEntry macro = (IMacroFileEntry)entrie;
|
||||||
entry = CoreModel.newMacroFileEntry(resourcePath, macro.getBasePath(),
|
entry = CoreModel.newMacroFileEntry(resourcePath, macro.getBasePath(),
|
||||||
macro.getBaseReference(), macro.getMacroFilePath(),
|
macro.getBaseReference(), macro.getMacroFilePath(),
|
||||||
macro.getExclusionPatterns(), macro.isExported());
|
macro.getExclusionPatterns(), macro.isExported());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_OUTPUT : {
|
case IPathEntry.CDT_OUTPUT : {
|
||||||
IOutputEntry out = (IOutputEntry)entries[i];
|
IOutputEntry out = (IOutputEntry)entrie;
|
||||||
entry = CoreModel.newOutputEntry(resourcePath, out.getExclusionPatterns());
|
entry = CoreModel.newOutputEntry(resourcePath, out.getExclusionPatterns());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_PROJECT : {
|
case IPathEntry.CDT_PROJECT : {
|
||||||
IProjectEntry projEntry = (IProjectEntry)entries[i];
|
IProjectEntry projEntry = (IProjectEntry)entrie;
|
||||||
entry = CoreModel.newProjectEntry(projEntry.getPath(), projEntry.isExported());
|
entry = CoreModel.newProjectEntry(projEntry.getPath(), projEntry.isExported());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_SOURCE : {
|
case IPathEntry.CDT_SOURCE : {
|
||||||
ISourceEntry source = (ISourceEntry)entries[i];
|
ISourceEntry source = (ISourceEntry)entrie;
|
||||||
entry = CoreModel.newSourceEntry(resourcePath, source.getExclusionPatterns());
|
entry = CoreModel.newSourceEntry(resourcePath, source.getExclusionPatterns());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_CONTAINER :
|
case IPathEntry.CDT_CONTAINER :
|
||||||
entry = CoreModel.newContainerEntry(entries[i].getPath(), entries[i].isExported());
|
entry = CoreModel.newContainerEntry(entrie.getPath(), entrie.isExported());
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
entry = entries[i];
|
entry = entrie;
|
||||||
}
|
}
|
||||||
list.add(entry);
|
list.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1042,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if(!needDelta(cproject))
|
if(!needDelta(cproject))
|
||||||
return new ICElementDelta[0];
|
return new ICElementDelta[0];
|
||||||
|
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<ICElementDelta> list = new ArrayList<ICElementDelta>();
|
||||||
|
|
||||||
// if nothing was known before do not generate any deltas.
|
// if nothing was known before do not generate any deltas.
|
||||||
if (oldEntries == null) {
|
if (oldEntries == null) {
|
||||||
|
@ -1043,17 +1054,17 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the removed entries.
|
// Check the removed entries.
|
||||||
for (int i = 0; i < oldEntries.length; i++) {
|
for (IPathEntry oldEntrie : oldEntries) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (int j = 0; j < newEntries.length; j++) {
|
for (IPathEntry newEntrie : newEntries) {
|
||||||
if (oldEntries[i].equals(newEntries[j])) {
|
if (oldEntrie.equals(newEntrie)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Was it deleted.
|
// Was it deleted.
|
||||||
if (!found) {
|
if (!found) {
|
||||||
ICElementDelta delta = makePathEntryDelta(cproject, oldEntries[i], true);
|
ICElementDelta delta = makePathEntryDelta(cproject, oldEntrie, true);
|
||||||
if (delta != null) {
|
if (delta != null) {
|
||||||
list.add(delta);
|
list.add(delta);
|
||||||
}
|
}
|
||||||
|
@ -1061,17 +1072,17 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the new entries.
|
// Check the new entries.
|
||||||
for (int i = 0; i < newEntries.length; i++) {
|
for (IPathEntry newEntrie : newEntries) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (int j = 0; j < oldEntries.length; j++) {
|
for (IPathEntry oldEntrie : oldEntries) {
|
||||||
if (newEntries[i].equals(oldEntries[j])) {
|
if (newEntrie.equals(oldEntrie)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// is it new?
|
// is it new?
|
||||||
if (!found) {
|
if (!found) {
|
||||||
ICElementDelta delta = makePathEntryDelta(cproject, newEntries[i], false);
|
ICElementDelta delta = makePathEntryDelta(cproject, newEntrie, false);
|
||||||
if (delta != null) {
|
if (delta != null) {
|
||||||
list.add(delta);
|
list.add(delta);
|
||||||
}
|
}
|
||||||
|
@ -1180,15 +1191,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (core == null) {
|
if (core == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ArrayList containerIDList = new ArrayList(5);
|
ArrayList<String> containerIDList = new ArrayList<String>(5);
|
||||||
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
|
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
|
||||||
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
IExtension[] extensions = extension.getExtensions();
|
IExtension[] extensions = extension.getExtensions();
|
||||||
for (int i = 0; i < extensions.length; i++) {
|
for (IExtension extension2 : extensions) {
|
||||||
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
|
IConfigurationElement[] configElements = extension2.getConfigurationElements();
|
||||||
for (int j = 0; j < configElements.length; j++) {
|
for (IConfigurationElement configElement : configElements) {
|
||||||
String idAttribute = configElements[j].getAttribute("id"); //$NON-NLS-1$
|
String idAttribute = configElement.getAttribute("id"); //$NON-NLS-1$
|
||||||
if (idAttribute != null)
|
if (idAttribute != null)
|
||||||
containerIDList.add(idAttribute);
|
containerIDList.add(idAttribute);
|
||||||
}
|
}
|
||||||
|
@ -1202,7 +1213,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
public void setPathEntryStore(IProject project, IPathEntryStore newStore) {
|
public void setPathEntryStore(IProject project, IPathEntryStore newStore) {
|
||||||
IPathEntryStore oldStore = null;
|
IPathEntryStore oldStore = null;
|
||||||
synchronized (storeMap) {
|
synchronized (storeMap) {
|
||||||
oldStore = (IPathEntryStore)storeMap.remove(project);
|
oldStore = storeMap.remove(project);
|
||||||
if (newStore != null) {
|
if (newStore != null) {
|
||||||
storeMap.put(project, newStore);
|
storeMap.put(project, newStore);
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1227,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
public IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException {
|
public IPathEntryStore getPathEntryStore(IProject project, boolean create) throws CoreException {
|
||||||
synchronized (storeMap){
|
synchronized (storeMap){
|
||||||
IPathEntryStore store = (IPathEntryStore)storeMap.get(project);
|
IPathEntryStore store = storeMap.get(project);
|
||||||
if (store == null) {
|
if (store == null) {
|
||||||
if(create == true){
|
if(create == true){
|
||||||
store = createPathEntryStore(project);
|
store = createPathEntryStore(project);
|
||||||
|
@ -1308,17 +1319,17 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
public void elementChanged(ElementChangedEvent event) {
|
public void elementChanged(ElementChangedEvent event) {
|
||||||
try {
|
try {
|
||||||
if (processDelta(event.getDelta()) == true) {
|
if (processDelta(event.getDelta()) == true) {
|
||||||
ICProject[] cProjects = (ICProject [])resolvedMap.keySet().toArray(new ICProject[0]);
|
ICProject[] cProjects = resolvedMap.keySet().toArray(new ICProject[0]);
|
||||||
for(int i = 0; i < cProjects.length; i++) {
|
for (ICProject project2 : cProjects) {
|
||||||
IPathEntry[] entries = getCachedResolvedPathEntries(cProjects[i]);
|
IPathEntry[] entries = getCachedResolvedPathEntries(project2);
|
||||||
if (entries != null) {
|
if (entries != null) {
|
||||||
IProject project = cProjects[i].getProject();
|
IProject project = project2.getProject();
|
||||||
try {
|
try {
|
||||||
IMarker[] markers = project.findMarkers(ICModelMarker.PATHENTRY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
IMarker[] markers = project.findMarkers(ICModelMarker.PATHENTRY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
if (markers != null && markers.length > 0) {
|
if (markers != null && markers.length > 0) {
|
||||||
ArrayList problemList = new ArrayList();
|
ArrayList<ICModelStatus> problemList = new ArrayList<ICModelStatus>();
|
||||||
for (int j = 0; j < entries.length; j++) {
|
for (IPathEntry entrie : entries) {
|
||||||
ICModelStatus status = PathEntryUtil.validatePathEntry(cProjects[i], entries[j], true, false);
|
ICModelStatus status = PathEntryUtil.validatePathEntry(project2, entrie, true, false);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
problemList.add(status);
|
problemList.add(status);
|
||||||
}
|
}
|
||||||
|
@ -1386,8 +1397,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (type == ICElement.C_MODEL || type == ICElement.C_CCONTAINER || type == ICElement.C_PROJECT) {
|
if (type == ICElement.C_MODEL || type == ICElement.C_CCONTAINER || type == ICElement.C_PROJECT) {
|
||||||
ICElementDelta[] affectedChildren = delta.getAffectedChildren();
|
ICElementDelta[] affectedChildren = delta.getAffectedChildren();
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
for (ICElementDelta element2 : affectedChildren) {
|
||||||
if (processDelta(affectedChildren[i]) == true) {
|
if (processDelta(element2) == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1415,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
final ICProject cproject = sourceRoot.getCProject();
|
final ICProject cproject = sourceRoot.getCProject();
|
||||||
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
ArrayList list = new ArrayList(rawEntries.length);
|
ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(rawEntries.length);
|
||||||
for (int i = 0; i < rawEntries.length; ++i) {
|
for (int i = 0; i < rawEntries.length; ++i) {
|
||||||
if (rawEntries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
if (rawEntries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
||||||
if (sourceRoot.getPath().equals(rawEntries[i].getPath())) {
|
if (sourceRoot.getPath().equals(rawEntries[i].getPath())) {
|
||||||
|
|
|
@ -70,9 +70,9 @@ public class PathEntryUtil {
|
||||||
ICProject refCProject = CoreModel.getDefault().create(project);
|
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||||
if (refCProject != null) {
|
if (refCProject != null) {
|
||||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
IIncludeEntry refEntry = (IIncludeEntry)entries[i];
|
IIncludeEntry refEntry = (IIncludeEntry)entrie;
|
||||||
if (refEntry.getIncludePath().equals(includePath)) {
|
if (refEntry.getIncludePath().equals(includePath)) {
|
||||||
IPath newBasePath = refEntry.getBasePath();
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
// If the includePath is
|
// If the includePath is
|
||||||
|
@ -106,9 +106,9 @@ public class PathEntryUtil {
|
||||||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] entries = container.getPathEntries();
|
IPathEntry[] entries = container.getPathEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||||
IIncludeEntry refEntry = (IIncludeEntry)entries[i];
|
IIncludeEntry refEntry = (IIncludeEntry)entrie;
|
||||||
if (refEntry.getIncludePath().equals(includePath)) {
|
if (refEntry.getIncludePath().equals(includePath)) {
|
||||||
IPath newBasePath = refEntry.getBasePath();
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
return CoreModel.newIncludeEntry(includeEntry.getPath(), newBasePath, includePath);
|
return CoreModel.newIncludeEntry(includeEntry.getPath(), newBasePath, includePath);
|
||||||
|
@ -134,9 +134,9 @@ public class PathEntryUtil {
|
||||||
ICProject refCProject = CoreModel.getDefault().create(project);
|
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||||
if (refCProject != null) {
|
if (refCProject != null) {
|
||||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_MACRO) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||||
IMacroEntry refEntry = (IMacroEntry)entries[i];
|
IMacroEntry refEntry = (IMacroEntry)entrie;
|
||||||
if (refEntry.getMacroName().equals(name)) {
|
if (refEntry.getMacroName().equals(name)) {
|
||||||
String value = refEntry.getMacroValue();
|
String value = refEntry.getMacroValue();
|
||||||
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
||||||
|
@ -150,9 +150,9 @@ public class PathEntryUtil {
|
||||||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] entries = container.getPathEntries();
|
IPathEntry[] entries = container.getPathEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_MACRO) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||||
IMacroEntry refEntry = (IMacroEntry)entries[i];
|
IMacroEntry refEntry = (IMacroEntry)entrie;
|
||||||
if (refEntry.getMacroName().equals(name)) {
|
if (refEntry.getMacroName().equals(name)) {
|
||||||
String value = refEntry.getMacroValue();
|
String value = refEntry.getMacroValue();
|
||||||
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
||||||
|
@ -178,9 +178,9 @@ public class PathEntryUtil {
|
||||||
ICProject refCProject = CoreModel.getDefault().create(project);
|
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||||
if (refCProject != null) {
|
if (refCProject != null) {
|
||||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||||
ILibraryEntry refEntry = (ILibraryEntry)entries[i];
|
ILibraryEntry refEntry = (ILibraryEntry)entrie;
|
||||||
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
||||||
IPath newBasePath = refEntry.getBasePath();
|
IPath newBasePath = refEntry.getBasePath();
|
||||||
// If the libraryPath is
|
// If the libraryPath is
|
||||||
|
@ -218,9 +218,9 @@ public class PathEntryUtil {
|
||||||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] entries = container.getPathEntries();
|
IPathEntry[] entries = container.getPathEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||||
ILibraryEntry refEntry = (ILibraryEntry)entries[i];
|
ILibraryEntry refEntry = (ILibraryEntry)entrie;
|
||||||
if (refEntry.getPath().equals(libraryPath)) {
|
if (refEntry.getPath().equals(libraryPath)) {
|
||||||
return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),
|
return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),
|
||||||
refEntry.getLibraryPath(), refEntry.getSourceAttachmentPath(),
|
refEntry.getLibraryPath(), refEntry.getSourceAttachmentPath(),
|
||||||
|
@ -335,13 +335,11 @@ public class PathEntryUtil {
|
||||||
public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
|
public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
|
||||||
|
|
||||||
// Check duplication.
|
// Check duplication.
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entry : entries) {
|
||||||
IPathEntry entry = entries[i];
|
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < entries.length; j++) {
|
for (IPathEntry otherEntry : entries) {
|
||||||
IPathEntry otherEntry = entries[j];
|
|
||||||
if (otherEntry == null) {
|
if (otherEntry == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +351,7 @@ public class PathEntryUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check duplication of sources
|
// check duplication of sources
|
||||||
List dups = checkForDuplication(Arrays.asList(entries), IPathEntry.CDT_SOURCE);
|
List<IPathEntry> dups = checkForDuplication(Arrays.asList(entries), IPathEntry.CDT_SOURCE);
|
||||||
if (dups.size() > 0) {
|
if (dups.size() > 0) {
|
||||||
ICModelStatus[] cmodelStatus = new ICModelStatus[dups.size()];
|
ICModelStatus[] cmodelStatus = new ICModelStatus[dups.size()];
|
||||||
for (int i = 0; i < dups.size(); ++i) {
|
for (int i = 0; i < dups.size(); ++i) {
|
||||||
|
@ -376,16 +374,14 @@ public class PathEntryUtil {
|
||||||
|
|
||||||
// allow nesting source entries in each other as long as the outer entry
|
// allow nesting source entries in each other as long as the outer entry
|
||||||
// excludes the inner one
|
// excludes the inner one
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (IPathEntry entry : entries) {
|
||||||
IPathEntry entry = entries[i];
|
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
IPath entryPath = entry.getPath();
|
IPath entryPath = entry.getPath();
|
||||||
int kind = entry.getEntryKind();
|
int kind = entry.getEntryKind();
|
||||||
if (kind == IPathEntry.CDT_SOURCE) {
|
if (kind == IPathEntry.CDT_SOURCE) {
|
||||||
for (int j = 0; j < entries.length; j++) {
|
for (IPathEntry otherEntry : entries) {
|
||||||
IPathEntry otherEntry = entries[j];
|
|
||||||
if (otherEntry == null) {
|
if (otherEntry == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -491,8 +487,8 @@ public class PathEntryUtil {
|
||||||
try {
|
try {
|
||||||
IPathEntryContainer cont = manager.getPathEntryContainer((IContainerEntry)entry, cProject);
|
IPathEntryContainer cont = manager.getPathEntryContainer((IContainerEntry)entry, cProject);
|
||||||
IPathEntry[] contEntries = cont.getPathEntries();
|
IPathEntry[] contEntries = cont.getPathEntries();
|
||||||
for (int i = 0; i < contEntries.length; i++) {
|
for (IPathEntry contEntrie : contEntries) {
|
||||||
ICModelStatus status = validatePathEntry(cProject, contEntries[i], checkSourceAttachment, false);
|
ICModelStatus status = validatePathEntry(cProject, contEntrie, checkSourceAttachment, false);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -541,13 +537,13 @@ public class PathEntryUtil {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List checkForDuplication(List pathEntries, int type) {
|
public static List<IPathEntry> checkForDuplication(List<IPathEntry> pathEntries, int type) {
|
||||||
List duplicate = new ArrayList(pathEntries.size());
|
List<IPathEntry> duplicate = new ArrayList<IPathEntry>(pathEntries.size());
|
||||||
for (int i = 0; i < pathEntries.size(); ++i) {
|
for (int i = 0; i < pathEntries.size(); ++i) {
|
||||||
IPathEntry pathEntry = (IPathEntry)pathEntries.get(i);
|
IPathEntry pathEntry = pathEntries.get(i);
|
||||||
if (pathEntry.getEntryKind() == type) {
|
if (pathEntry.getEntryKind() == type) {
|
||||||
for (int j = 0; j < pathEntries.size(); ++j) {
|
for (int j = 0; j < pathEntries.size(); ++j) {
|
||||||
IPathEntry otherEntry = (IPathEntry)pathEntries.get(j);
|
IPathEntry otherEntry = pathEntries.get(j);
|
||||||
if (otherEntry.getEntryKind() == type) {
|
if (otherEntry.getEntryKind() == type) {
|
||||||
if (!pathEntry.equals(otherEntry)) {
|
if (!pathEntry.equals(otherEntry)) {
|
||||||
if (!duplicate.contains(pathEntry)) {
|
if (!duplicate.contains(pathEntry)) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
|
@ -168,6 +169,11 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
scanInfo= provider.getScannerInformation(file);
|
scanInfo= provider.getScannerInformation(file);
|
||||||
if (scanInfo == null || scanInfo.getDefinedSymbols().isEmpty()) {
|
if (scanInfo == null || scanInfo.getDefinedSymbols().isEmpty()) {
|
||||||
scanInfo= provider.getScannerInformation(project);
|
scanInfo= provider.getScannerInformation(project);
|
||||||
|
if (linkageID == ILinkage.C_LINKAGE_ID) {
|
||||||
|
final Map<String, String> definedSymbols = scanInfo.getDefinedSymbols();
|
||||||
|
definedSymbols.remove("__cplusplus__"); //$NON-NLS-1$
|
||||||
|
definedSymbols.remove("__cplusplus"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -273,64 +279,62 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
|
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
|
||||||
+ fStatistics.fProblemBindingCount + "(" + nfPercent.format(problemPct) + ") unresolved."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ fStatistics.fProblemBindingCount + "(" + nfPercent.format(problemPct) + ") unresolved."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
if (index != null) {
|
long misses= index.getCacheMisses();
|
||||||
long misses= index.getCacheMisses();
|
long hits= index.getCacheHits();
|
||||||
long hits= index.getCacheHits();
|
long tries= misses+hits;
|
||||||
long tries= misses+hits;
|
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
|
||||||
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
|
System.out.println(ident + " Cache[" //$NON-NLS-1$
|
||||||
System.out.println(ident + " Cache[" //$NON-NLS-1$
|
|
||||||
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "mb]: " + //$NON-NLS-1$
|
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "mb]: " + //$NON-NLS-1$
|
||||||
+ hits + " hits, " //$NON-NLS-1$
|
+ hits + " hits, " //$NON-NLS-1$
|
||||||
+ misses + "(" + nfPercent.format(missPct)+ ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ misses + "(" + nfPercent.format(missPct)+ ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
if ("true".equals(System.getProperty("SHOW_COMPRESSED_INDEXER_INFO"))) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
NumberFormat twoDigits= NumberFormat.getNumberInstance();
|
|
||||||
twoDigits.setMinimumIntegerDigits(2);
|
|
||||||
NumberFormat nfGroup= NumberFormat.getNumberInstance();
|
|
||||||
nfGroup.setGroupingUsed(true);
|
|
||||||
|
|
||||||
final String sep0 = "|"; //$NON-NLS-1$
|
if ("true".equals(System.getProperty("SHOW_COMPRESSED_INDEXER_INFO"))) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
final String sep = "| "; //$NON-NLS-1$
|
Calendar cal = Calendar.getInstance();
|
||||||
final String sec = "s"; //$NON-NLS-1$
|
NumberFormat twoDigits= NumberFormat.getNumberInstance();
|
||||||
final String mb = "mb"; //$NON-NLS-1$
|
twoDigits.setMinimumIntegerDigits(2);
|
||||||
final String million = "M"; //$NON-NLS-1$
|
NumberFormat nfGroup= NumberFormat.getNumberInstance();
|
||||||
System.out.print(sep0);
|
nfGroup.setGroupingUsed(true);
|
||||||
System.out.print(cal.get(Calendar.YEAR) + twoDigits.format(cal.get(Calendar.MONTH)+1) + twoDigits.format(cal.get(Calendar.DAY_OF_MONTH)+1));
|
|
||||||
System.out.print(sep);
|
final String sep0 = "|"; //$NON-NLS-1$
|
||||||
System.out.print(nfGroup.format(info.fCompletedSources));
|
final String sep = "| "; //$NON-NLS-1$
|
||||||
System.out.print(sep);
|
final String sec = "s"; //$NON-NLS-1$
|
||||||
System.out.print(nfGroup.format(info.fCompletedHeaders));
|
final String mb = "mb"; //$NON-NLS-1$
|
||||||
System.out.print(sep);
|
final String million = "M"; //$NON-NLS-1$
|
||||||
System.out.print(nfGroup.format((totalTime+500)/1000) + sec);
|
System.out.print(sep0);
|
||||||
System.out.print(sep);
|
System.out.print(cal.get(Calendar.YEAR) + twoDigits.format(cal.get(Calendar.MONTH)+1) + twoDigits.format(cal.get(Calendar.DAY_OF_MONTH)+1));
|
||||||
System.out.print(nfGroup.format((fStatistics.fParsingTime+500)/1000) + sec);
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format(info.fCompletedSources));
|
||||||
System.out.print(nfGroup.format((fStatistics.fResolutionTime+500)/1000) + sec);
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format(info.fCompletedHeaders));
|
||||||
System.out.print(nfGroup.format((fStatistics.fAddToIndexTime+500)/1000) + sec);
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((totalTime+500)/1000) + sec);
|
||||||
System.out.print(nfGroup.format((dbSize+1024*512)/1024/1024) + mb);
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((fStatistics.fParsingTime+500)/1000) + sec);
|
||||||
System.out.print(nfGroup.format((tries+1000*500)/1000000) + million);
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((fStatistics.fResolutionTime+500)/1000) + sec);
|
||||||
System.out.print(nfGroup.format(fStatistics.fDeclarationCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((fStatistics.fAddToIndexTime+500)/1000) + sec);
|
||||||
System.out.print(nfGroup.format(fStatistics.fReferenceCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((dbSize+1024*512)/1024/1024) + mb);
|
||||||
System.out.print(nfGroup.format(fStatistics.fProblemBindingCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format((tries+1000*500)/1000000) + million);
|
||||||
System.out.print(nfPercent.format(problemPct));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format(fStatistics.fDeclarationCount));
|
||||||
System.out.print(nfGroup.format(fStatistics.fErrorCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format(fStatistics.fReferenceCount));
|
||||||
System.out.print(nfGroup.format(fStatistics.fUnresolvedIncludesCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfGroup.format(fStatistics.fProblemBindingCount));
|
||||||
System.out.print(nfGroup.format(fStatistics.fPreprocessorProblemCount));
|
System.out.print(sep);
|
||||||
System.out.print(sep);
|
System.out.print(nfPercent.format(problemPct));
|
||||||
System.out.print(nfGroup.format(fStatistics.fSyntaxProblemsCount));
|
System.out.print(sep);
|
||||||
System.out.println(sep0);
|
System.out.print(nfGroup.format(fStatistics.fErrorCount));
|
||||||
}
|
System.out.print(sep);
|
||||||
|
System.out.print(nfGroup.format(fStatistics.fUnresolvedIncludesCount));
|
||||||
|
System.out.print(sep);
|
||||||
|
System.out.print(nfGroup.format(fStatistics.fPreprocessorProblemCount));
|
||||||
|
System.out.print(sep);
|
||||||
|
System.out.print(nfGroup.format(fStatistics.fSyntaxProblemsCount));
|
||||||
|
System.out.println(sep0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue