|
How can I get a list of open editor windows |
|
|
To obtain a reference to the currently selected editor:
Node[] arr = TopComponent.getRegistry().getCurrentNodes();
for (int i = 0; i < arr.length; i++) {
EditorCookie ec = (EditorCookie) arr[i].getCookie(EditorCookie.class);
if (ec != null) {
JEditorPane[] panes = ec.getOpenedPanes();
if (panes != null) {
// USE panes
}
}
}
|
To obtain references to all opened editors:
TopComponent[] comps = TopComponent.getRegistry().getOpened();
for (int i = 0; i < comps.length; i++) {
Node[] arr = comps[i].getActivatedNodes();
for (int j = 0; j < arr.length; j++) {
EditorCookie ec = (EditorCookie) arr[j].getCookie(EditorCookie.class);
if (ec != null) {
JEditorPane[] panes = ec.getOpenedPanes();
if (panes != null) {
// USE panes
}
}
}
}
|
Source: NetBeans FAQ
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.