I am currently trying to figure out how to correctly apply MenuItems of type RADIO and CHECK. Meaning, I want to initialize them according to some state I have in my application and naturally want to synchronize this.

It is no problem to handle selections and get them into my code, but what is the official way I have to do this?

An example:

I have a filter defined on Persons where RADIO is either MALE or FEMALE according to the selection stored in the system. How and where in the application model am I supposed to set the initial sychronization of the filter configuration to the options presented in the menu? A processor? A handler? Same counts for the CHECK elements!

I am currently trying a different approach: I have an element of type DirectMenuItem, with a defined Class Uri. In the respective class Uri file I have a method with @PostConstruct annotation, which is called just when the MenuItem is instantiated somwhere. Generally this should do the trick, but the problem is, that I don't seem to get MMenuElement injected within the methods signature.

Interesting is the following fact:

I have one instance of DirectMenuItem within the Applications Main Menu, and one within a ViewPart menu, both pointing to the same class Uri. If I change the injection to MUIElement I get injected a TrimmedWindow and Part element respectively?!

Why is that, why can't I simply get the DirectMenuItem I am looking for, especially, as even when querying the MApplication Model (changing the injection of the method) I am not able to find the DirectMenuItem from the EModelService providing MApplication!

The reason you only get the Window/Part is that DirectMenuItem is not of
type MContext and so there's no context created for it and we can
naturally only push on MUIElement into the context of Window/Part.

Am 28.12.12 19:32, schrieb Marco Descher:
> I am currently trying a different approach: I have an element of type
> DirectMenuItem, with a defined Class Uri. In the respective class Uri
> file I have a method with @PostConstruct annotation, which is called
> just when the MenuItem is instantiated somwhere. Generally this should
> do the trick, but the problem is, that I don't seem to get MMenuElement
> injected within the methods signature.
> Interesting is the following fact:
>
> I have one instance of DirectMenuItem within the Applications Main Menu,
> and one within a ViewPart menu, both pointing to the same class Uri. If
> I change the injection to MUIElement I get injected a TrimmedWindow and
> Part element respectively?!
> Why is that, why can't I simply get the DirectMenuItem I am looking for,
> especially, as even when querying the MApplication Model (changing the
> injection of the method) I am not able to find the DirectMenuItem from
> the EModelService providing MApplication!