Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TreeViewer Collapses on refresh(TreeViewer Collapses on refresh)
TreeViewer Collapses on refresh [message #659120] Fri, 11 March 2011 07:32 Go to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Hi,
I have a FilteredTree which is defined as follows:-
PatternFilter patternFilter = new PatternFilter();
final FilteredTree filteredTree = new FilteredTree(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, patternFilter);
TreeViewer treeViewer = filteredTree.getViewer();


I have an action whose selection or de-selection refreshes the tree. But when the treeviewer is refreshed, the tree gets collapsed. How can I prevent my tree from getting collapsed?

I am using the the following code for treeviewer refresh:-
actionShowObjects = new Action("Show Objects") {

				@Override
				public void run() {
					treeViewer.refresh();
					}

			};
			actionShowObjects.setChecked(true);


Regards,
Animesh
Re: TreeViewer Collapses on refresh [message #659161 is a reply to message #659120] Fri, 11 March 2011 10:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Your problem is very likely that you are recreating your domain objects
in your content provider and so you need to help the TableViewer to map
the old instance to the new one which is normally done by setting an
IElementComparer on the viewer.

Tom

Am 11.03.11 08:32, schrieb Animesh Kumar:
> Hi,
> I have a FilteredTree which is defined as follows:-
> PatternFilter patternFilter = new PatternFilter();
> final FilteredTree filteredTree = new FilteredTree(container, SWT.MULTI
> | SWT.H_SCROLL | SWT.V_SCROLL, patternFilter);
> TreeViewer treeViewer = filteredTree.getViewer();
>
>
> I have an action whose selection or de-selection refreshes the tree. But
> when the treeviewer is refreshed, the tree gets collapsed. How can I
> prevent my tree from getting collapsed?
>
> I am using the the following code for treeviewer refresh:-
>
> actionShowObjects = new Action("Show Objects") {
>
> @Override
> public void run() {
> treeViewer.refresh();
> }
>
> };
> actionShowObjects.setChecked(true);
>
Re: TreeViewer Collapses on refresh [message #659163 is a reply to message #659161] Fri, 11 March 2011 10:30 Go to previous message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Hi Tom,
Thanx for the reply. If you don't mind, can you give a small example on how i can use the IElementComparer for the TreeViewer.


Regards,
Animesh
Previous Topic:Virtual tableViewer
Next Topic:Regarding TreeViewer
Goto Forum:
  


Current Time: Fri Apr 26 20:34:13 GMT 2024

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

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

Back to the top