mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Modified updateCurrentDeltaAndIndex in DeltaProcessor.java to return whether
we need to traverse a delta's children.
This commit is contained in:
parent
0490a7b6ae
commit
47da7cb742
4 changed files with 27 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-05-20 Bogdan Gheorghe
|
||||||
|
Modified updateCurrentDeltaAndIndex inDeltaProcessor.java to return whether
|
||||||
|
we need to traverse a delta's children.
|
||||||
|
|
||||||
2004-05-19 Alain Magloire
|
2004-05-19 Alain Magloire
|
||||||
|
|
||||||
Partial Fix for PR 61341
|
Partial Fix for PR 61341
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2004-05-18 Bogdan Gheorghe
|
||||||
|
IndexAllProject - restored the save request.
|
||||||
|
|
||||||
2004-05-18 Bogdan Gheorghe
|
2004-05-18 Bogdan Gheorghe
|
||||||
First go at putting in source folder indexing. Index All events will index
|
First go at putting in source folder indexing. Index All events will index
|
||||||
source folders (still need to put in includes indexing). DeltaProcessor only
|
source folders (still need to put in includes indexing). DeltaProcessor only
|
||||||
|
|
|
@ -99,6 +99,8 @@ public class IndexAllProject extends IndexRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// request to save index when all cus have been indexed
|
||||||
|
this.manager.request(new SaveIndex(this.indexPath, this.manager));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
if (IndexManager.VERBOSE) {
|
if (IndexManager.VERBOSE) {
|
||||||
JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
|
JobManager.verbose("-> failed to index " + this.project + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -425,8 +425,11 @@ public class DeltaProcessor {
|
||||||
* resource by the sender of this method.
|
* resource by the sender of this method.
|
||||||
*/
|
*/
|
||||||
protected void traverseDelta(ICElement parent, IResourceDelta delta) {
|
protected void traverseDelta(ICElement parent, IResourceDelta delta) {
|
||||||
|
boolean updateChildren = true;
|
||||||
try {
|
try {
|
||||||
ICElement current = updateCurrentDeltaAndIndex(delta);
|
IResource resource = delta.getResource();
|
||||||
|
ICElement current = createElement(resource);
|
||||||
|
updateChildren = updateCurrentDeltaAndIndex(delta);
|
||||||
if (current == null || current instanceof ISourceRoot ||
|
if (current == null || current instanceof ISourceRoot ||
|
||||||
(current instanceof ICProject && !((ICProject)current).getProject().isOpen())) {
|
(current instanceof ICProject && !((ICProject)current).getProject().isOpen())) {
|
||||||
nonCResourcesChanged(parent, delta);
|
nonCResourcesChanged(parent, delta);
|
||||||
|
@ -435,11 +438,13 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
|
if (updateChildren){
|
||||||
IResourceDelta [] children = delta.getAffectedChildren();
|
IResourceDelta [] children = delta.getAffectedChildren();
|
||||||
for (int i = 0; i < children.length; i++) {
|
for (int i = 0; i < children.length; i++) {
|
||||||
traverseDelta(parent, children[i]);
|
traverseDelta(parent, children[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the resource delta to the right CElementDelta tree.
|
* Add the resource delta to the right CElementDelta tree.
|
||||||
|
@ -480,7 +485,7 @@ public class DeltaProcessor {
|
||||||
* Returns whether the children of the given delta must be processed.
|
* Returns whether the children of the given delta must be processed.
|
||||||
* @throws a CModelException if the delta doesn't correspond to a c element of the given type.
|
* @throws a CModelException if the delta doesn't correspond to a c element of the given type.
|
||||||
*/
|
*/
|
||||||
private ICElement updateCurrentDeltaAndIndex(IResourceDelta delta) throws CModelException {
|
private boolean updateCurrentDeltaAndIndex(IResourceDelta delta) throws CModelException {
|
||||||
|
|
||||||
IResource resource = delta.getResource();
|
IResource resource = delta.getResource();
|
||||||
ICElement element = createElement(resource);
|
ICElement element = createElement(resource);
|
||||||
|
@ -491,14 +496,14 @@ public class DeltaProcessor {
|
||||||
updateIndexAddResource(element, delta);
|
updateIndexAddResource(element, delta);
|
||||||
elementAdded(element, delta);
|
elementAdded(element, delta);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
|
|
||||||
case IResourceDelta.REMOVED :
|
case IResourceDelta.REMOVED :
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
updateIndexRemoveResource(element, delta);
|
updateIndexRemoveResource(element, delta);
|
||||||
elementRemoved(element, delta);
|
elementRemoved(element, delta);
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
|
|
||||||
case IResourceDelta.CHANGED :
|
case IResourceDelta.CHANGED :
|
||||||
int flags = delta.getFlags();
|
int flags = delta.getFlags();
|
||||||
|
@ -523,6 +528,8 @@ public class DeltaProcessor {
|
||||||
elementClosed(element, delta);
|
elementClosed(element, delta);
|
||||||
updateIndexRemoveResource(element, delta);
|
updateIndexRemoveResource(element, delta);
|
||||||
}
|
}
|
||||||
|
//Don't process children
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((flags & IResourceDelta.DESCRIPTION) != 0) {
|
if ((flags & IResourceDelta.DESCRIPTION) != 0) {
|
||||||
|
@ -541,13 +548,14 @@ public class DeltaProcessor {
|
||||||
elementRemoved(element, delta);
|
elementRemoved(element, delta);
|
||||||
updateIndexRemoveResource(element, delta);
|
updateIndexRemoveResource(element, delta);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
return element;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
|
protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue