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.
This is not really useful for end user (although it might be for power user), but applications written on top of NetBeans Platform might find the ability to ask the window system to reload its configuration useful. I am attaching patch, how such API (e.g. an action in this case) might look like.
Created attachment 106311 [details] The new action registration
http://hg.netbeans.org/ergonomics/rev/fa3cbf208c5d
Integrated into 'main-golden', will be available in build *201102270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/fa3cbf208c5d User: Jaroslav Tulach <jtulach@netbeans.org> Log: #195820: Reload and save window setup
The proposed solution does not trigger the loading of the TopComponents settings. The unit tests provided check only if the action is there but not that indeed work. A test like the following should be added: @Test public void testSomeMethod() { TestTopComponent tc = new TestTopComponent(); -- change TopComponent to state 1-- FileObject fo = FileUtil.getConfigFile("Actions/Window/org-netbeans-core-windows-actions- SaveWindowsAction.instance"); assertNotNull("Action is found", fo); Action action = (Action) fo.getAttribute("instanceCreate"); action.actionPerformed(null); -- change TopComponent to state 2-- fo = FileUtil.getConfigFile("Actions/Window/org-netbeans-core-windows-actions-ReloadWindowsAction.instance"); assertNotNull("Action is found", fo); action = (Action) fo.getAttribute("instanceCreate"); action.actionPerformed(null); assertTrue (--- TopComponent has state 1--); }
Created attachment 150865 [details] Sample application to reproduce the problem Start the application Press the red button to change the background of the panel to red Press the save button to save the settings Press the black button to change the background of the panel to black Press the reload button, the background of the panel should go back to red, but it stays black. The save/reload functionality works as expected for the windows positions.