Detect tab close in Eclipse editor

亡梦爱人 提交于 2019-12-01 09:44:02
Favonius

For editor close event do something like this:

IWorkbenchPage page = ...;

    //adding a listener
IPartListener2 pl = new IPartListener2() {
        // ... Other methods
        public void partClosed(IWorkbenchPartReference partRef)
        {
            //if(partRef.getId().equals(youreditor.id){ /* do something*/ }
        }

};
page.addPartListener(pl);

Have a look at these links:

  1. How to add a listener to the default code editor in Eclipse?
  2. FAQ How do I find out what view or editor is selected?
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!