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. In http://www.eclipse.org/forums/index.php/m/995010 I described a possible solution for a DirectMenuElement SWT.CHECK style using the following class URI implementation: @PostConstruct public void initialize(MDirectMenuItem me) { // cover initialization stuff, sync it with code boolean currentlySelected = me.isSelected(); } @Execute public void execute(MDirectMenuItem me) { // do the stuff to handle it execute.blafoo(); // toggle the state me.setSelected(!me.isSelected()); } The problem is now, that the @PostConstruct is not injected with the resp. MDirectMenuItem, which would allow me to do the initial sychronization. It is, however dependent on the embeddingt, injected with a MUIElement of type TrimmedWindow (for Application Main Menu or PartImpl for ViewMenu) which is wierd. Unfortunately I have not yet found information on how this is handled correctly E4 style (cf. http://www.eclipse.org/forums/index.php/t/442970/ or http://www.eclipse.org/forums/index.php/t/444326/ or http://stackoverflow.com/questions/14074234/state-of-menuitem-of-type-check-or-radio-in-eclipse-4) for me however the above presented code solution would be the correct one. The problem gets even more complicated when RADIO groups come into play. But one step at a time. If there are no opinions or remarks, I would file a bug for the correct injection on @PostConstruct to be able to care for initial synchronization. Thanks a lot, Marco _______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
