|Re: How to notify View of Editor changes [message #449203 is a reply to message #449007]
||Wed, 19 January 2005 11:53
| Andy Doddington
Registered: July 2009
OK - I found this answer for myself, but thought I'd note it here for |
future reference, plus details of some curious behaviour which somebody
may be able to help me with.
I register each editor's viewer with the site, using code of the form:
In my view, I have registered a listener to handle events from my
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. 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
I have therefore had 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 'normal' handler implemented the INullHandler interface, since I
wanted it to process both normal and null events.
As always - any advice most appreciated.
Andy D wrote:
> I have a view defined whose purpose is to show some details for the
> currently selected item in my editor - both the editor and view are
> optional (though obviously the view will be empty if the editor does not
> exist or does not have a current selection).
> What is the recommended way of connecting these two 'things' so that the
> event get propagated correctly and that the lifetimes etc are also managed
> My guess is that I need to register the view with some common 'manager' -
> e.g. the workspace - which can then be notified by the editor(s), but
> there do not appear to be any built-in mechanisms for me to use (or more
> likely, I can't find them).
> Any advice would be gratefully received
Powered by FUDForum
. Page generated in 0.01714 seconds