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 168243

Summary: Closing of projects triggers initialization of new TopComponents
Product: projects Reporter: Marian Petras <mpetras>
Component: Generic Projects UIAssignee: Milan Kubec <mkubec>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: mpetras, ovrabec, tstupka
Priority: P3 Keywords: PERFORMANCE
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Marian Petras 2009-07-07 18:04:01 UTC
Closing one or more projects triggers initialization (creation) of all non-existing TopComponents that are declared to
be docked in the editor mode. This may take a long time.

The method that triggers this initialization in in file ProjectUtilities.java, in method doClose() (in an anonymous
inner class):


        private void doClose(Project[] projects, boolean notifyUI, Wrapper wr) {
            //
            // ... (preceding non-essential code) ...
            //
            WindowManager wm = WindowManager.getDefault();
            for (Mode mode : wm.getModes()) {
                if (!wm.isEditorMode(mode)) {
                    continue;
                }
                for (TopComponent tc : mode.getTopComponents()) {
                    //                               ^
                    // this triggers the creation ---|
                }
                //...
            }
        }


I understand the motivation for the above code. I also do not know of any other way of writing it better until the
Window System API provides a method like Mode.getExistingTopComponents(). So I assume that the Window System API needs
to be extended to allow such a call.
Comment 1 Marian Petras 2009-07-07 18:05:51 UTC
*** Issue 168244 has been marked as a duplicate of this issue. ***
Comment 2 Marian Petras 2009-07-09 17:15:35 UTC
Loading, initialization and closing of never-used TopComponents takes approximately 750 ms on my system
(Intel Core 2 Quad @ 3 GHz).
Comment 3 Milan Kubec 2009-07-16 10:14:32 UTC

*** This issue has been marked as a duplicate of 168453 ***