| Summary: | NPE during context menu generation prevents 'Progress' view from coming up | ||
|---|---|---|---|
| Product: | [Modeling] MoDisco | Reporter: | Remy Suen <remy.suen> |
| Component: | Infrastructure | Assignee: | Nicolas Bros <nicolas.bros> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | hugo.bruneliere, modisco.web-inbox, nicolas.bros |
| Version: | 0.9.0 | Flags: | nicolas.bros:
indigo+
|
| Target Milestone: | 0.9.0 M7 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 333742 | ||
|
Description
Remy Suen
MoDisco's ContributionItemForMoDiscoMenu's fill(Menu, int) implementation arbitrarily retrieves the menu's shell, calls getData() on it, and then downcasts the result to IWorkbenchWindow. This is not documented API. Based on your code, it seems you just want a selection listener, you can retrieve this from a service locator.
What you should do instead is the following:
public class ContributionItemForMoDiscoMenu extends ContributionItem
implements IWorkbenchContribution {
private ISelectionService selectionService;
public void initialize(IServiceLocator serviceLocator) {
selectionService = (ISelectionService)
serviceLocator.getService(ISelectionService.class);
}
}
Thank you Remy. Fixed in revision 4364 by using the IServiceLocator, both in org.eclipse.modisco.infra.discovery.ui and the deprecated org.eclipse.gmt.modisco.infra.discoverymanager. Bug solved. |