From 54fb46a681f5ae3bca389d8a25da7366deba2be6 Mon Sep 17 00:00:00 2001 From: Konstantin Hudyakov Date: Wed, 23 Oct 2024 19:27:02 +0300 Subject: [PATCH] IJOB-575 Fix stuck in Git Changelists and Shelve lesson The UI of the VCS popup that opens on a gutter click was changed in the scope of IJPL-161089. GitOrigin-RevId: b5f7ed13c1730f3bf20394c32703bb150a3cbe87 --- .../resources/messages/GitLessonsBundle.properties | 2 +- .../git/lesson/GitChangelistsAndShelveLesson.kt | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/git-features-trainer/resources/messages/GitLessonsBundle.properties b/plugins/git-features-trainer/resources/messages/GitLessonsBundle.properties index 1307339650d6..20ffd4d68a3a 100644 --- a/plugins/git-features-trainer/resources/messages/GitLessonsBundle.properties +++ b/plugins/git-features-trainer/resources/messages/GitLessonsBundle.properties @@ -153,7 +153,7 @@ git.changelists.shelf.introduction=Suppose you don't want to commit some changes You can move a comment to a new changelist, so it won't be committed accidentally. \ Click the highlighted line marker to open the context menu. git.changelists.shelf.click.line.marker.balloon=Click the line marker -git.changelists.shelf.choose.new.changelist=Click {0} and select the {1} menu item. +git.changelists.shelf.choose.new.changelist=Click the highlighted icon and select the {0} menu item. git.changelists.shelf.create.changelist=Name the new changelist {0}. Press {1} or click {2} to create a new changelist. git.changelists.shelf.open.commit.window=Now let's inspect the created changelist. git.changelists.shelf.explanation=In addition, you can use the {0} feature to save these changes in a file on your computer. \ diff --git a/plugins/git-features-trainer/src/training/git/lesson/GitChangelistsAndShelveLesson.kt b/plugins/git-features-trainer/src/training/git/lesson/GitChangelistsAndShelveLesson.kt index a1b631e145ad..90a59a01936c 100644 --- a/plugins/git-features-trainer/src/training/git/lesson/GitChangelistsAndShelveLesson.kt +++ b/plugins/git-features-trainer/src/training/git/lesson/GitChangelistsAndShelveLesson.kt @@ -4,6 +4,8 @@ package training.git.lesson import com.intellij.CommonBundle import com.intellij.codeInsight.hint.HintManager import com.intellij.idea.ActionsBundle +import com.intellij.openapi.actionSystem.ActionGroup +import com.intellij.openapi.actionSystem.impl.ActionButton import com.intellij.openapi.actionSystem.impl.ActionMenuItem import com.intellij.openapi.application.ModalityState import com.intellij.openapi.application.invokeAndWaitIfNeeded @@ -25,7 +27,6 @@ import com.intellij.openapi.vcs.changes.ui.CommitChangeListDialog import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.wm.ToolWindowId import com.intellij.psi.PsiDocumentManager -import com.intellij.ui.components.DropDownLink import com.intellij.util.DocumentUtil import com.intellij.util.ui.JBUI import training.dsl.* @@ -88,8 +89,9 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe text(GitLessonsBundle.message("git.changelists.shelf.introduction")) text(GitLessonsBundle.message("git.changelists.shelf.click.line.marker.balloon"), LearningBalloonConfig(Balloon.Position.below, 0)) - triggerAndBorderHighlight().component { ui: DropDownLink<*> -> - ui.text?.contains(defaultChangelistName) == true + triggerAndBorderHighlight().component { ui: ActionButton -> + val group = ui.action as? ActionGroup ?: return@component false + group.getChildren(null).any { it.templateText == VcsBundle.message("ex.new.changelist") } } test { ideFrame { @@ -104,15 +106,15 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe task { val newChangelistText = VcsBundle.message("ex.new.changelist") - text(GitLessonsBundle.message("git.changelists.shelf.choose.new.changelist", - strong(defaultChangelistName), strong(newChangelistText))) + text(GitLessonsBundle.message("git.changelists.shelf.choose.new.changelist", strong(newChangelistText))) triggerUI().component { ui: EditorComponentImpl -> ui.text.contains(defaultChangelistName) } restoreByUi(highlightLineMarkerTaskId) test { ideFrame { - button(defaultChangelistName).click() + val changelistsButton = previous.ui as? ActionButton ?: return@ideFrame + jComponent(changelistsButton).click() jList(newChangelistText).clickItem(newChangelistText) } }