SetSelection programmatically in TreeViewer causes no event? [message #466022] |
Thu, 12 April 2007 14:56 |
Eclipse User |
|
|
|
Originally posted by: s_haeusler.web.de
Hello,
in an RCP Application i am using a view with a JFace tree viewer. Other
views should react on selection of an item in this tree
Therefore a set the tree viewer as a selection provider for the site as
follows:
getSite().setSelectionProvider(viewer);
The view that should listen to the selection implements ISelectionListener
and is registered as follows:
getViewSite().getPage().addSelectionListener(this);
When i set the selection with the mouse or keyboard all is correct, the view
that listens to the selection does the right thing.
But now my question: When i set the selection programmatically
this.viewer.setSelection(new StructuredSelection(...))
the selection is set to the tree, but it seems that there is no event
thrown, because nothing happens in the other view.
Am i doing something wrong? Does the programmatically called setSelection
does not throw a selection? How can i fire a selection event on myself, if
that is the case?
Greetings
|
|
|
|
|
Re: SetSelection programmatically in TreeViewer causes no event? [message #466077 is a reply to message #466050] |
Fri, 13 April 2007 09:00 |
Eclipse User |
|
|
|
Originally posted by: s_haeusler.web.de
Hello,
thanks for the answer.
Yes, the selection is set to the tree.
I looked a little bit deeper into the code that is executed when a
selection is programmatically set.
It seems that an event is fired and all registered
ISelectionChangedListener implementations (JFace API) are notified. As
said in the first posting, i registered an ISelectionListener
(org.eclipse.ui Plug-In).
So for me it seems, that an event is fired, but the an ISelectionListener
is not notified.
Instead i have to register an ISelectionChangedListener? Seems a little
bit odd to me that i need two different listener for (for me) the same
thing
Greetings
|
|
|
Powered by
FUDForum. Page generated in 0.03252 seconds