| Summary: | Menu "Build Automatically" missing checkmark | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Oleg Besedin <ob1.eclipse> | ||||
| Component: | UI | Assignee: | Paul Webster <pwebster> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | deepakazad, john.arthorne, pinnamur, pwebster, remy.suen | ||||
| Version: | 1.0 | ||||||
| Target Milestone: | 4.1 M6 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Oleg Besedin
For this particular case, we need to get the action's check state and set it into the model when creating menu items out of MenuHelper. How do we keep it up to date? For commands? For pure actions? PW (In reply to comment #2) > How do we keep it up to date? For commands? Do we have an MCommand for every regular Command? Since we have execution listeners in 3.x, maybe we could use the event bus for MCommand executions. Or maybe not since even the ECommandService itself deals with Commands instead of MCommands. > For pure actions? Probably have to resort to good ol' IPropertyChangeListeners for this one. I also noticed a similar problem in 'Edit > Smart Insert Mode' where the checkmark is never present! Note the checkmark can appear in 4.1 (I20101026-0203), but it is inverted: Checked = build is disabled Unchecked = build is enabled Is the problem just with initializing the checkmark to be correct at startup, but the toggling behaviour works? (In reply to comment #5) > Is the problem just with initializing the checkmark to be correct at startup, > but the toggling behaviour works? The problem is with initializing the checkmark at start-up. Otherwise, toggling works :) I had a quick look into the source code to investigate this problem. I could verify that workspace preferences are set correctly. However, when MenuHelper creates the HandledMenuItemImpl of type ItemType.CHECK (for 'Build Automatically' action, or may be for any action), it does *not* fetch the selection state from Action and does not set it to that item. So when ever the menu items are created, the menu manager returns the default selection state (ie., false) initially. I guess the fix would be to change the code of MenuHelper.createItem(..,ActionContributionItem) to invoke setSelected(action.isChecked()) at the time MenuHelper creates the HandledMenuItemImpl for the type ItemType.CHECK or ItemType.RADIO Created attachment 190247 [details]
Proposed Patch
The attached patch contain code changes that would fix the missing checkmark either with Build Automatically, or Smart Insert Mode, or any menu item that has to be selected during start-up.
Thanx Praveen, committed. PW |