ActionCallback (int window, GridCell cell) { if (myOriginal != null) { return myOriginal.detachTo(window, cell); } RunnerContentUi target = null; if (window > 0) { for (RunnerContentUi child : myChildren) { if (child.myWindow == window) { target = child; break; } } } final GridCellImpl gridCell = (GridCellImpl)cell; final Content[] contents = gridCell.getContents(); storeDefaultIndices(contents); for (Content content : contents) { content.putUserData(RunnerLayout.DROP_INDEX, getStateFor(content).getTab().getIndex()); } Dimension size = gridCell.getSize(); if (size == null) { size = JBUI.size(200, 200); } DockableGrid content = new DockableGrid(null, new Presentation(), size, Arrays.asList(contents), window); if (target != null) { target.add(content, null); } else { Point location = gridCell.getLocation(); if (location == null) { location = getComponent().getLocationOnScreen(); } location.translate(size.width / 2, size.height / 2); getDockManager().createNewDockContainerFor(content, new RelativePoint(location)); } return ActionCallback.DONE; }