Eclipse Plugin - How to get the last worked on editor

本秂侑毒 提交于 2019-12-01 00:01:59

Use an IPartListener to listen to part activation events.

Set the listener up in your view initialization:

getSite().getPage().addPartListener(partListener);

(and don't forget to remove the listener in the view dispose).

Among other things this will give you part activation events:

public void partActivated(IWorkbenchPart part)

If part is an instance of IEditorPart then it is an editor being activated. So you just need to keep track of this activated editor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!