SelectionProviders in RAP have strange behavior [message #1042111] |
Tue, 16 April 2013 02:06 |
Mark Leone Messages: 69 Registered: April 2012 |
Member |
|
|
I've been asked to provide a RAP implementation for an existing RCP app. The app has numerous Views, each with several viewers, and it uses the selection service to coordinate selections between designated viewers. There is a SelectionProvider delegate which the Views use to set the current selection provider when one of its viewers gains focus. And various Views listen to the selection service and react in accordance with what was selected. This works properly in RCP, but in RAP I'm seeing problems that I haven't encountered in other RAP apps.
On one View, items appear in the topmost viewer, and items aren't supposed to appear in other viewers until a selection is made in one of the viewers above. There are two items in the topmost viewer. When user selects one, the listener on the selection service receives the selection, but the selection is found to be empty. Furthermore, a separate View with a single viewer, listening to the selection service detects nothing.
But then if I make a different View active, its selection seems to work. The listener on the selection service detects a non-empty selection. And then when I go back to the first View, the selection is sort of working. The listeners on the selection service now detect a non-empty selection, but it is always the same item, even if the other item was selected.
I realize it sounds like the selection providers and listeners are just not wired up correctly, and maybe they aren't. But I spent the entire day looking through the code, and I don't see anything wrong. I carefully compared the implementation of selection providers and listeners between the View that seems to work and the one that only partly works after the other View has been made active, and I don't see any differences. Furthermore it works perfectly fine in RCP.
So I'm wondering if there is something I'm supposed to do different in RAP with respect to using the selection service. I've built apps in RAP before, but they were always 1.3 apps unti now. I'm using RAP 1.5 for this app. Is there perhaps something different required in RAP 1.5? Are there common (or not so common) inplementation errors that anyone can think of that might account for this behavior?
|
|
|
|
Re: SelectionProviders in RAP have strange behavior [message #1046994 is a reply to message #1042111] |
Mon, 22 April 2013 16:49 |
|
Mark,
You may already know this, but if you don't implement ViewPart#setFocus() properly then it can cause problems in RCP as well as RAP. The setFocus method should call setFocus on an appropriate control within your view. For instance, if you have a JFace TableViewer or TreeViewer, you should call something like viewer.getControl().setFocus().
Hope that helps,
Cole Markham
|
|
|
Powered by
FUDForum. Page generated in 0.05087 seconds