Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » how to use treeViewer getExpandedElements method
how to use treeViewer getExpandedElements method [message #414847] Mon, 26 November 2007 11:09 Go to next message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 108
Registered: July 2009
Senior Member
Hi,

I am using some of the EMF generated Editor code of my Model to display a TreeViewer in a View. I
have a filter on the TreeViewer that filters the tree based on whatever the user selects in a
dropdown. When a user makes a particular selection in the dropdown, it may result in an element
being filtered out of the viewer, and what I want to do is keep track of the expansion state of
these elements that are filtered out so that I can restore the expansion state when it gets filtered
back into the view.

I have seen the Treeviewer getExpandedElements and setExpandedElements methods in the TreeViewer API
doc which I think will do the job, however I could find any examples of their usage. I tried using
them within the select method of the ViewerFilter class, so that if an element was being filtered
out the viewer would retain a reference to the expanded elements and then restore the expansion
state when the elements were filtered back in, but this did not work. Does anyone know any examples
of the correct usage of these methods or point out where they should be used?

Many thanks,
Conor
Re: how to use treeViewer getExpandedElements method [message #414849 is a reply to message #414847] Mon, 26 November 2007 11:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Conor,

org.eclipse.ui.views.navigator.ResourceNavigator.restoreStat e uses it.


Conor O'Mahony wrote:
> Hi,
>
> I am using some of the EMF generated Editor code of my Model to
> display a TreeViewer in a View. I have a filter on the TreeViewer that
> filters the tree based on whatever the user selects in a dropdown.
> When a user makes a particular selection in the dropdown, it may
> result in an element being filtered out of the viewer, and what I want
> to do is keep track of the expansion state of these elements that are
> filtered out so that I can restore the expansion state when it gets
> filtered back into the view.
>
> I have seen the Treeviewer getExpandedElements and setExpandedElements
> methods in the TreeViewer API doc which I think will do the job,
> however I could find any examples of their usage. I tried using them
> within the select method of the ViewerFilter class, so that if an
> element was being filtered out the viewer would retain a reference to
> the expanded elements and then restore the expansion state when the
> elements were filtered back in, but this did not work. Does anyone
> know any examples of the correct usage of these methods or point out
> where they should be used?
>
> Many thanks,
> Conor


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to use treeViewer getExpandedElements method [message #414850 is a reply to message #414849] Mon, 26 November 2007 12:00 Go to previous messageGo to next message
Conor O'Mahony is currently offline Conor O'MahonyFriend
Messages: 108
Registered: July 2009
Senior Member
What plugin/package is this class in? I can't find it to view the source in my current setup, and I
can't find it in org.eclipse.ui.views_3.2.100.I20070319-0010.jar

I'm using eclipse 3.2.

Ed Merks wrote:
> Conor,
>
> org.eclipse.ui.views.navigator.ResourceNavigator.restoreStat e uses it.
>
>
> Conor O'Mahony wrote:
>> Hi,
>>
>> I am using some of the EMF generated Editor code of my Model to
>> display a TreeViewer in a View. I have a filter on the TreeViewer that
>> filters the tree based on whatever the user selects in a dropdown.
>> When a user makes a particular selection in the dropdown, it may
>> result in an element being filtered out of the viewer, and what I want
>> to do is keep track of the expansion state of these elements that are
>> filtered out so that I can restore the expansion state when it gets
>> filtered back into the view.
>>
>> I have seen the Treeviewer getExpandedElements and setExpandedElements
>> methods in the TreeViewer API doc which I think will do the job,
>> however I could find any examples of their usage. I tried using them
>> within the select method of the ViewerFilter class, so that if an
>> element was being filtered out the viewer would retain a reference to
>> the expanded elements and then restore the expansion state when the
>> elements were filtered back in, but this did not work. Does anyone
>> know any examples of the correct usage of these methods or point out
>> where they should be used?
>>
>> Many thanks,
>> Conor
Re: how to use treeViewer getExpandedElements method [message #414851 is a reply to message #414850] Mon, 26 November 2007 12:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Conor,

Given I've specified the fully qualified package name, that part should
be clear. It's in the org.eclipse.ui.ide plugin.


Conor O'Mahony wrote:
> What plugin/package is this class in? I can't find it to view the
> source in my current setup, and I can't find it in
> org.eclipse.ui.views_3.2.100.I20070319-0010.jar
>
> I'm using eclipse 3.2.
>
> Ed Merks wrote:
>> Conor,
>>
>> org.eclipse.ui.views.navigator.ResourceNavigator.restoreStat e uses it.
>>
>>
>> Conor O'Mahony wrote:
>>> Hi,
>>>
>>> I am using some of the EMF generated Editor code of my Model to
>>> display a TreeViewer in a View. I have a filter on the TreeViewer
>>> that filters the tree based on whatever the user selects in a
>>> dropdown. When a user makes a particular selection in the dropdown,
>>> it may result in an element being filtered out of the viewer, and
>>> what I want to do is keep track of the expansion state of these
>>> elements that are filtered out so that I can restore the expansion
>>> state when it gets filtered back into the view.
>>>
>>> I have seen the Treeviewer getExpandedElements and
>>> setExpandedElements methods in the TreeViewer API doc which I think
>>> will do the job, however I could find any examples of their usage. I
>>> tried using them within the select method of the ViewerFilter class,
>>> so that if an element was being filtered out the viewer would retain
>>> a reference to the expanded elements and then restore the expansion
>>> state when the elements were filtered back in, but this did not
>>> work. Does anyone know any examples of the correct usage of these
>>> methods or point out where they should be used?
>>>
>>> Many thanks,
>>> Conor


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Setting up Eclipse for Reflective API
Next Topic:Serializing/Deserializing subtypes
Goto Forum:
  


Current Time: Thu Apr 25 14:38:04 GMT 2024

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

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

Back to the top