On Fri, Dec 28, 2012 at 4:49 PM, Marco Descher <[email protected]> wrote:

> I have problems understanding the concept of state synchronization of the
> application model with my code for DirectMenuItems and HandledMenuItems of
> type CHECK or RADIO.
>
> The problem is as follows:
>
> I populate a Menu with either Direct or HandledMenuItems and except their
> selection states (in CHECK or RADIO) style to be according to my code. The
> problem is that I can't figure
> out how to realize this.
>

I'm not sure I follow you.  Are you saying that if you modify the checked
model item, it's not reflected in the GUI?

You can't depend on anything in a  @PostConstruct with handler
contributions (handlers for commands or direct contributions) that isn't
available in the global application context.  And we recommend not to use
@Inject with handlers in general.

Instead, you should be able to ask for an MMenuItem in your execute(*)
method.  See
org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.getStaticContext(Event)
and
org.eclipse.e4.ui.workbench.renderers.swt.DirectContributionItem.getStaticContext(Event)
for how the model element is supposed to be made available to the @Execute
or @CanExecute.


PW


-- 
Paul Webster
Hi floor.  Make me a sammich! - GIR
_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to