Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » RowPostSelectionProvider doesn't fire if selection is programmatically executed
RowPostSelectionProvider doesn't fire if selection is programmatically executed [message #1693031] Tue, 21 April 2015 11:13 Go to next message
André Forberg is currently offline André ForbergFriend
Messages: 1
Registered: April 2014
Junior Member
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é
Re: RowPostSelectionProvider doesn't fire if selection is programmatically executed [message #1693091 is a reply to message #1693031] Tue, 21 April 2015 15:22 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I'm not sure if anybody looked into the RowPostSelectionProvider for a while. Open a ticket, I'm really not sure about it.
Re: RowPostSelectionProvider doesn't fire if selection is programmatically executed [message #1693102 is a reply to message #1693091] Tue, 21 April 2015 17:52 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I did a quick test with your proposed solution. As far as I can see you are right. The post selection is triggered in JFace on the SWT.Selection event. Which isn't triggered by NatTable on row selection. I'm not sure why. I locally added your proposal and executed the test cases. They look fine so far. But I guess it needs to be tested well.
Previous Topic:Adding a context menu in NatTable Eclipse 3 RCP Application
Next Topic:RowReorderCommand not working
Goto Forum:
  


Current Time: Fri Apr 19 02:43:11 GMT 2024

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

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

Back to the top