[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: TreeViewer with visible root

Sarah Ettritch wrote:
<matthall@xxxxxxxxxxxxxxxxx> wrote in message news:fsjjmo$ll0$1@xxxxxxxxxxxxxxxxxxxx
getElements(inputElement) is for the root elements. The passed-in object is *always* the viewer input.
getChildren(parentElement) is for all levels beneath the root elements.

Aha! In my case, the inputElement is also a rootElement (actually, it's the only root element). Is that the problem? If so, how can I display an entire tree model in a TreeViewer, including its root, without having to root the root with a fake root?




Doing some further digging, it appears that TreeViewer does not make this distinction internally. A single method is used to determine the children of the element (root or otherwise), and inside that method it decides whether to call getElements() or getChildren() based on whether the parent element is "equal" to the viewer's input. Thus getChildren() is never called because the getElements() result is always { input }.


Would you file a bug for this?
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=UI

To speed up triage, prepend the summary with "[Viewers]".

Matthew