Bug 83375 - [WorkbenchParts] Filtered addSelectionListener only notified by newest selection provider
Summary: [WorkbenchParts] Filtered addSelectionListener only notified by newest select...
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-21 04:37 EST by Andy Doddington CLA
Modified: 2019-09-06 16:09 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Doddington CLA 2005-01-21 04:37:23 EST
I have a requirement to notify a View when the selection changes in any instance
of a particualr editor. The editor contains a jface Viewer which is the natural
selection provider.

I register each editor's viewer with the site, using code of the form:

    getSite().setSelectionProvider(myViewer);

I make this call in my editor's "createPartControl()" method (i.e. when the
viewer is created); I have tried writing a proxy that allows this registration
to be done in the "init()" method - but with no change to the symptoms described
below.

In my View, I have registered a listener to handle events from my editor(s), thus:

    getSite().getPage().addSelectionListener(mySelectionListener);

The issue I have is that if I specify a typeId as the first parameter for the
"addSelectionListener()" method, then I *only* seem to get events for the most
recently created editor instance. However, if I do not give a typeId then I get
events for all instances (which is what I want).

This would be fine, since I can always filter on the class of the IWorkbenchPart
that gets passed into my handler. However, this does not work for the null case
(which I also need to process). In this case I can't test the part because it is
null (natch!). However in the case of the null handler the registration process
seems to work correctly when I give the optional typeId in the call to
"addSelectionListener()" - though only for null events.

My workaround is to register two handlers - one with no typeId specified to
process 'normal' events (doing hand-written filtering), and a special null
handler which is registered using a typeId and which *only* processes null events.

Note: my original handler implemented the INullHandler interface, since I wanted
it to process both normal and null events.
Comment 1 Paul Webster CLA 2006-09-28 14:07:16 EDT
Is this still a problem in 3.3?

PW
Comment 2 Denis Roy CLA 2007-06-22 09:32:46 EDT
Changes requested on bug 193523
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:09:43 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.