mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-163688 IJPL-161046 vcs: use adaptive layout for Stash toolwindow
Show splitter-preview for vertical toolwindow if it shares the toolwindow with VCS-Log. (cherry picked from commit 874fb91ce8d58fd5373ed9b12f7dd12e12112d2e) IJ-CR-150517 GitOrigin-RevId: 8c3609e6a537f96bf0b7601b297a4c8e0f58f56a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a79c5a028a
commit
958784b947
@@ -8,6 +8,7 @@ import com.intellij.openapi.actionSystem.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vcs.VcsBundle
|
||||
import com.intellij.openapi.vcs.changes.shouldHaveSplitterDiffPreview
|
||||
import com.intellij.ui.*
|
||||
import com.intellij.util.EditSourceOnDoubleClickHandler
|
||||
import com.intellij.util.Processor
|
||||
@@ -23,13 +24,15 @@ import java.awt.FlowLayout
|
||||
import javax.swing.*
|
||||
import javax.swing.border.CompoundBorder
|
||||
|
||||
open class SavedPatchesUi(project: Project,
|
||||
@ApiStatus.Internal val providers: List<SavedPatchesProvider<*>>,
|
||||
private val isVertical: () -> Boolean,
|
||||
private val isWithSplitDiffPreview: () -> Boolean,
|
||||
private val isShowDiffWithLocal: () -> Boolean,
|
||||
focusMainUi: (Component?) -> Unit,
|
||||
disposable: Disposable) :
|
||||
open class SavedPatchesUi(
|
||||
private val project: Project,
|
||||
@ApiStatus.Internal val providers: List<SavedPatchesProvider<*>>,
|
||||
private val isVertical: () -> Boolean,
|
||||
private val isWithSplitDiffPreview: () -> Boolean,
|
||||
private val isShowDiffWithLocal: () -> Boolean,
|
||||
focusMainUi: (Component?) -> Unit,
|
||||
disposable: Disposable,
|
||||
) :
|
||||
JPanel(BorderLayout()), Disposable, UiDataProvider {
|
||||
|
||||
protected val patchesTree: SavedPatchesTree
|
||||
@@ -140,7 +143,7 @@ open class SavedPatchesUi(project: Project,
|
||||
|
||||
private fun updateLayout(isInitial: Boolean) {
|
||||
val isVertical = isVertical()
|
||||
val isWithSplitPreview = !isVertical && isWithSplitDiffPreview()
|
||||
val isWithSplitPreview = shouldHaveSplitterDiffPreview(project, isVertical) && isWithSplitDiffPreview()
|
||||
val isChangesSplitterVertical = isVertical || isWithSplitPreview
|
||||
if (treeChangesSplitter.orientation != isChangesSplitterVertical) {
|
||||
treeChangesSplitter.orientation = isChangesSplitterVertical
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||
import com.intellij.openapi.vcs.changes.shouldHaveSplitterDiffPreview
|
||||
import git4idea.config.GitVcsApplicationSettings
|
||||
|
||||
internal class GitStashToggleSplitPreviewAction : DumbAwareToggleAction() {
|
||||
@@ -15,7 +16,7 @@ internal class GitStashToggleSplitPreviewAction : DumbAwareToggleAction() {
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
}
|
||||
e.presentation.isEnabledAndVisible = !isStashTabVertical(project)
|
||||
e.presentation.isEnabledAndVisible = shouldHaveSplitterDiffPreview(project, isStashTabVertical(project))
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
|
||||
|
||||
Reference in New Issue
Block a user