use of org.eclipse.ui.model.AdaptableList in project ecf by eclipse.
the class WizardContentProvider method getChildren.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof WizardCollectionElement) {
ArrayList list = new ArrayList();
WizardCollectionElement element = (WizardCollectionElement) parentElement;
Object[] childCollections = element.getChildren();
for (int i = 0; i < childCollections.length; i++) {
handleChild(childCollections[i], list);
}
Object[] childWizards = element.getWizards();
for (int i = 0; i < childWizards.length; i++) {
handleChild(childWizards[i], list);
}
// flatten lists with only one category
if (list.size() == 1 && list.get(0) instanceof WizardCollectionElement)
return getChildren(list.get(0));
return list.toArray();
} else if (parentElement instanceof AdaptableList) {
AdaptableList aList = (AdaptableList) parentElement;
Object[] children = aList.getChildren();
ArrayList list = new ArrayList(children.length);
for (int i = 0; i < children.length; i++) {
handleChild(children[i], list);
}
// (flatten list)
if (list.size() == 1 && list.get(0) instanceof WizardCollectionElement)
return getChildren(list.get(0));
return list.toArray();
} else
return new Object[0];
}
use of org.eclipse.ui.model.AdaptableList in project tracecompass by tracecompass.
the class TraceFileSystemElement method getAllChildren.
/**
* Get all the TraceFileSystemElements recursively.
*
* @param result
* the list accumulating the result
*/
public void getAllChildren(List<TraceFileSystemElement> result) {
AdaptableList files = getFiles();
for (Object file : files.getChildren()) {
result.add((TraceFileSystemElement) file);
}
AdaptableList folders = getFolders();
for (Object folder : folders.getChildren()) {
TraceFileSystemElement traceElementFolder = (TraceFileSystemElement) folder;
traceElementFolder.getAllChildren(result);
}
}
Aggregations