This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
often it is needed to find out whether an active (or other) TopComponent is an editor window or a view (e.g. project view, files view etc). quite often it is also needed to make this check outside the AWT thread. however the windows api allows access from AWT thread only which means that SwingUtilities.invokeAndWait (or similar technique) must be used. but that is prone to deadlocks and other thread synchronization issues. i propose adding new method WindowManager.isOpenedEditorTopComponent( TopComponent ) that would return true if the given TopComponent is opened and is docked into an editor-type Mode. it is possible to implement this method in such a way that it will be safe to call it from outside the AWT thread.
Created attachment 41466 [details] proposed implementation
if there are no objections, i'll integrate the patch tomorrow
integrated Checking in openide/windows/apichanges.xml; /cvs/openide/windows/apichanges.xml,v <-- apichanges.xml new revision: 1.17; previous revision: 1.16 done Checking in openide/windows/manifest.mf; /cvs/openide/windows/manifest.mf,v <-- manifest.mf new revision: 1.16; previous revision: 1.15 done Checking in openide/windows/src/org/openide/windows/WindowManager.java; /cvs/openide/windows/src/org/openide/windows/WindowManager.java,v <-- WindowManager.java new revision: 1.17; previous revision: 1.16 done Checking in core/windows/test/unit/src/org/netbeans/core/windows/TopComponentTypeTest.java; /cvs/core/windows/test/unit/src/org/netbeans/core/windows/TopComponentTypeTest.java,v <-- TopComponentTypeTest.java new revision: 1.5; previous revision: 1.4 done Checking in core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java; /cvs/core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java,v <-- WindowManagerImpl.java new revision: 1.63; previous revision: 1.62 done