Skip to main content



      Home
Home » Eclipse Projects » JFace » TreeViewer Collapses on refresh(TreeViewer Collapses on refresh)
TreeViewer Collapses on refresh [message #659120] Fri, 11 March 2011 02:32 Go to next message
Eclipse UserFriend
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 #659161 is a reply to message #659120] Fri, 11 March 2011 05:13 Go to previous messageGo to next message
Eclipse UserFriend
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 05:30 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Virtual tableViewer
Next Topic:Regarding TreeViewer
Goto Forum:
  


Current Time: Sat Jul 05 18:10:46 EDT 2025

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

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

Back to the top