| Summary: | [Problems] (regression) Not possible to add contributions to ProblemMarker or ConcreteMarker without referencing internal classes | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Lawrence Mandel <lmandel> | ||||||
| Component: | UI | Assignee: | Nick Edgar <n.a.edgar> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P2 | CC: | daniel_megert, danjou, danrubel, gunnar, jeem, John_Wiegand, patmc | ||||||
| Version: | 3.0 | ||||||||
| Target Milestone: | 3.0 RC2 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 53217 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
|
Description
Lawrence Mandel
Ouch. Was just trying this out too. The suggested resolution might work fine -the only hit then would be we'd have to add the adaptable="true" to the objectClass=....IMarker entries. My 2.1.1 test says I can contribute without that entry. Not sure you can hold this back from RC2... the alternative is a bit messy. Looks like we'd target internal classes as Lawrence says, then we'd have to cast to that class/ConcreteMarker, then getMarker(), then go on. But the other options for the marker contribution may not fly (enablement by attribute value). Serverity should be higher because this is a breaking change IMHO which is not documented. At least some documentation must be added to the migration guide with a workaround. Better would be a fix. Created attachment 11522 [details]
Patch for ConcreteMarker.java
This simple patch enables ConcreteMarker and all sub classes to adapt to
IMarker-
Adding dependency to bug 53217 because this bug covers some limit of the "adaptable" attribute. nick could you review the patch? Created attachment 11626 [details]
Patch to IDE using different selection provider
This patch takes a different approach: it passes a different selection provider
to registerContextMenu, which maps from ConcreteMarker to the wrapped IMarker,
so the menu extension mechanism sees IMarkers, not ConcreteMarkers.
This will address the case where adaptable="true" is not specified.
This requires an API addition: TableView.registerContextMenu(IMenuManager) and
an override of this method in MarkerView.
Jeem?
Interesting. Does this also work for actions contributed to the main window menu and the toolbar? No, the above patch will only work for contributions adding to the context menu. API addition? TableView is in org.eclipse.ui.views.markers.internal; MarkerView is in org.eclipse.ui.views.markers.internal. So there is no API exposure here. Right. Need more sleep. There's actually a more concise fix. In TableView.createPartControl, replace: viewer.getControl().setMenu(menu); getSite().registerContextMenu(mgr, viewer); with: viewer.getControl().setMenu(menu); getSite().registerContextMenu(mgr, getSelectionProvider()); getSite().setSelectionProvider(getSelectionProvider()); The marker views already had a selection provider separate from the view, which did the mapping between IMarker and ConcreteMarker. This also fixes the action set case (comment #7). The views weren't previously registering their selection provider on the site. Verified against binaries of I20040609-0800. I've verified this fix. Closing bug. |