| Summary: | [Compatibility] Menu items appear where they shouldn't with Eclipse 4.2 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Nicolas Bros <nicolas.bros> | ||||
| Component: | UI | Assignee: | Remy Suen <remy.suen> | ||||
| Status: | VERIFIED FIXED | QA Contact: | Remy Suen <remy.suen> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | pwebster, remy.suen | ||||
| Version: | 4.2 | ||||||
| Target Milestone: | 4.2 M2 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | 355210 | ||||||
| Bug Blocks: | 354962, 354965, 333742, 334303 | ||||||
| Attachments: |
|
||||||
|
Description
Nicolas Bros
Please provide the XML snippets you are using for these actions. Your repository is very fine-grained and it's hard for me to know which bundle is contributing these menu items. I think this is because the enabledWhen clauses are on the handlers themselves. Will have to do some more poking. http://dev.eclipse.org/viewcvs/viewvc.cgi/plugins/trunk/org.eclipse.gmt.modisco.infra.query.ui/plugin.xml?view=markup&root=Modeling_MODISCO When the visibleWhen is just one line as <visibleWhen checkEnabled="true"/>, our code doesn't generate an expression for it. See MenuHelper's getVisibleWhen(IConfigurationElement). Here is where the EMF Facet actions are defined: https://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.facet/trunk/examples/org.eclipse.emf.facet.widgets.nattable.examples.ecore/plugin.xml https://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.facet/trunk/plugins/org.eclipse.emf.facet.widgets.nattable/plugin.xml I also noticed that Source > Format shows up in various context menus in the Juno EPP Java package. (In reply to comment #3) > When the visibleWhen is just one line as <visibleWhen checkEnabled="true"/>, > our code doesn't generate an expression for it. For this case we can choose to create a new expression that asks the handler service whether the handler for the given command can be executed. Then the visibility would just toggle accordingly based on the handler's enabledWhen clause. Even if we fix the problem per comment 6, there are still issues with the context menu because of exceptions being thrown in the handler implementations of isEnabled. We protect this code in 3.x but do not have this protection in 4.x at the moment, see bug 355210. EMF Facet should probably still safe up their code though. A 3.x trace can be seen below. java.lang.NullPointerException at org.eclipse.emf.facet.widgets.nattable.internal.handlers.RemoveLineHandler.isEnabled(RemoveLineHandler.java:52) at org.eclipse.ui.internal.handlers.HandlerProxy.isEnabled(HandlerProxy.java:320) at org.eclipse.core.commands.Command.isEnabled(Command.java:833) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:468) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:178) at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247) at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247) (In reply to comment #5) > I also noticed that Source > Format shows up in various context menus in the > Juno EPP Java package. Opened bug 355512 for this problem. Not sure where it's coming from right now. Perhaps WindowBuilder? *** Bug 355512 has been marked as a duplicate of this bug. *** Created attachment 202082 [details] MenuHelper patch v1 This patch illustrates the approach outlined in comment 6. Fix pushed to R4_development. http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_development&id=33fa8a7105586caa53036e753aa547294953b9b2 Thanks for bringing this problem to our attention, Nicholas and Steffen! Verified with I20110913-0200 on Windows XP. |