开发者

How to allow a view to listen to selection of other views?

开发者_JS百科

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜