mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
remove contentChanged() and only use
elementChanged(). close() the openable when content changed.
This commit is contained in:
parent
0ab192cb95
commit
b1afbfd7c7
1 changed files with 23 additions and 13 deletions
|
@ -44,17 +44,6 @@ public class DeltaProcessor {
|
||||||
// Hold on the element bein renamed.
|
// Hold on the element bein renamed.
|
||||||
ICElement movedFromElement = null;
|
ICElement movedFromElement = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic processing for elements with changed contents:<ul>
|
|
||||||
* <li>The element is closed such that any subsequent accesses will re-open
|
|
||||||
* the element reflecting its new structure.
|
|
||||||
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
protected void contentChanged(ICElement element, IResourceDelta delta) {
|
|
||||||
fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the create corresponding to this resource.
|
* Creates the create corresponding to this resource.
|
||||||
* Returns null if none was found.
|
* Returns null if none was found.
|
||||||
|
@ -206,8 +195,29 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Closes the given element, which removes it from the cache of open elements.
|
||||||
|
*/
|
||||||
|
private void close(Openable element) {
|
||||||
|
try {
|
||||||
|
element.close();
|
||||||
|
} catch (CModelException e) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic processing for elements with changed contents:<ul>
|
||||||
|
* <li>The element is closed such that any subsequent accesses will re-open
|
||||||
|
* the element reflecting its new structure.
|
||||||
|
* <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
protected void elementChanged(ICElement element, IResourceDelta delta) {
|
protected void elementChanged(ICElement element, IResourceDelta delta) {
|
||||||
fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
|
if (element instanceof Openable) {
|
||||||
|
close((Openable)element);
|
||||||
|
}
|
||||||
|
fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -403,7 +413,7 @@ public class DeltaProcessor {
|
||||||
if ((flags & IResourceDelta.CONTENT) != 0) {
|
if ((flags & IResourceDelta.CONTENT) != 0) {
|
||||||
// content has changed
|
// content has changed
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
contentChanged(element, delta);
|
elementChanged(element, delta);
|
||||||
updateIndexAddResource(element, delta);
|
updateIndexAddResource(element, delta);
|
||||||
}
|
}
|
||||||
} else if (resource.getType() == IResource.PROJECT) {
|
} else if (resource.getType() == IResource.PROJECT) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue