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.

Bug 102174

Summary: check TopComponent type - editor/view - outside the AWT thread
Product: platform Reporter: Stanislav Aubrecht <saubrecht>
Component: Window SystemAssignee: Stanislav Aubrecht <saubrecht>
Status: RESOLVED FIXED    
Severity: blocker CC: dsimonek, jtulach
Priority: P2 Keywords: API, API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 101797    
Attachments: proposed implementation

Description Stanislav Aubrecht 2007-04-23 15:42:41 UTC
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.
Comment 1 Stanislav Aubrecht 2007-04-23 15:45:34 UTC
Created attachment 41466 [details]
proposed implementation
Comment 2 Stanislav Aubrecht 2007-05-02 13:55:42 UTC
if there are no objections, i'll integrate the patch tomorrow
Comment 3 Stanislav Aubrecht 2007-05-03 10:38:30 UTC
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