diff --git a/platform/platform-impl/src/com/intellij/toolWindow/ToolWindowInnerDragHelper.kt b/platform/platform-impl/src/com/intellij/toolWindow/ToolWindowInnerDragHelper.kt index e781d6a8f2c7..57f80f4b64fb 100644 --- a/platform/platform-impl/src/com/intellij/toolWindow/ToolWindowInnerDragHelper.kt +++ b/platform/platform-impl/src/com/intellij/toolWindow/ToolWindowInnerDragHelper.kt @@ -55,6 +55,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen val decorator = InternalDecoratorImpl.findTopLevelDecorator(child) val editorSupport = getEditorSupport(decorator) if (decorator != null && + (canReorderTabs() || decorator.toolWindow.canSplitTabs()) && child is ContentTabLabel && (child.parent is ToolWindowContentUi.TabPanel || Registry.`is`("debugger.new.tool.window.layout.dnd", false) && child.parent is SingleContentLayout.TabAdapter) && @@ -74,7 +75,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen return when (curLocation) { is DropLocation.ToolWindow -> { val component = curLocation.decorator - val canDrop = currentDropIndex != -1 || curLocation.decorator.toolWindow.canSplitTabs() + val canDrop = currentDropIndex != -1 && canReorderTabs() || curLocation.decorator.toolWindow.canSplitTabs() component.contains(point.getPoint(component)) && canDrop } is DropLocation.Editor -> { @@ -374,7 +375,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen val content = myDraggingTab?.content curDropLocation = when { - decorator != null && decorator == sourceDecorator -> { + decorator != null && decorator == sourceDecorator && canReorderTabs() -> { // Drop into the same tool window decorator - always allowed. DropLocation.ToolWindow(decorator) } @@ -407,7 +408,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen private fun highlightToolWindowDropArea(decorator: InternalDecoratorImpl, point: RelativePoint) { currentDropIndex = getTabIndex(point) - if (currentDropIndex != -1) { + if (currentDropIndex != -1 && (canReorderTabs() || decorator.toolWindow.canSplitTabs())) { decorator.setDropInfoIndex(currentDropIndex, dragImageView!!.size.width) currentDropSide = -1 highlighter.bounds = Rectangle() @@ -451,6 +452,10 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen else null } + private fun canReorderTabs(): Boolean { + return Registry.`is`("ide.allow.tool.window.tabs.reorder", false) + } + private sealed interface DropLocation { data class ToolWindow(val decorator: InternalDecoratorImpl) : DropLocation data class Editor(val window: EditorWindow) : DropLocation diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index d35937dfee6f..fa2f623b64e5 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -129,6 +129,8 @@ ide.new.tool.window.start.drag.deadzone=100 ide.new.tool.window.start.drag.deadzone.description=Minimal distance from pressed point to start drag (and thus to avoid mistaken one) ide.switcher.tool.window.list=true ide.switcher.tool.window.list.description=Shows a list of tool windows in the Switcher popup +ide.allow.tool.window.tabs.reorder=true +ide.allow.tool.window.tabs.reorder.description=Whether reordering tool window tabs using drag and drop is allowed ide.tool.window.prevent.move.resize.timeout=100 ide.tool.window.prevent.move.resize.timeout.description=Time interval (in ms) after showing a detached (floating or windowed) tool window during which\ OS/JBR-induced moves and resizes will be prevented. Set to a negative value to disable this functionality