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 204766 - Registry.getOpened() contains no Editors after Reset Windows
Summary: Registry.getOpened() contains no Editors after Reset Windows
Status: RESOLVED DUPLICATE of bug 204455
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: -S1S-
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-07 11:56 UTC by maxnitribitt
Modified: 2011-11-07 14:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2011-11-07 11:56:34 UTC
Steps to reproduce:
1. create a new Standalone Module with Action "ShowOpenWindows" implemented like this:
public void actionPerformed(ActionEvent e) {
        Set<TopComponent> opened = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent topComponent : opened) {
            System.out.println("opened "+topComponent);
        }
    }
2. Open one or more Editor Windows.
3. Invoke ShowOpenWindowsAction. The Editors will be printed to System.out
4. Invoke "Reset Windows". The Editor Windows will stay open.
5. Invoke ShowOpenWindowsAction again. The Editors will not be printed to System.out.

If you replace the use of Registry with the following code, it will work as expected instead:
Mode editor = WindowManager.getDefault().findMode("editor");
TopComponent[] opened = WindowManager.getDefault().getOpenedTopComponents(editor); 

Background:

"Reset Windows" clears the openSet of the RegistryImpl, but subsequently only updates the Mode Model with the opened Editor TCs, not the Registries openSet. The only code that adds TCs to openSet is in topComponentOpened; it seems this isn't called during reset. 

All Non-Editor-TopComponents are closed during reset and reopened by calling WindowSystem.load(), thereby calling topComponentOpened and reregistering them correctly in Registry. Editors are not closed by ResetWindowsAction, but kept in open state.
Comment 1 Stanislav Aubrecht 2011-11-07 13:40:39 UTC

*** This bug has been marked as a duplicate of bug 204455 ***
Comment 2 maxnitribitt 2011-11-07 14:23:38 UTC
This is a different bug, unrelated to bug 204455.

The Editor Windows stay open and visible, but they are not contained in the set returned from:

WindowManager.getDefault().getRegistry().getOpened();
Comment 3 Stanislav Aubrecht 2011-11-07 14:24:54 UTC
the bugs are related. fixing one bug will fix the other one as well

*** This bug has been marked as a duplicate of bug 204455 ***
Comment 4 joro 2011-11-07 14:33:08 UTC
I also think the bugs are related:
if the editor window has been docked to a different mode (i.e. output mode), reset windows will close it.