How to get “active editor” in Eclipse plugin?

前端 未结 3 1945
一个人的身影
一个人的身影 2021-01-04 05:40

In my Eclipse plugin, I need to know when the editor that is visible on the screen has changed. I am currently getting the active editor as follows:

Platform         


        
3条回答
  •  粉色の甜心
    2021-01-04 06:24

    1. An editor is active only when it has focus, so what you are getting is the right output by the API. The user of your plugin will not be running it in debug mode, so not a concern for the end user
    2. Alternatively, to get all open editors you can do the following:

    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()

提交回复
热议问题