Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top