return true;
// check to see if we're already floating and we're trying to drop into
// the
// same dialog.
DockingPort oldPort = DockingManager.getDockingPort(dockable);
if (oldPort instanceof FloatingDockingPort && oldPort == port) {
// only allow this situation if we're not the *last* dockable
// in the viewport. if we're removing the last dockable, then
// the dialog will disappear before we redock, and we don't want
// this
// to happen.
FloatingDockingPort floatingDockingPort = (FloatingDockingPort) oldPort;
if (floatingDockingPort.getDockableCount() == 1)
return false;
}
if (dockable == null || dockable.getComponent() == null || port == null)
return false;
if (!DockingManager.isValidDockingRegion(region))
return false;
Dockable docked = DockingManager.getDockable(port.getDockedComponent());
if (docked == null)
return true;
// don't allow them to dock into this region if the territory there is
// blocked.
if (docked.getDockingProperties().isTerritoryBlocked(region)
.booleanValue())
return false;
// check to see if we're already docked into this region.
// get the parent dockingPort.
Container container = docked.getComponent().getParent();
// now get the grandparent dockingport
DockingPort grandparent = DockingManager.getDockingPort(container);
// if we don't share the grandparent dockingport, then we're definitely
// not split in the same dockingport
// across different region. in this case, it's ok to proceed with the
// dock
if (grandparent == null)
return true;
Component currentlyInRegion = grandparent.getComponent(region);
// block docking if we're already the component docked within the
// specified region
if (currentlyInRegion == dockable.getComponent())
return false;