mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Performance improving in the DeltaProcessor
This commit is contained in:
parent
07f291d778
commit
7ba1b68964
4 changed files with 46 additions and 8 deletions
|
@ -1,3 +1,17 @@
|
||||||
|
2004-02-29 Alain Magloire
|
||||||
|
|
||||||
|
Performance improvements in the Deltaprocessing
|
||||||
|
In the CContainerInfo.nonCResources() do not try
|
||||||
|
to recreate the ICElement.
|
||||||
|
Fire Deltas when Binaries are deleted to update
|
||||||
|
the BinaryContainer.
|
||||||
|
The DeltaProcessor was close()ing the Openable
|
||||||
|
uncessary leading to performance lost.
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/CContainerInfo.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/CModelManager.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
|
||||||
|
|
||||||
2004-02-28 Alain Magloire
|
2004-02-28 Alain Magloire
|
||||||
Fix PE Parser
|
Fix PE Parser
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,23 @@ public class CContainerInfo extends OpenableInfo {
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
CModelManager factory = CModelManager.getDefault();
|
CModelManager factory = CModelManager.getDefault();
|
||||||
for (int i = 0; i < resources.length; i++) {
|
for (int i = 0; i < resources.length; i++) {
|
||||||
// Check for Valid C projects only.
|
ICElement[] children = getChildren();
|
||||||
ICElement celement = factory.create(parent, resources[i]);
|
boolean found = false;
|
||||||
if (celement == null) {
|
for (int j = 0; j < children.length; j++) {
|
||||||
|
IResource r = children[j].getResource();
|
||||||
|
if (r.equals(resources[i])){
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
notChildren.add(resources[i]);
|
notChildren.add(resources[i]);
|
||||||
}
|
}
|
||||||
|
// Check for Valid C projects only.
|
||||||
|
//ICElement celement = factory.create(parent, resources[i]);
|
||||||
|
//if (celement == null) {
|
||||||
|
// notChildren.add(resources[i]);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -311,12 +311,18 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
CProject cproj = (CProject)celement.getCProject();
|
CProject cproj = (CProject)celement.getCProject();
|
||||||
ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
|
ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
|
||||||
container.removeChild(celement);
|
container.removeChild(celement);
|
||||||
|
CElementDelta delta = new CElementDelta(getCModel());
|
||||||
|
delta.changed(container, ICElementDelta.CHANGED);
|
||||||
|
registerCModelDelta(delta);
|
||||||
} else if (type == ICElement.C_BINARY) {
|
} else if (type == ICElement.C_BINARY) {
|
||||||
if (! ((IBinary)celement).isObject()) {
|
if (! ((IBinary)celement).isObject()) {
|
||||||
//System.out.println("RELEASE Binary " + cfile.getElementName());
|
//System.out.println("RELEASE Binary " + cfile.getElementName());
|
||||||
CProject cproj = (CProject)celement.getCProject();
|
CProject cproj = (CProject)celement.getCProject();
|
||||||
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
||||||
container.removeChild(celement);
|
container.removeChild(celement);
|
||||||
|
CElementDelta delta = new CElementDelta(getCModel());
|
||||||
|
delta.changed(container, ICElementDelta.CHANGED);
|
||||||
|
registerCModelDelta(delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,10 +375,19 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the resource delta to the right CElementDelta tree.
|
||||||
|
* @param parent
|
||||||
|
* @param delta
|
||||||
|
*/
|
||||||
protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
|
protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
|
||||||
CElementDelta elementDelta = fCurrentDelta.find(parent);
|
CElementDelta elementDelta = fCurrentDelta.find(parent);
|
||||||
if (elementDelta == null) {
|
if (elementDelta == null) {
|
||||||
fCurrentDelta.changed(parent, ICElementDelta.F_CONTENT);
|
fCurrentDelta.changed(parent, ICElementDelta.F_CONTENT);
|
||||||
|
elementDelta = fCurrentDelta.find(parent);
|
||||||
|
if (elementDelta != null) {
|
||||||
|
elementDelta.addResourceDelta(delta);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
elementDelta.addResourceDelta(delta);
|
elementDelta.addResourceDelta(delta);
|
||||||
}
|
}
|
||||||
|
@ -443,15 +452,12 @@ public class DeltaProcessor {
|
||||||
updateIndexRemoveResource(element, delta);
|
updateIndexRemoveResource(element, delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((flags & IResourceDelta.DESCRIPTION) != 0) {
|
}
|
||||||
|
if ((flags & IResourceDelta.DESCRIPTION) != 0) {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
elementAdded(element, delta);
|
elementAdded(element, delta);
|
||||||
}
|
}
|
||||||
} else if (element != null) {
|
|
||||||
elementChanged(element, delta);
|
|
||||||
}
|
}
|
||||||
} else if (element != null) {
|
|
||||||
elementChanged(element, delta);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue