Initial state of radio MenuItems [message #326141] |
Sat, 08 March 2008 03:09  |
Eclipse User |
|
|
|
Hi,
I'm working on a GMF-based editor, and I've added two MenuItems with
radio style to the context menu of an EditPart using the
org.eclipse.ui.menus extension point, basically following
http://wiki.eclipse.org/Menu_Contributions/Radio_Button_Comm and.
I've added a parameter to the command linked to the two menu items,
which I then used in the IHandler implementation to implement
IElementUpdater.updateElement(UIElement, Map). This works fine if I
select a MenuItem: The according radio button is selected.
My problem is that when the menu is displayed the very first time,
nothing is selected. I noticed that the updateElement() method is only
called after I chose a MenuItem, but not before the menu is displayed
for the first time. So, how do I init my MenuItems?
I have another question in this context: In the updateElement() method,
I need to choose the selected MenuItem according to the state of the
domain model element associated with the EditPart the context menu
belongs to. I do that by asking the Platform's SelectionService for the
current selection, which includes the EditPart (from which I then derive
the model element). Is this best practice, or is there a smarter way
than using the SelectionService to access my model element?
Thanks in advance,
Chris
|
|
|
Re: Initial state of radio MenuItems [message #326161 is a reply to message #326141] |
Sun, 09 March 2008 09:56  |
Eclipse User |
|
|
|
Hi again,
chris schrieb:
> Hi,
>
> I'm working on a GMF-based editor, and I've added two MenuItems with
> radio style to the context menu of an EditPart using the
> org.eclipse.ui.menus extension point, basically following
> http://wiki.eclipse.org/Menu_Contributions/Radio_Button_Comm and.
>
> I've added a parameter to the command linked to the two menu items,
> which I then used in the IHandler implementation to implement
> IElementUpdater.updateElement(UIElement, Map). This works fine if I
> select a MenuItem: The according radio button is selected.
>
> My problem is that when the menu is displayed the very first time,
> nothing is selected. I noticed that the updateElement() method is only
> called after I chose a MenuItem, but not before the menu is displayed
> for the first time. So, how do I init my MenuItems?
I might have found a bug, the reason and a workaround. See bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=221980.
Cheers,
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.02005 seconds