RowPostSelectionProvider doesn't fire if selection is programmatically executed [message #1693031] |
Tue, 21 April 2015 07:13  |
Eclipse User |
|
|
|
Hi,
I currently have a little problem and I wanted to discuss it here first instead of opening a bug, because I am not sure how to deal with it. The problem is quite simple:
I use a RowPostSelectionProvider and it doesn't fire the postSelectionChangedListeners if I do
rowPostSelectionProvider.setSelection(new StructuredSelection(object))
I thought it would react like a single click with the mouse.
I noticed that the NatTable itself notifies other listeners about a SWT.Selection event. This happens at handleLayerEvent(...), but only if the event is a CellSelectionEvent, and with a RowPostSelectionProvider this event will never be fired.
I think it could help to change the handleLayerEvent() method of the NatTable like this:
NatTable.handleLayerEvent(ILayerEvent event) {
//... some stuff before ...
if (event instanceof ISelectionEvent) {
if (event instanceof CellSelectionEvent || event instanceof RowSelectionEvent) {
Event e = new Event();
e.widget = this;
try {
notifyListeners(SWT.Selection, e);
} catch (RuntimeException re) {
re.printStackTrace();
}
}
// ... the rest of the method
}
This should ensure that the postSelect-Event will be fired. But I don't know the side effects this change would cause.
Meanwhile I helped myself out with overriding the setSelection()-method in RowPostSelectionProvider and execute the postSelection directly, but I know this is wrong.
I just want to know if anyone else noticed this behaviour. Maybe I do something wrong? Any help or opinions would be appreciated.
Thanks in advance, André
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03539 seconds