Auto-expanding TreeView? [message #331892] |
Fri, 26 September 2008 14:51  |
Eclipse User |
|
|
|
Originally posted by: rob.brainkandy-dot-org.org
Hello all,
I'm trying to build code that gets an editor's outline to match the editor's
cursor position. I've done a decent job matching behavior of the JavaEditor
(calling treeViewer.setAutoExpandLevel(-1) to expand all levels.)
However, the viewer seems to fail to do that, *unless* I've already manually
expanded that part of the tree.
I've confirmed that I am able to get to the underlying item in the associated model.
Then I have this code:
ISelection newSelection = element == null ? StructuredSelection.EMPTY :
new StructuredSelection(element);
TreeViewer viewer = getTreeViewer();
if (viewer != null) {
viewer.removeSelectionChangedListener(selectionListener);
viewer.setSelection(newSelection, true);
viewer.addSelectionChangedListener(selectionListener);
}
}
I see in the TreeViewer.setSelection method is this documentation:
* <b>Currently the <code>reveal</code> parameter is not honored because
* {@link Tree} does not provide an API to only select an item without
* scrolling it into view</b>
* </p>
OK, for me personally, I would want the item to scroll in to view.
Any suggestions?
|
|
|
|
|
Re: Auto-expanding TreeView? [message #332101 is a reply to message #331930] |
Thu, 02 October 2008 18:23  |
Eclipse User |
|
|
|
Originally posted by: rob.brainkandy-dot-org.org
Robert Konigsberg wrote:
> Boris Bokowski wrote:
>
>>> I'm trying to build code that gets an editor's outline to match the
>>> editor's cursor position. I've done a decent job matching behavior of
>>> the JavaEditor (calling treeViewer.setAutoExpandLevel(-1) to expand
>>> all levels.)
>>>
>>> However, the viewer seems to fail to do that, *unless* I've already
>>> manually expanded that part of the tree.
>>
>>
>>
>> Does your content provider return a non-null value from getParent()?
>
>
> Yes. (That is, getParent is returning non-nulls.)
I might be able to debug this, but I wonder if anyone might have a suggestion
about the right place to debug. What might be failing?
|
|
|
Powered by
FUDForum. Page generated in 0.02750 seconds