Selection problems in editors [message #467246] |
Wed, 02 May 2007 01:45  |
Eclipse User |
|
|
|
Hi,
In my RCP application, I have implemented an editor that extends
EditorPart. This is an object based editor and it may contain a few text
fields for entering values and one or more table viewers. In my editor's
init method I register a selection provider using
getSite().setSelectionProvider(selProvider).
The same editor part will be used to edit mutilple types of objects and
each instance of the editor will contain one or more table viewers.
I also have a view that listens to selection change events from the
editor. I register a selection change listener by
getSite().getPage().addSelectionListener( editorPartId, selectionListener);
Everything works fine if I have one instance of the editor opened. When
I select something in the table viewer in the editor, the view is
notified. But when I have multiple instances of the editor, the
selection does not work. Only selections made in the editor instance
that was opened last is received by the view.
While debugging I noticed that setPart method in the
PagePartSelectionTracker is invoked when an editor is opened. In this
method, any selection listeners registered with the previously opened
editor part is removed and they are added to the new part. That explains
why only the selection from the last opened instance of the editor is
received by the editor. But I want to get selection changed events from
selections made in any of the opened editor parts. That is not happening.
Is this a bug in eclipse or Am I doing something wrong?
Thanks for your help.
Anand
--
____________________________________________________________ _________________________
Anand Narasimhan
anandn@cisco.com
|
|
|
Re: Selection problems in editors [message #467717 is a reply to message #467246] |
Thu, 10 May 2007 08:58  |
Eclipse User |
|
|
|
Anand Narasimhan wrote:
> Hi,
>
> In my RCP application, I have implemented an editor that extends
> EditorPart. This is an object based editor and it may contain a few text
> fields for entering values and one or more table viewers. In my editor's
> init method I register a selection provider using
> getSite().setSelectionProvider(selProvider).
>
> The same editor part will be used to edit mutilple types of objects and
> each instance of the editor will contain one or more table viewers.
>
> I also have a view that listens to selection change events from the
> editor. I register a selection change listener by
> getSite().getPage().addSelectionListener( editorPartId, selectionListener);
This won't work for editors, just views.
You'd probaby have your part listener track either a specific instance
or delegate specific editors with the same part id.
PW
|
|
|
Powered by
FUDForum. Page generated in 0.04461 seconds