1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

Bug 302767: Missing files in CModel.

This commit is contained in:
Markus Schorn 2011-09-30 11:29:07 +02:00
parent cfd0941737
commit c33f596d9c

View file

@ -71,8 +71,8 @@ final class DeltaProcessor {
CModelInfo rootInfo = (CModelInfo)manager.peekAtInfo(root); CModelInfo rootInfo = (CModelInfo)manager.peekAtInfo(root);
if (rootInfo != null) { if (rootInfo != null) {
ICElement[] celements = rootInfo.getChildren(); ICElement[] celements = rootInfo.getChildren();
for (int i = 0; i < celements.length; i++) { for (ICElement celement : celements) {
IResource r = celements[i].getResource(); IResource r = celement.getResource();
if (project.equals(r)) { if (project.equals(r)) {
shouldProcess = true; shouldProcess = true;
} }
@ -97,10 +97,10 @@ final class DeltaProcessor {
IBinaryContainer bin = cproj.getBinaryContainer(); IBinaryContainer bin = cproj.getBinaryContainer();
if (bin.isOpen()) { if (bin.isOpen()) {
children = ((CElement)bin).getElementInfo().getChildren(); children = ((CElement)bin).getElementInfo().getChildren();
for (int i = 0; i < children.length; i++) { for (ICElement element : children) {
IResource res = children[i].getResource(); IResource res = element.getResource();
if (resource.equals(res)) { if (resource.equals(res)) {
celement = children[i]; celement = element;
break; break;
} }
} }
@ -116,10 +116,10 @@ final class DeltaProcessor {
IArchiveContainer ar = cproj.getArchiveContainer(); IArchiveContainer ar = cproj.getArchiveContainer();
if (ar.isOpen()) { if (ar.isOpen()) {
children = ((CElement)ar).getElementInfo().getChildren(); children = ((CElement)ar).getElementInfo().getChildren();
for (int i = 0; i < children.length; i++) { for (ICElement element : children) {
IResource res = children[i].getResource(); IResource res = element.getResource();
if (resource.equals(res)) { if (resource.equals(res)) {
celement = children[i]; celement = element;
break; break;
} }
} }
@ -192,8 +192,8 @@ final class DeltaProcessor {
if (pinfo != null && pinfo.vBin != null) { if (pinfo != null && pinfo.vBin != null) {
if (factory.peekAtInfo(pinfo.vBin) != null) { if (factory.peekAtInfo(pinfo.vBin) != null) {
ICElement[] bins = pinfo.vBin.getChildren(); ICElement[] bins = pinfo.vBin.getChildren();
for (int i = 0; i < bins.length; i++) { for (ICElement bin : bins) {
if (celement.getPath().isPrefixOf(bins[i].getPath())) { if (celement.getPath().isPrefixOf(bin.getPath())) {
fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED); fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
} }
} }
@ -202,8 +202,8 @@ final class DeltaProcessor {
if (pinfo != null && pinfo.vLib != null) { if (pinfo != null && pinfo.vLib != null) {
if (factory.peekAtInfo(pinfo.vLib) != null) { if (factory.peekAtInfo(pinfo.vLib) != null) {
ICElement[] ars = pinfo.vLib.getChildren(); ICElement[] ars = pinfo.vLib.getChildren();
for (int i = 0; i < ars.length; i++) { for (ICElement ar : ars) {
if (celement.getPath().isPrefixOf(ars[i].getPath())) { if (celement.getPath().isPrefixOf(ar.getPath())) {
fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED); fCurrentDelta.changed(pinfo.vBin, ICElementDelta.CHANGED);
} }
} }
@ -468,8 +468,8 @@ final class DeltaProcessor {
} }
if (updateChildren){ if (updateChildren){
IResourceDelta [] children = delta.getAffectedChildren(); IResourceDelta [] children = delta.getAffectedChildren();
for (int i = 0; i < children.length; i++) { for (IResourceDelta element : children) {
traverseDelta(parent, children[i]); traverseDelta(parent, element);
} }
} }
} }
@ -506,10 +506,10 @@ final class DeltaProcessor {
} }
// deal with project == sourceroot. For that case the parent could have been the sourceroot // deal with project == sourceroot. For that case the parent could have been the sourceroot
// so we must update the sourceroot nonCResource array also. // so we must update the sourceroot nonCResource array also.
for (int i = 0; i < roots.length; i++) { for (ISourceRoot root : roots) {
IResource r = roots[i].getResource(); IResource r = root.getResource();
if (r instanceof IProject) { if (r instanceof IProject) {
CElementInfo cinfo = (CElementInfo) CModelManager.getDefault().peekAtInfo(roots[i]); CElementInfo cinfo = (CElementInfo) CModelManager.getDefault().peekAtInfo(root);
if (cinfo instanceof CContainerInfo) { if (cinfo instanceof CContainerInfo) {
((CContainerInfo)cinfo).setNonCResources(null); ((CContainerInfo)cinfo).setNonCResources(null);
} }
@ -546,8 +546,8 @@ final class DeltaProcessor {
if (delta.getKind() == IResourceDelta.ADDED) if (delta.getKind() == IResourceDelta.ADDED)
return true; return true;
IResourceDelta[] children= delta.getAffectedChildren(); IResourceDelta[] children= delta.getAffectedChildren();
for (int i = 0; i < children.length; i++) { for (IResourceDelta element : children) {
if (isFolderAddition(children[i])) { if (isFolderAddition(element)) {
return true; return true;
} }
} }
@ -571,14 +571,18 @@ final class DeltaProcessor {
if (element instanceof ICContainer) { if (element instanceof ICContainer) {
ICContainer container = (ICContainer) element; ICContainer container = (ICContainer) element;
ICProject cProject = container.getCProject(); ICProject cProject = container.getCProject();
// Always check whether the container is open.
if (container.isOpen())
return true;
// Check binary container, if the new folder is on an output entry,
// there may be new binaries to add
if (cProject.isOnOutputEntry(resource)) { if (cProject.isOnOutputEntry(resource)) {
// if new folder is on output entry there might be new binaries to add
IBinaryContainer bin = cProject.getBinaryContainer(); IBinaryContainer bin = cProject.getBinaryContainer();
IArchiveContainer archive = cProject.getArchiveContainer(); IArchiveContainer archive = cProject.getArchiveContainer();
// traverse further if a binary container is open
return bin.isOpen() || archive.isOpen(); return bin.isOpen() || archive.isOpen();
} }
return container.isOpen(); return false;
} else if (element instanceof ICProject) { } else if (element instanceof ICProject) {
return ((ICProject) element).isOpen(); return ((ICProject) element).isOpen();
} else if (element instanceof IBinary) { } else if (element instanceof IBinary) {