I'm developing a plugin with EMF and GMF. It has two views and I want that when one element is selected in the first one the second is refreshed.

Actually I used this command:

getViewSite().getPage().addSelectionListener(this);

But it allows me to listen only the selections in the editor.

How can I fix it? And how can I ensure that the view is refreshed when the plugin is loaded? Currently when I start the plugin it is empty and it is refreshed as soon as I click on the editor.

Thanks, Luca

有帮助吗?

解决方案

You can use Selection Service:

getViewSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this)

or

getViewSite().getWorkbenchWindow().getSelectionService().addSelectionListener(partId, this)

to listen for selection changes in a specific view/editor.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top