How can i get the active Editor?

Or how can i get the list of opened editors?
Thank you!

1
4 comments
Avatar
Permanently deleted user

Hi,

Out of interest what is the context of the operation you are performing currently?
For example, if you are writing an action you can get the current editor from the supplied event with e.getData(PlatformDataKeys.EDITOR)

Alan

0
Avatar
Permanently deleted user

Also, to answer your second question, you can use FileEditorManager.getInstance(project).getAllEditors() which will return all currently open editors
Similiarly there are more useful methods in this class that may be beneficial to look at.

0
Avatar
Permanently deleted user

i have my custom editor:  public class MyEditor implements FileEditor, FileEditorManagerListener
and in MyAction.update i want to see if the active editor is of MyEditor type . In function of this i make my action visible or not.

0
Avatar
Permanently deleted user

Thank you for the fast answer!

1) FileEditorManager.getInstance(e.getProject()).getAllEditors();
2) FileEditorManager.getInstance(e.getProject()).getSelectedEditors();

1

Please sign in to leave a comment.