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.
Created attachment 157126 [details] A project to reproduce the error Opening new top components into an newly opened, undocked editor mode, and then attempting to dock the editor mode will result in some oddities in the UI. Specifically, two sets of tabs will be displayed, one set without any content. If you click any of the tabs in the set that has content, the contents will move to the other set. This behavior will continue until Window->Reset Windows is selected in the menu. Attached is a Netbeans Platform Application to demonstrate the issue. In order to reproduce this issue: 1. In the Menu Bar, select Window->Test. This will create a small TestTopComponent with a button in the editor mode. 2. Click the button in the top component; this will create a new TestTopComponent in the same mode. You can also use the Menu option from step 1 to accomplish this. 3. Right click one of the tabs and select "Float Group" 4. Close the window with the group in it. 5. Repeat steps 1 and 2. You will note that this will create the TestTopComponents in a floating window, as the editor mode was undocked prior to being closed. 6. Right click one of the tabs in the window and select "Dock Group" After looking around the source for some time, I found that modifying the userDockedMode and userDockedTopComponent methods in org.netbeans.core.windows.Central appeared to fix this issue. Specifically, in this section of code: ... if (null == previousMode || !model.getModes().contains(previousMode)) { SplitConstraint[] constraints = model.getModeTopComponentPreviousConstraints(mode, tcID); if (null != constraints) { previousMode = findJoinedMode(modeKind, constraints); } } ... As the top components being created were not in a mode prior to the editor mode, no previous mode or constraints would ever be found. So, I modified the above segment to set the constraints variable to an empty array of SplitContraint should the model not find any, and calling findJoinedMode on that. I employed a similar change to the userDockedTopComponentMethod: ... if ((dockTo == null) || !model.getModes().contains(dockTo) || dockTo.getState() == Constants.MODE_STATE_SEPARATED) { // mode to dock to back isn't valid anymore, try constraints SplitConstraint[] constraints = model.getModeTopComponentPreviousConstraints(source, tcID); if (constraints != null) { //there might be some mode with the same constraints already dockTo = findJoinedMode(modeKind, constraints); if (null == dockTo) { // create mode with the same constraints to dock topcomponent back into dockTo = WindowManagerImpl.getInstance().createModeImpl( ModeImpl.getUnusedModeName(), modeKind, false); model.addMode(dockTo, constraints); } } } ... Once again, check if the constraints returned by getModeTopComponentPreviousConstraints are null, set them to an empty array if so, and proceed as normal. These changes appear to work, but I am uncertain of what sorts of effects this may have on other areas.
Created attachment 157128 [details] Screenshot of the issue