How to enumerate editors and know their locations in Intellij Platform SDK?

Answered

I have the following example layout on screen

How to enumerate these 3 editors with files aaa.html, bbb.html and ccc.html and know their locations from within Plugin code?

Any hints please. Can't understand where to dig...

2 comments
Comment actions Permalink

The following code returns only one window

IdeFrame[] ideFrames = windowManager.getAllProjectFrames();

and only last by unknown reason

0
Comment actions Permalink

Hello,

Maybe these code snippets help you

FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
for (EditorWindow editorWindow : editorManager.getWindows()) {
for (Map.Entry<EditorWindow.RelativePosition, EditorWindow> pos : editorWindow.getAdjacentEditors().entrySet()) {
System.out.println(pos);
}
}

or

Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor ed : editors) {
JComponent comp = ed.getComponent();
if (comp.isShowing()) {
System.out.println("Visible editor: " + ed);
}
}

Regards

0

Please sign in to leave a comment.