From 7ac801ad5e9b54715a0551e971fa92e4a613c2b0 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 27 May 2024 18:15:24 +0200 Subject: [PATCH] [lvcs] use different splitter proportions with and without changes browser Changes browser requires more horizontal space, while the version list can be narrow. GitOrigin-RevId: 0067eab5cc41c203b41d48a7b160fa3184fc750c --- .../platform/lvcs/impl/ui/ActivityView.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/platform/lvcs-impl/src/com/intellij/platform/lvcs/impl/ui/ActivityView.kt b/platform/lvcs-impl/src/com/intellij/platform/lvcs/impl/ui/ActivityView.kt index d3b3d9baeb52..23a67936a9ab 100644 --- a/platform/lvcs-impl/src/com/intellij/platform/lvcs/impl/ui/ActivityView.kt +++ b/platform/lvcs-impl/src/com/intellij/platform/lvcs/impl/ui/ActivityView.kt @@ -109,7 +109,9 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ changesSplitter.firstComponent = mainComponent changesSplitter.secondComponent = changesBrowser - val diffSplitter = OnePixelSplitter(false, "lvcs.diff.splitter.horizontal", 0.2f) + val diffSplitter = OnePixelSplitter(false, + if (changesBrowser != null) "lvcs.diff.with.changes.splitter.horizontal" else "lvcs.diff.with.list.splitter.horizontal", + if (changesBrowser != null) 0.4f else 0.2f) diffSplitter.firstComponent = changesSplitter diffSplitter.secondComponent = frameDiffPreview?.component @@ -119,6 +121,7 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ override fun onSelectionChanged(selection: ActivitySelection) { model.setSelection(selection) } + override fun onEnter(): Boolean = showDiff() override fun onDoubleClick(): Boolean = showDiff() }, this) @@ -127,15 +130,18 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ activityList.updateEmptyText(true) progressStripe.startLoading() } + override fun onItemsLoadingStopped(data: ActivityData) { activityList.setData(data) activityList.updateEmptyText(false) progressStripe.stopLoading() } + override fun onFilteringStarted() { filterProgress.startLoading(false) activityList.updateEmptyText(true) } + override fun onFilteringStopped(result: Set?) { filterProgress.stopLoading() activityList.setVisibleItems(result) @@ -152,7 +158,7 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ model.diffMode = currentDiffMode isFocusCycleRoot = true - focusTraversalPolicy = object: ComponentsListFocusTraversalPolicy() { + focusTraversalPolicy = object : ComponentsListFocusTraversalPolicy() { override fun getOrderedComponents(): List { return listOfNotNull(activityList, changesBrowser?.preferredFocusedComponent, searchField.textComponent, frameDiffPreview?.preferredFocusedComponent) @@ -178,6 +184,7 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ override fun onDiffDataLoadingStarted() { changesBrowser.loadingStarted() } + override fun onDiffDataLoadingStopped(diffData: ActivityDiffData?) { changesBrowser.loadingFinished(diffData) } @@ -221,7 +228,7 @@ class ActivityView(private val project: Project, gateway: IdeaGateway, val activ } FilterKind.CONTENT -> SearchFieldComponent.MultiLine().also { field -> field.containerComponent.setBorder(JBUI.Borders.compound(IdeBorderFactory.createBorder(SideBorder.RIGHT), - field.containerComponent.border)) + field.containerComponent.border)) field.textComponent.emptyText.text = LocalHistoryBundle.message("activity.filter.empty.text.content") dumbAwareAction { selectNextOccurence(true) }.registerCustomShortcutSet(Utils.shortcutSetOf( @@ -380,11 +387,13 @@ private fun dumbAwareAction(runnable: () -> Unit): DumbAwareAction { private sealed interface SearchFieldComponent { val containerComponent: JPanel val textComponent: JTextComponent - class SingleLine: SearchFieldComponent { + + class SingleLine : SearchFieldComponent { override val containerComponent = SearchTextField("Lvcs.FileFilter.History") override val textComponent: JBTextField get() = containerComponent.textEditor } - class MultiLine: SearchFieldComponent { + + class MultiLine : SearchFieldComponent { private val textArea = JBTextArea() override val containerComponent = SearchTextArea(textArea, true) override val textComponent = textArea