Question

I'm working for a short time on the libraries of eclipse 4.x someone could tell me how can I open a view through from the context menu? Thank you in advance.

Était-ce utile?

La solution

To show a part anywhere you should define a command in the application model and a handler for the command. To show a part in the handler use:

@Execute
public void execute(EPartService partService)
{
  MPart mpart = partService.showPart(part id, PartState.ACTIVATE);
}

In the application Part definition for your part add a Popup Menu to the Menus section. In the popup menu define a HandledMenuItem for your command.

To register the popup menu as the context menu for a control (tree, table etc) use:

@Inject
private EMenuService;

...

menuService.registerContextMenu(control, menu id); 
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top