mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[toolwindow] IJPL-231387 Make tabs reorder using DnD available in VCS tool windows only with a registry key
Space-RevId: c71241edc57a6aa72a7f74b4fc185938520794c1 GitOrigin-RevId: 3d07f25b56eea53e08add1e1339bd22032f04fe8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
217bdf00a4
commit
a08972374a
@@ -59,7 +59,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()) &&
|
||||
(canReorderTabs(decorator) || 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) &&
|
||||
@@ -79,7 +79,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen
|
||||
return when (curLocation) {
|
||||
is DropLocation.ToolWindow -> {
|
||||
val component = curLocation.decorator
|
||||
val canDrop = currentDropIndex != -1 && canReorderTabs() || curLocation.decorator.toolWindow.canSplitTabs()
|
||||
val canDrop = currentDropIndex != -1 && canReorderTabs(component) || curLocation.decorator.toolWindow.canSplitTabs()
|
||||
component.contains(point.getPoint(component)) && canDrop
|
||||
}
|
||||
is DropLocation.Editor -> {
|
||||
@@ -393,7 +393,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen
|
||||
|
||||
val content = myDraggingTab?.content
|
||||
curDropLocation = when {
|
||||
decorator != null && decorator == sourceDecorator && canReorderTabs() -> {
|
||||
decorator != null && decorator == sourceDecorator && canReorderTabs(decorator) -> {
|
||||
// Drop into the same tool window decorator - always allowed.
|
||||
DropLocation.ToolWindow(decorator)
|
||||
}
|
||||
@@ -426,7 +426,7 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen
|
||||
|
||||
private fun highlightToolWindowDropArea(decorator: InternalDecoratorImpl, point: RelativePoint) {
|
||||
currentDropIndex = getTabIndex(point)
|
||||
if (currentDropIndex != -1 && (canReorderTabs() || decorator.toolWindow.canSplitTabs())) {
|
||||
if (currentDropIndex != -1 && (canReorderTabs(decorator) || decorator.toolWindow.canSplitTabs())) {
|
||||
decorator.setDropInfoIndex(currentDropIndex, dragImageView!!.size.width)
|
||||
currentDropSide = -1
|
||||
highlighter.bounds = Rectangle()
|
||||
@@ -470,8 +470,11 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen
|
||||
else null
|
||||
}
|
||||
|
||||
private fun canReorderTabs(): Boolean {
|
||||
return AppModeAssertions.isMonolith() && Registry.`is`("ide.allow.tool.window.tabs.reorder", false)
|
||||
private fun canReorderTabs(decorator: InternalDecoratorImpl): Boolean {
|
||||
return AppModeAssertions.isMonolith()
|
||||
&& Registry.`is`("ide.allow.tool.window.tabs.reorder", false)
|
||||
&& (Registry.`is`("ide.allow.tool.window.tabs.reorder.vcs", true)
|
||||
|| decorator.toolWindow.id !in VCS_TOOLWINDOW_IDS)
|
||||
}
|
||||
|
||||
private sealed interface DropLocation {
|
||||
@@ -502,4 +505,13 @@ internal class ToolWindowInnerDragHelper(parent: Disposable, val pane: JComponen
|
||||
pack()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val VCS_TOOLWINDOW_IDS = listOf(
|
||||
"Commit",
|
||||
"Version Control",
|
||||
"Pull Requests",
|
||||
"Merge Requests",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,8 @@ 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.allow.tool.window.tabs.reorder.vcs=false
|
||||
ide.allow.tool.window.tabs.reorder.vcs.description=Whether reordering tool window tabs using drag and drop is allowed in VCS tool windows
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user