Bug 245100 - Selection changes are not always propagated (ISourceProvider Framework)
Summary: Selection changes are not always propagated (ISourceProvider Framework)
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.2 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 267056
Blocks:
  Show dependency tree
 
Reported: 2008-08-25 07:12 EDT by Jan Rosczak CLA
Modified: 2009-04-28 05:55 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Rosczak CLA 2008-08-25 07:12:30 EDT
Changes to the current selection within a workbench window are not propagated through the ISourceProvider framework after a modal dialog (such as an InputDialog) is opened and then closed again.

The problem seems to be the "shellListener" inner class in the class ui.internal.services.CurrentSelectionSourceProvider. If a new shell (such as a dialog window) is activated, the updateWindows method is called with a reference to a WorkbenchWindow. That reference comes from the attached data field of the source widget of the event, in this case the new shell.

If a new dialog window is created that data field contains a reference to this newly created window and not the WorkbenchWindow. Therefore the updateWindows method is called with a null parameter, the CurrentSelectionSourceProvider removes itself from the list of selection listeners and changes to the current selection will no longer be propagated.
Comment 1 Sven Uhlig CLA 2008-09-06 15:44:51 EDT
Thanx for pointing out the right point - you really saved my life
Non of my menues worked after opening any kind of dialog, but now it's clear 

It may not be the right way, but simply:

            case SWT.Activate:
                IWorkbenchWindow window = null;
                if (event.widget.getData() instanceof WorkbenchWindow) {
                    window = (IWorkbenchWindow) event.widget.getData();
                    // RAP [bm]: no detached windows
                    //                } else if (event.widget.getData() instanceof DetachedWindow) {
                    //                    window = ((DetachedWindow) event.widget.getData())
                    //                            .getWorkbenchPage().getWorkbenchWindow();
                    // RAPEND: [bm]

                    //Bug #245100
                } else if((event.widget.getStyle()&SWT.APPLICATION_MODAL)!=0){
                    event.widget.addListener(SWT.Dispose, this);
                }

                updateWindows(window);
                break;
            case SWT.Dispose:
                updateWindows(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            }
made it to work for me as expected

Comment 2 Markus Krüger CLA 2009-04-22 11:11:36 EDT
This should urgently be fixed.
Comment 3 Maghen Calinghee CLA 2009-04-23 11:36:55 EDT
Hi,

I've just posted a message concerning dialogs and variables : http://www.eclipse.org/newsportal/article.php?id=6193&group=eclipse.technology.rap#6193
I guess my problem is linked to that bug. I let my e-mail in CC for more informations.

I hope this bug will be fixed soon :).

Maghen.
Comment 4 Ivan Furnadjiev CLA 2009-04-27 13:13:55 EDT
This is fixed in CVS HEAD by fixing bug 267056.
Comment 5 Markus Krüger CLA 2009-04-27 13:23:41 EDT
Can not set to "Confirmed". But it works now. Good job!
Comment 6 Maghen Calinghee CLA 2009-04-28 05:55:28 EDT
Hi,
Yes it works for me too. My problem has been resolved with this fix.

Thank you.