1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

make getChildren async for bin and arc containers

This commit is contained in:
David Inglis 2002-09-23 16:44:44 +00:00
parent a21b0d6c09
commit d36366a47c
4 changed files with 16 additions and 53 deletions

View file

@ -28,18 +28,18 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
}
public IArchive[] getArchives() {
ICElement[] e = getChildren(false);
ICElement[] e = getChildren(true);
IArchive[] a = new IArchive[e.length];
System.arraycopy(e, 0, a, 0, e.length);
return a;
}
public boolean hasChildren() {
return (getChildren().length > 0);
return (getChildren(true).length > 0);
}
public ICElement [] getChildren() {
return getChildren(true);
return getChildren(false);
}
public ICElement [] getChildren(boolean sync) {
@ -61,14 +61,6 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
return super.getChildren();
}
//public IResource getUnderlyingResource() {
// return null;
//}
// public IResource getCorrespondingResource() {
// return null;
// }
void addChildIfLib(IFile file) {
CModelManager factory = CModelManager.getDefault();
if (factory.isArchive(file)) {

View file

@ -113,35 +113,4 @@ public class BinaryContainer extends Parent implements IBinaryContainer {
return true;
}
}
class BinaryRunnable implements Runnable {
BinaryContainer cbin;
public BinaryRunnable(BinaryContainer element) {
cbin = element;
}
public void run() {
try {
((IProject)cbin.getCProject().getUnderlyingResource()).accept(new Visitor(cbin));
} catch (CoreException e) {
//e.printStackTrace();
}
// Fired the event.
ICElement[] children = cbin.getChildren();
if (children.length > 0) {
CModelManager factory = CModelManager.getDefault();
ICElement root = (ICRoot)factory.getCRoot();
CElementDelta cdelta = new CElementDelta(root);
cdelta.added(cbin.getCProject());
cdelta.added(cbin);
for (int i = 0; i < children.length; i++) {
ICElement child = children[i];
cdelta.added(child);
}
factory.registerCModelDelta(cdelta);
factory.fire();
}
}
}
}

View file

@ -319,12 +319,12 @@ public class CModelManager implements IResourceChangeListener {
}
private void removeChildrenContainer(Parent container, IResource resource) {
if ( container.hasChildren() ) {
ICElement[] children = container.getChildren();
for (int i = 0; i < children.length; i++) {
try {
IResource r = children[i].getUnderlyingResource();
if (r.equals(resource)) {
//System.out.println("RELEASE Archive/binary " + children[i].getElementName());
container.removeChild(children[i]);
break;
}
@ -332,6 +332,7 @@ public class CModelManager implements IResourceChangeListener {
}
}
}
}
public void releaseCElement(IResource resource) {

View file

@ -123,9 +123,10 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
for( int i = 0; i < children.length; i++ ) {
// Note, here we are starting the Archive and binary containers thread upfront.
if (children[i] instanceof IArchiveContainer || children[i] instanceof IBinaryContainer) {
((IParent)children[i]).getChildren();
if ( ((IParent)children[i]).getChildren().length == 0 ) {
continue;
}
}
list.add(children[i]);
}
return list.toArray();