Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Initial state of radio MenuItems
Initial state of radio MenuItems [message #326141] Sat, 08 March 2008 08:09 Go to next message
chris is currently offline chrisFriend
Messages: 72
Registered: July 2009
Member
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 13:56 Go to previous message
chris is currently offline chrisFriend
Messages: 72
Registered: July 2009
Member
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
Previous Topic:TextCellEditor with SWT.BORDER cuts the bottom of text
Next Topic:Bug 182800
Goto Forum:
  


Current Time: Thu Jul 18 06:29:43 GMT 2024

Powered by FUDForum. Page generated in 0.03810 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top