Search code examples
javanetbeansnetbeans-platform

How to access NbEditorDocument of a newly opened file in NetBeans IDE?


I want to register for notifications of files being opened and access their NbEditorDocument instances. Possibly it's something similar to this, where FileObject instances are accessed instead.


Solution

  • Listen for EditorRegistry.FOCUS_GAINED_PROPERTY and keep own track of EditorRegistry.lastFocusedComponent() to know when it's a new one.