Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Auto-expanding TreeView?
Auto-expanding TreeView? [message #331892] Fri, 26 September 2008 18:51 Go to next message
Eclipse UserFriend
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 #331898 is a reply to message #331892] Sat, 27 September 2008 04:24 Go to previous messageGo to next message
Boris Bokowski is currently offline Boris BokowskiFriend
Messages: 272
Registered: July 2009
Senior Member
> 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()?
Re: Auto-expanding TreeView? [message #331930 is a reply to message #331898] Mon, 29 September 2008 18:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rob.brainkandy-dot-org.org

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.)
Re: Auto-expanding TreeView? [message #332101 is a reply to message #331930] Thu, 02 October 2008 22:23 Go to previous message
Eclipse UserFriend
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?
Previous Topic:[DataBinding] refreshing values in Tree/validate with ObservableMapLabelProvider
Next Topic:IPluginBase.getLibraries() returning "bin"?
Goto Forum:
  


Current Time: Wed Sep 18 16:45:27 GMT 2024

Powered by FUDForum. Page generated in 0.03499 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top