How to make HandledMenuItem unselected when the ap

2019-09-16 07:47发布

问题:

I have HandledMenuItem in my Application.e4xmi. But if I check this item, close my application and start it again, this item stay selected. I can suspect that this item should be tagged or something like this, but I can't find any information about tags for MenuItems.

Thanks in advance.

回答1:

The e4 RCP normally persists the state of the application model when the app terminates.

If you don't want to restore the persisted state of the application use the -clearPersistedState flag. You can also specify -persistState false to stop the app from persisting the state during shutdown.

If you do want to persist the application state and just clear this menu item you will have to find the MMenuItem item using the model service and call the setSelected(false) method to clear the check mark.