mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
make getChildren async for bin and arc containers
This commit is contained in:
parent
a21b0d6c09
commit
d36366a47c
4 changed files with 16 additions and 53 deletions
|
@ -28,18 +28,18 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IArchive[] getArchives() {
|
public IArchive[] getArchives() {
|
||||||
ICElement[] e = getChildren(false);
|
ICElement[] e = getChildren(true);
|
||||||
IArchive[] a = new IArchive[e.length];
|
IArchive[] a = new IArchive[e.length];
|
||||||
System.arraycopy(e, 0, a, 0, e.length);
|
System.arraycopy(e, 0, a, 0, e.length);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChildren() {
|
public boolean hasChildren() {
|
||||||
return (getChildren().length > 0);
|
return (getChildren(true).length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement [] getChildren() {
|
public ICElement [] getChildren() {
|
||||||
return getChildren(true);
|
return getChildren(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement [] getChildren(boolean sync) {
|
public ICElement [] getChildren(boolean sync) {
|
||||||
|
@ -61,14 +61,6 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
|
||||||
return super.getChildren();
|
return super.getChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public IResource getUnderlyingResource() {
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// public IResource getCorrespondingResource() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
void addChildIfLib(IFile file) {
|
void addChildIfLib(IFile file) {
|
||||||
CModelManager factory = CModelManager.getDefault();
|
CModelManager factory = CModelManager.getDefault();
|
||||||
if (factory.isArchive(file)) {
|
if (factory.isArchive(file)) {
|
||||||
|
|
|
@ -113,35 +113,4 @@ public class BinaryContainer extends Parent implements IBinaryContainer {
|
||||||
return true;
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,16 +319,17 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeChildrenContainer(Parent container, IResource resource) {
|
private void removeChildrenContainer(Parent container, IResource resource) {
|
||||||
ICElement[] children = container.getChildren();
|
if ( container.hasChildren() ) {
|
||||||
for (int i = 0; i < children.length; i++) {
|
ICElement[] children = container.getChildren();
|
||||||
try {
|
for (int i = 0; i < children.length; i++) {
|
||||||
IResource r = children[i].getUnderlyingResource();
|
try {
|
||||||
if (r.equals(resource)) {
|
IResource r = children[i].getUnderlyingResource();
|
||||||
//System.out.println("RELEASE Archive/binary " + children[i].getElementName());
|
if (r.equals(resource)) {
|
||||||
container.removeChild(children[i]);
|
container.removeChild(children[i]);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,9 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
for( int i = 0; i < children.length; i++ ) {
|
for( int i = 0; i < children.length; i++ ) {
|
||||||
// Note, here we are starting the Archive and binary containers thread upfront.
|
// Note, here we are starting the Archive and binary containers thread upfront.
|
||||||
if (children[i] instanceof IArchiveContainer || children[i] instanceof IBinaryContainer) {
|
if (children[i] instanceof IArchiveContainer || children[i] instanceof IBinaryContainer) {
|
||||||
((IParent)children[i]).getChildren();
|
if ( ((IParent)children[i]).getChildren().length == 0 ) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
list.add(children[i]);
|
list.add(children[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue