Community
Participate
Working Groups
Build Identifier: 3.4.2 The logic in PluginAction.runWithEvent only checks for enablement the first time an action is run. The first time through the delegate is created which is followed by checking to see if the action is enabled. If the action is disabled then the execution returns. If the user tries to run the action again (allowed in a code path in our product), then the enablement is never checked and the action is executed. The solution is very simple. Move the isEnabled check outside the "if (delegate == null)" check. This would provide the same behavior on the first pass, but correctly handle the case if an action is trying to be rerun that is disabled. I am attaching a patch with the proposed fix Reproducible: Always Steps to Reproduce: Reproducible in IBM/Lotus product. I have not been able to reproduce in vanilla Eclipse.
Created attachment 186677 [details] Proposed patch based on Eclipse 3.4.2
If possible, I would really appreciate if this could be considered for Eclipse 3.7.
It's the responsibility of the caller to check enabled state before calling. ActionContributionItems disable the menus and tool items based on that state, so that it cannot be called. The key binding system checks isEnabled before calling (which runs through the command system), and programmatic executing through the IHandlerService (which goes through Command) also calls isEnabled() before executing (both delegate to the action). PW
I'll also say I do like that your request came with a patch. Still, I don't want to change an execution path in the heart of the legacy action delegate support. PW