mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Fix to the DeltaProcessor.
This commit is contained in:
parent
9e35ee6963
commit
61799d7c74
1 changed files with 27 additions and 20 deletions
|
@ -172,6 +172,10 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void elementChanged(ICElement element, IResourceDelta delta) {
|
||||||
|
fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic processing for a removed element:<ul>
|
* Generic processing for a removed element:<ul>
|
||||||
* <li>Close the element, removing its structure from the cache
|
* <li>Close the element, removing its structure from the cache
|
||||||
|
@ -261,7 +265,6 @@ public class DeltaProcessor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ICElement root = (ICModel)CModelManager.getDefault().getCModel();
|
ICElement root = (ICModel)CModelManager.getDefault().getCModel();
|
||||||
currentElement = null;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
|
@ -294,7 +297,7 @@ public class DeltaProcessor {
|
||||||
for (int i = 0; i < deltas.length; i++) {
|
for (int i = 0; i < deltas.length; i++) {
|
||||||
IResourceDelta delta = deltas[i];
|
IResourceDelta delta = deltas[i];
|
||||||
fCurrentDelta = new CElementDelta(root);
|
fCurrentDelta = new CElementDelta(root);
|
||||||
traverseDelta(delta); // traverse delta
|
traverseDelta(root, delta); // traverse delta
|
||||||
translatedDeltas[i] = fCurrentDelta;
|
translatedDeltas[i] = fCurrentDelta;
|
||||||
}
|
}
|
||||||
return filterRealDeltas(translatedDeltas);
|
return filterRealDeltas(translatedDeltas);
|
||||||
|
@ -309,29 +312,33 @@ public class DeltaProcessor {
|
||||||
* If it is not a resource on the classpath, it will be added as a non-java
|
* If it is not a resource on the classpath, it will be added as a non-java
|
||||||
* resource by the sender of this method.
|
* resource by the sender of this method.
|
||||||
*/
|
*/
|
||||||
protected void traverseDelta(IResourceDelta delta) {
|
protected void traverseDelta(ICElement parent, IResourceDelta delta) {
|
||||||
try {
|
try {
|
||||||
if (!updateCurrentDeltaAndIndex(delta)) {
|
ICElement current = updateCurrentDeltaAndIndex(delta);
|
||||||
nonCResourcesChanged(delta);
|
if (current == null) {
|
||||||
|
nonCResourcesChanged(parent, delta);
|
||||||
|
} else {
|
||||||
|
parent = current;
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
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(children[i]);
|
traverseDelta(parent, children[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void nonCResourcesChanged(IResourceDelta delta) {
|
protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
|
||||||
fCurrentDelta.addResourceDelta(delta);
|
CElementDelta elementDelta = fCurrentDelta.find(parent);
|
||||||
IResource res = delta.getResource();
|
if (elementDelta == null) {
|
||||||
if (res != null) {
|
fCurrentDelta.changed(parent, ICElementDelta.F_CONTENT);
|
||||||
ICElement celem = createElement(res.getParent());
|
elementDelta = fCurrentDelta;
|
||||||
if (celem instanceof CContainer) {
|
}
|
||||||
CElementInfo info = ((CContainer)celem).getElementInfo();
|
elementDelta.addResourceDelta(delta);
|
||||||
if (info instanceof CContainerInfo) {
|
if (parent instanceof CContainer) {
|
||||||
((CContainerInfo)info).setNonCResources(null);
|
CElementInfo info = ((CContainer)parent).getElementInfo();
|
||||||
}
|
if (info instanceof CContainerInfo) {
|
||||||
|
((CContainerInfo)info).setNonCResources(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +349,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 boolean updateCurrentDeltaAndIndex(IResourceDelta delta) throws CModelException {
|
private ICElement updateCurrentDeltaAndIndex(IResourceDelta delta) throws CModelException {
|
||||||
|
|
||||||
IResource resource = delta.getResource();
|
IResource resource = delta.getResource();
|
||||||
ICElement element = createElement(resource);
|
ICElement element = createElement(resource);
|
||||||
|
@ -388,14 +395,14 @@ public class DeltaProcessor {
|
||||||
elementAdded(element, delta);
|
elementAdded(element, delta);
|
||||||
}
|
}
|
||||||
} else if (element != null) {
|
} else if (element != null) {
|
||||||
elementAdded(element, delta);
|
elementChanged(element, delta);
|
||||||
}
|
}
|
||||||
} else if (element != null) {
|
} else if (element != null) {
|
||||||
elementAdded(element, delta);
|
elementChanged(element, delta);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return element != null;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
|
protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue