Skip to content

Commit

Permalink
IDEA-336983 vcs: fix initial selection in Commit Dialog
Browse files Browse the repository at this point in the history
Reset initial tree state until after the 'SingleChangeListCommitWorkflowHandler.activate' is called,
as up-to-date inclusion is used to compute initial selection.

Follow-up: 20b8582f9186083c6b4470d7b85b5aa0eba2557a
           4b2df3f6754161cb35289a3f483b19c9056aa780

GitOrigin-RevId: 804419b8f32673c5f94e09271bf7f3891ea44abf
  • Loading branch information
AMPivovarov authored and intellij-monorepo-bot committed Dec 18, 2023
1 parent 7f19dfa commit af4628d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private void beforeInit() {
updateWarning();
}

private void afterInit() {
protected void afterInit() {
updateButtons();
updateLegend();
myCommitMessageArea.setChangesSupplier(new ChangeListChangesSupplier(getChangeList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vcs.changes.LocalChangeList
import com.intellij.openapi.vcs.impl.LineStatusTrackerManager
import com.intellij.openapi.vcs.ui.CommitMessage
import com.intellij.util.EventDispatcher
import com.intellij.util.ui.JBUI
Expand All @@ -20,7 +19,7 @@ import java.awt.Dimension
import javax.swing.JComponent
import javax.swing.border.EmptyBorder

class DefaultCommitChangeListDialog(workflow: SingleChangeListCommitWorkflow) : CommitChangeListDialog(workflow) {
class DefaultCommitChangeListDialog(val workflow: SingleChangeListCommitWorkflow) : CommitChangeListDialog(workflow) {
private val changeListEventDispatcher = EventDispatcher.create(SingleChangeListCommitWorkflowUi.ChangeListListener::class.java)

private val browser = MultipleLocalChangeListsBrowser(project, workflow.vcses, true, true,
Expand All @@ -36,7 +35,7 @@ class DefaultCommitChangeListDialog(workflow: SingleChangeListCommitWorkflow) :
val initialChangeList = workflow.initialChangeList
if (initialChangeList != null) browser.selectedChangeList = initialChangeList
browser.viewer.rebuildTree()
browser.viewer.setKeepTreeState(true)
browser.viewer.isKeepTreeState = true

browser.setBottomDiffComponent {
DiffCommitMessageEditor(project, commitMessageComponent).also { editor ->
Expand All @@ -53,6 +52,12 @@ class DefaultCommitChangeListDialog(workflow: SingleChangeListCommitWorkflow) :
}, this)
}

override fun afterInit() {
super.afterInit()

browser.viewer.resetTreeState()
}

override fun createCenterPanel(): JComponent =
simplePanel(super.createCenterPanel()).apply {
putClientProperty(IS_VISUAL_PADDING_COMPENSATED_ON_COMPONENT_LEVEL_KEY, false)
Expand Down

0 comments on commit af4628d

Please sign in to comment.