How can I find the currently open document in the selected editor?
Apache NetBeans Wiki Index
Note: These pages are being reviewed.
JTextComponent ed = org.netbeans.api.editor.EditorRegistry.lastFocusedComponent();
Document doc = ed.getDocument();