[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] pb building TreeView
|
I'm trying to build a TreeView in my perspective to have a look on a DOM
tree built in memory.
I've implemented the TreeView with new TreeViewer, called
setContentProvider() and setLabelProvider(). setInput() gets the
rootElement of my DOM tree. Then in class contentProvider, the tree is
being built by getChildren(), and everything seems ok.
here's the code to get the children:
public Object[] getChildren(Object element) {
Object elnts[]=new Object[20];
int i = 0;
int j=((Element)element).getChildNodes().getLength();
for(Node child = ((Element)element).getFirstChild(); i<j;
((Element)element).getNextSibling()){
elnts[i]=((Element)element).getChildNodes().item(i);
i++;
}
return elnts;
}
I don't really know what happens BUT when it arrives at the end, when no
more child or items, it tries to continue and to create the tree and the
following message appears:
"Unable to create part: Tree" from
eclipse.core.internal.runtime.InternalPlatform
and the exception: "nullPointerException".
Does anybody have an idea of what I need to do, or what I missed ?
many thx