mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[IFT] Refactoring: use the new API for trigger and highlighting
IJ-CR-20587 GitOrigin-RevId: 07ecb4e2e9dd740ebcccbadc80db6b15416cef80
This commit is contained in:
committed by
intellij-monorepo-bot
parent
27ea220aa8
commit
6be33ab243
+1
-1
@@ -74,7 +74,7 @@ open class JavaBasicCompletionLesson : KLesson("Basic completion", LessonsBundle
|
||||
protected fun LessonContext.invokeCompletionTasks(itemToChoose: String, resultingMethodCall: String) {
|
||||
task("CodeCompletion") {
|
||||
text(JavaLessonsBundle.message("java.basic.completion.activate", action(it)))
|
||||
triggerByListItemAndHighlight(false, false) { item -> item.isToStringContains(itemToChoose) }
|
||||
triggerUI().listItem { item -> item.isToStringContains(itemToChoose) }
|
||||
restoreIfModifiedOrMoved()
|
||||
test {
|
||||
invokeCompletion()
|
||||
|
||||
+2
-2
@@ -58,7 +58,7 @@ class JavaInheritanceHierarchyLesson
|
||||
task("GotoImplementation") {
|
||||
text(JavaLessonsBundle.message("java.inheritance.hierarchy.invoke.implementations.again", icon(AllIcons.Gutter.ImplementedMethod),
|
||||
action(it)))
|
||||
triggerByUiComponentAndHighlight { ui: InplaceButton ->
|
||||
triggerAndFullHighlight().component { ui: InplaceButton ->
|
||||
ui.toolTipText == IdeBundle.message("show.in.find.window.button.name")
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -73,7 +73,7 @@ class JavaInheritanceHierarchyLesson
|
||||
text(JavaLessonsBundle.message("java.inheritance.hierarchy.open.in.find.tool.window", findToolWindow(),
|
||||
icon(ToolWindowManager.getInstance(project).getLocationIcon(ToolWindowId.FIND,
|
||||
AllIcons.General.Pin_tab))))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: BaseLabel ->
|
||||
triggerUI().component { ui: BaseLabel ->
|
||||
ui.text == (CodeInsightBundle.message("goto.implementation.findUsages.title", "foo")) ||
|
||||
ui.text == (JavaAnalysisBundle.message("navigate.to.overridden.methods.title", "foo"))
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class JavaOccurrencesLesson
|
||||
|
||||
task("Find") {
|
||||
text(JavaLessonsBundle.message("java.find.occurrences.invoke.find", code("cellphone"), action(it)))
|
||||
triggerByUiComponentAndHighlight(false, false) { _: SearchTextArea -> true }
|
||||
triggerUI().component { _: SearchTextArea -> true }
|
||||
restoreIfModifiedOrMoved()
|
||||
test { actions(it) }
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class JavaExtractMethodCocktailSortLesson
|
||||
task {
|
||||
text(JavaLessonsBundle.message("java.extract.method.edit.method.name", rawEnter()))
|
||||
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { dialog: JDialog ->
|
||||
triggerUI().component { dialog: JDialog ->
|
||||
dialog.title == processDuplicatesTitle
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class JavaDebugLesson : CommonDebugLesson("java.debug.workflow") {
|
||||
task("CompileDirty") {
|
||||
text(JavaLessonsBundle.message("java.debug.workflow.rebuild", action(it), icon(AllIcons.Actions.Compile)))
|
||||
if (isAlwaysHotSwap()) {
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: JEditorPane ->
|
||||
triggerUI().component { ui: JEditorPane ->
|
||||
ui.text.contains(JavaDebuggerBundle.message("status.hot.swap.completed.stop"))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class JavaRunConfigurationLesson : CommonRunConfigurationLesson("java.run.config
|
||||
|
||||
override fun LessonContext.runTask() {
|
||||
task {
|
||||
triggerByPartOfComponent<EditorGutterComponentEx> l@{ ui ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorGutterComponentEx ->
|
||||
if (CommonDataKeys.EDITOR.getData(ui as DataProvider) != editor) return@l null
|
||||
val y = editor.visualLineToY(0)
|
||||
return@l Rectangle(25, y, ui.width - 40, editor.lineHeight * 2)
|
||||
|
||||
@@ -58,14 +58,14 @@ object GitLessonsUtil {
|
||||
|
||||
// clear Git tool window to return it to default state (needed in case of restarting the lesson)
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: SearchTextField ->
|
||||
triggerUI().component { ui: SearchTextField ->
|
||||
if (UIUtil.getParentOfType(MainFrame::class.java, ui) != null) {
|
||||
ui.reset()
|
||||
true
|
||||
}
|
||||
else false
|
||||
}
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: VcsLogGraphTable ->
|
||||
triggerUI().component { ui: VcsLogGraphTable ->
|
||||
ui.jumpToRow(0, true)
|
||||
ui.selectionModel.clearSelection()
|
||||
true
|
||||
@@ -77,7 +77,10 @@ object GitLessonsUtil {
|
||||
sequenceLength: Int = 1,
|
||||
highlightInside: Boolean = true,
|
||||
usePulsation: Boolean = false) {
|
||||
triggerByPartOfComponent(highlightInside = highlightInside, usePulsation = usePulsation) { ui: VcsLogGraphTable ->
|
||||
triggerAndBorderHighlight {
|
||||
this.highlightInside = highlightInside
|
||||
this.usePulsation = usePulsation
|
||||
}.componentPart { ui: VcsLogGraphTable ->
|
||||
ui.getRectForSubsequentCommits(startCommitRow, sequenceLength)
|
||||
}
|
||||
}
|
||||
@@ -86,7 +89,10 @@ object GitLessonsUtil {
|
||||
highlightInside: Boolean = true,
|
||||
usePulsation: Boolean = false,
|
||||
startCommitPredicate: (VcsCommitMetadata) -> Boolean) {
|
||||
triggerByPartOfComponent(highlightInside = highlightInside, usePulsation = usePulsation) { ui: VcsLogGraphTable ->
|
||||
triggerAndBorderHighlight {
|
||||
this.highlightInside = highlightInside
|
||||
this.usePulsation = usePulsation
|
||||
}.componentPart { ui: VcsLogGraphTable ->
|
||||
val rowIndexes = (0 until ui.rowCount).toList().toIntArray()
|
||||
val startCommitRow = ui.model.getCommitMetadata(rowIndexes).indexOfFirst(startCommitPredicate)
|
||||
if (startCommitRow >= 0) {
|
||||
@@ -288,7 +294,7 @@ object GitLessonsUtil {
|
||||
actionClass: KClass<T>) {
|
||||
if (UISettings.getInstance().run { showNavigationBar || showMainToolbar }) {
|
||||
text("$introduction $suggestionWithIcon")
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: ActionButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: ActionButton ->
|
||||
actionClass.isInstance(ui.action)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.annotate.introduction", strong(annotateActionName)))
|
||||
triggerByPartOfComponent l@{ ui: EditorComponentImpl ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorComponentImpl ->
|
||||
val startOffset = ui.editor.document.charsSequence.indexOf(firstStateText)
|
||||
if (startOffset == -1) return@l null
|
||||
val endOffset = startOffset + firstStateText.length
|
||||
@@ -123,7 +123,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: EditorComponentImpl ->
|
||||
triggerUI().component { ui: EditorComponentImpl ->
|
||||
if (ui.editor.document.charsSequence.contains(secondStateText)) {
|
||||
firstDiffSplitter = UIUtil.getParentOfType(DiffSplitter::class.java, ui)
|
||||
true
|
||||
@@ -175,7 +175,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
text(GitLessonsBundle.message("git.annotate.show.diff", strong(showDiffText)))
|
||||
highlightAnnotation(firstDiffSplitter, secondStateText, highlightRight = false)
|
||||
highlightShowDiffMenuItem()
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: EditorComponentImpl ->
|
||||
triggerUI().component { ui: EditorComponentImpl ->
|
||||
if (ui.editor.document.charsSequence.contains(thirdStateText)) {
|
||||
secondDiffSplitter = UIUtil.getParentOfType(DiffSplitter::class.java, ui)
|
||||
true
|
||||
@@ -218,7 +218,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.annotate.click.annotation"))
|
||||
highlightAnnotation(secondDiffSplitter, secondStateText, highlightRight = true)
|
||||
triggerByUiComponentAndHighlight(highlightInside = false, usePulsation = true) { ui: CommitDetailsListPanel ->
|
||||
triggerAndBorderHighlight { usePulsation = true }.component { ui: CommitDetailsListPanel ->
|
||||
val textPanel = UIUtil.findComponentOfType(ui, HtmlPanel::class.java)
|
||||
textPanel?.text?.contains(partOfTargetCommitMessage) == true
|
||||
}
|
||||
@@ -271,7 +271,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
val closeAnnotationsText = EditorBundle.message("close.editor.annotations.action.name")
|
||||
text(GitLessonsBundle.message("git.annotate.close.annotations") + " "
|
||||
+ GitLessonsBundle.message("git.annotate.invoke.manually.2", strong(closeAnnotationsText)))
|
||||
triggerByPartOfComponent { ui: EditorGutterComponentEx ->
|
||||
triggerAndBorderHighlight().componentPart { ui: EditorGutterComponentEx ->
|
||||
if (CommonDataKeys.EDITOR.getData(ui as DataProvider) == editor) {
|
||||
Rectangle(ui.x + ui.annotationsAreaOffset, ui.y, ui.annotationsAreaWidth, ui.height)
|
||||
}
|
||||
@@ -298,7 +298,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
}
|
||||
|
||||
private fun TaskContext.highlightGutterComponent(splitter: DiffSplitter?, partOfEditorText: String, highlightRight: Boolean) {
|
||||
triggerByPartOfComponent l@{ ui: EditorGutterComponentEx ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorGutterComponentEx ->
|
||||
if (ui.checkInsideSplitterAndRightEditor(splitter, partOfEditorText)) {
|
||||
if (highlightRight) {
|
||||
Rectangle(ui.x, ui.y, ui.width - 5, ui.height)
|
||||
@@ -316,7 +316,7 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
}
|
||||
|
||||
private fun TaskContext.highlightAnnotation(splitter: DiffSplitter?, partOfLineText: String, highlightRight: Boolean) {
|
||||
triggerByPartOfComponent l@{ ui: EditorGutterComponentEx ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorGutterComponentEx ->
|
||||
if (splitter != null && !isInsideSplitter(splitter, ui)) return@l null
|
||||
ui.getAnnotationRect(partOfLineText, highlightRight)
|
||||
}
|
||||
@@ -345,12 +345,11 @@ class GitAnnotateLesson : GitLesson("Git.Annotate", GitLessonsBundle.message("gi
|
||||
}
|
||||
|
||||
private fun TaskContext.highlightMenuItem(clearPreviousHighlights: Boolean, predicate: (ActionMenuItem) -> Boolean) {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false,
|
||||
clearPreviousHighlights = clearPreviousHighlights) { ui: ActionMenuItem -> predicate(ui) }
|
||||
triggerAndBorderHighlight { this.clearPreviousHighlights = clearPreviousHighlights }.component { ui: ActionMenuItem -> predicate(ui) }
|
||||
}
|
||||
|
||||
private fun TaskContext.triggerOnAnnotationsShown(splitter: DiffSplitter?, partOfEditorText: String) {
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: EditorComponentImpl ->
|
||||
triggerUI().component { ui: EditorComponentImpl ->
|
||||
ui.editor.document.charsSequence.contains(partOfEditorText)
|
||||
&& UIUtil.getParentOfType(DiffSplitter::class.java, ui) == splitter
|
||||
&& isAnnotationsShown(ui.editor)
|
||||
|
||||
+10
-10
@@ -78,7 +78,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
lateinit var highlightLineMarkerTaskId: TaskContext.TaskId
|
||||
task {
|
||||
highlightLineMarkerTaskId = taskId
|
||||
triggerByPartOfComponent(highlightInside = true, usePulsation = true) l@{ ui: EditorGutterComponentEx ->
|
||||
triggerAndFullHighlight { usePulsation = true }.componentPart l@{ ui: EditorGutterComponentEx ->
|
||||
if (CommonDataKeys.EDITOR.getData(ui as DataProvider) != editor) return@l null
|
||||
ui.getLineMarkerRect(commentText)
|
||||
}
|
||||
@@ -88,7 +88,7 @@ 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))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: DropDownLink<*> ->
|
||||
triggerAndBorderHighlight().component { ui: DropDownLink<*> ->
|
||||
ui.text?.contains(defaultChangelistName) == true
|
||||
}
|
||||
test {
|
||||
@@ -106,7 +106,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
val newChangelistText = VcsBundle.message("ex.new.changelist")
|
||||
text(GitLessonsBundle.message("git.changelists.shelf.choose.new.changelist",
|
||||
strong(defaultChangelistName), strong(newChangelistText)))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: EditorComponentImpl ->
|
||||
triggerUI().component { ui: EditorComponentImpl ->
|
||||
ui.text.contains(defaultChangelistName)
|
||||
}
|
||||
restoreByUi(highlightLineMarkerTaskId)
|
||||
@@ -154,7 +154,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: ChangesListView ->
|
||||
triggerUI().component { ui: ChangesListView ->
|
||||
ui.expandAll()
|
||||
true
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
lateinit var letsShelveTaskId: TaskContext.TaskId
|
||||
task {
|
||||
letsShelveTaskId = taskId
|
||||
triggerByFoundPathAndHighlight(highlightInside = true) { _, path ->
|
||||
triggerAndFullHighlight().treeItem { _, path ->
|
||||
path.getPathComponent(path.pathCount - 1).toString().contains(newChangeListName)
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
text(GitLessonsBundle.message("git.changelists.shelf.open.context.menu"))
|
||||
text(GitLessonsBundle.message("git.changelists.shelf.click.changelist.tooltip", strong(newChangeListName)),
|
||||
LearningBalloonConfig(Balloon.Position.above, 250))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: ActionMenuItem ->
|
||||
triggerAndBorderHighlight().component { ui: ActionMenuItem ->
|
||||
ui.anAction is ShelveChangesAction
|
||||
}
|
||||
showWarningIfCommitWindowClosed(restoreTaskWhenResolved = true)
|
||||
@@ -205,7 +205,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
|
||||
val shelveChangesButtonText = VcsBundle.message("shelve.changes.action").dropMnemonic()
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: JButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: JButton ->
|
||||
ui.text?.contains(shelveChangesButtonText) == true
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
|
||||
val removeButtonText = VcsBundle.message("button.remove")
|
||||
task {
|
||||
triggerByUiComponentAndHighlight { ui: JButton ->
|
||||
triggerAndFullHighlight().component { ui: JButton ->
|
||||
ui.text?.contains(removeButtonText) == true
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.changelists.shelf.performed.explanation", strong(shelfText)))
|
||||
triggerByFoundPathAndHighlight(highlightInside = true, usePulsation = true) { _, path ->
|
||||
triggerAndBorderHighlight { usePulsation = true }.treeItem { _, path ->
|
||||
path.pathCount == 2
|
||||
}
|
||||
proceedLink()
|
||||
@@ -252,7 +252,7 @@ class GitChangelistsAndShelveLesson : GitLesson("Git.ChangelistsAndShelf", GitLe
|
||||
val unshelveChangesButtonText = VcsBundle.message("unshelve.changes.action")
|
||||
task("ShelveChanges.UnshelveWithDialog") {
|
||||
text(GitLessonsBundle.message("git.changelists.shelf.open.unshelve.dialog", strong(shelfText), action(it)))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: JButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: JButton ->
|
||||
ui.text?.contains(unshelveChangesButtonText) == true
|
||||
}
|
||||
showWarningIfCommitWindowClosed()
|
||||
|
||||
@@ -111,7 +111,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByPartOfComponent(false) l@{ ui: ChangesListView ->
|
||||
triggerUI().componentPart l@{ ui: ChangesListView ->
|
||||
val path = TreeUtil.treePathTraverser(ui).find { it.getPathComponent(it.pathCount - 1).toString().contains(firstFileName) }
|
||||
?: return@l null
|
||||
val rect = ui.getPathBounds(path) ?: return@l null
|
||||
@@ -133,7 +133,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: ActionButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: ActionButton ->
|
||||
ActionManager.getInstance().getId(ui.action) == "ChangesView.ShowCommitOptions"
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
text(GitLessonsBundle.message("git.commit.open.before.commit.options", icon(AllIcons.General.Gear)))
|
||||
text(GitLessonsBundle.message("git.commit.open.options.tooltip", strong(commitWindowName)),
|
||||
LearningBalloonConfig(Balloon.Position.above, 0))
|
||||
triggerByUiComponentAndHighlight(false, false) { _: CommitOptionsPanel -> true }
|
||||
triggerUI().component { _: CommitOptionsPanel -> true }
|
||||
showWarningIfCommitWindowClosed(restoreTaskWhenResolved = true)
|
||||
test {
|
||||
ideFrame {
|
||||
@@ -155,7 +155,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
|
||||
val reformatCodeButtonText = VcsBundle.message("checkbox.checkin.options.reformat.code").dropMnemonic()
|
||||
task {
|
||||
triggerByUiComponentAndHighlight { ui: JBCheckBox ->
|
||||
triggerAndFullHighlight().component { ui: JBCheckBox ->
|
||||
ui.text?.contains(reformatCodeButtonText) == true
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
val analyzeOptionText = VcsBundle.message("before.checkin.standard.options.check.smells").dropMnemonic()
|
||||
text(GitLessonsBundle.message("git.commit.analyze.code.explanation", strong(analyzeOptionText)))
|
||||
text(GitLessonsBundle.message("git.commit.enable.reformat.code", strong(reformatCodeButtonText)))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JBCheckBox ->
|
||||
triggerUI().component { ui: JBCheckBox ->
|
||||
ui.text?.contains(reformatCodeButtonText) == true && ui.isSelected
|
||||
}
|
||||
restoreByUi(showOptionsTaskId)
|
||||
@@ -187,7 +187,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
val commitButtonText = GitBundle.message("commit.action.name").dropMnemonic()
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.commit.perform.commit", strong(commitButtonText)))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: JBOptionButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: JBOptionButton ->
|
||||
ui.text?.contains(commitButtonText) == true
|
||||
}
|
||||
triggerOnNotification { it.displayId == VcsNotificationIdsHolder.COMMIT_FINISHED }
|
||||
@@ -227,7 +227,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.commit.committed.file.explanation"))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false, usePulsation = true) { _: VcsLogChangesBrowser -> true }
|
||||
triggerAndBorderHighlight { usePulsation = true }.component { _: VcsLogChangesBrowser -> true }
|
||||
proceedLink()
|
||||
showWarningIfGitWindowClosed()
|
||||
}
|
||||
@@ -239,10 +239,10 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
strong(amendCheckboxText),
|
||||
LessonUtil.rawKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.ALT_DOWN_MASK)),
|
||||
strong(commitWindowName)))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: JBCheckBox ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: JBCheckBox ->
|
||||
ui.text?.contains(amendCheckboxText) == true
|
||||
}
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JBCheckBox ->
|
||||
triggerUI().component { ui: JBCheckBox ->
|
||||
ui.text?.contains(amendCheckboxText) == true && ui.isSelected
|
||||
}
|
||||
showWarningIfCommitWindowClosed()
|
||||
@@ -267,7 +267,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
task {
|
||||
val amendButtonText = VcsBundle.message("amend.action.name", commitButtonText)
|
||||
text(GitLessonsBundle.message("git.commit.amend.commit", strong(amendButtonText)))
|
||||
triggerByUiComponentAndHighlight { ui: JBOptionButton ->
|
||||
triggerAndFullHighlight().component { ui: JBOptionButton ->
|
||||
UIUtil.getParentOfType(CommitActionsPanel::class.java, ui) != null
|
||||
}
|
||||
triggerOnNotification { it.displayId == VcsNotificationIdsHolder.COMMIT_FINISHED }
|
||||
@@ -297,13 +297,13 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
}
|
||||
|
||||
private fun TaskContext.highlightVcsChange(changeFileName: String, highlightBorder: Boolean = true) {
|
||||
triggerByFoundPathAndHighlight(highlightBorder) { _: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { _: JTree, path: TreePath ->
|
||||
path.pathCount > 2 && path.getPathComponent(2).toString().contains(changeFileName)
|
||||
}
|
||||
}
|
||||
|
||||
private fun TaskContext.triggerOnOneChangeIncluded(changeFileName: String) {
|
||||
triggerByUiComponentAndHighlight(false, false) l@{ ui: ChangesListView ->
|
||||
triggerUI().component l@{ ui: ChangesListView ->
|
||||
val includedChanges = ui.includedSet
|
||||
if (includedChanges.size != 1) return@l false
|
||||
val change = includedChanges.first() as? ChangeListChange ?: return@l false
|
||||
@@ -313,7 +313,7 @@ class GitCommitLesson : GitLesson("Git.Commit", GitLessonsBundle.message("git.co
|
||||
|
||||
private fun TaskContext.triggerOnTopCommitSelected() {
|
||||
highlightSubsequentCommitsInGitLog(0)
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: VcsLogGraphTable ->
|
||||
triggerUI().component { ui: VcsLogGraphTable ->
|
||||
ui.isCellSelected(0, 1)
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -95,7 +95,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: TextPanel.WithIconAndArrows -> ui.text == branchName }
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: TextPanel.WithIconAndArrows -> ui.text == branchName }
|
||||
}
|
||||
|
||||
lateinit var firstShowBranchesTaskId: TaskContext.TaskId
|
||||
@@ -108,13 +108,13 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByListItemAndHighlight { item -> item.toString() == main }
|
||||
triggerAndBorderHighlight().listItem { item -> item.toString() == main }
|
||||
}
|
||||
|
||||
task {
|
||||
val checkoutItemText = GitBundle.message("branches.checkout")
|
||||
text(GitLessonsBundle.message("git.feature.branch.checkout.branch", strong(main), strong(checkoutItemText)))
|
||||
triggerByListItemAndHighlight(clearPreviousHighlights = false) { item ->
|
||||
triggerAndBorderHighlight { clearPreviousHighlights = false }.listItem { item ->
|
||||
(item as? PopupFactoryImpl.ActionItem)?.action is GitBranchPopupActions.LocalBranchActions.CheckoutAction
|
||||
}
|
||||
triggerOnCheckout { newBranch -> newBranch == main }
|
||||
@@ -136,7 +136,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
task("Vcs.UpdateProject") {
|
||||
val updateProjectDialogTitle = VcsBundle.message("action.display.name.update.scope", VcsBundle.message("update.project.scope.name"))
|
||||
openUpdateDialogText(GitLessonsBundle.message("git.feature.branch.open.update.dialog", strong(main)))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JDialog ->
|
||||
triggerUI().component { ui: JDialog ->
|
||||
ui.title?.contains(updateProjectDialogTitle) == true
|
||||
}
|
||||
showWarningIfGitWindowClosed()
|
||||
@@ -145,7 +145,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.feature.branch.confirm.update", strong(CommonBundle.getOkButtonText())))
|
||||
triggerByUiComponentAndHighlight { ui: JButton ->
|
||||
triggerAndFullHighlight().component { ui: JButton ->
|
||||
ui.text == CommonBundle.getOkButtonText()
|
||||
}
|
||||
highlightSubsequentCommitsInGitLog { commit ->
|
||||
@@ -164,7 +164,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: TextPanel.WithIconAndArrows -> ui.text == main }
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: TextPanel.WithIconAndArrows -> ui.text == main }
|
||||
}
|
||||
|
||||
lateinit var secondShowBranchesTaskId: TaskContext.TaskId
|
||||
@@ -178,7 +178,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByListItemAndHighlight { item -> item.toString() == branchName }
|
||||
triggerAndBorderHighlight().listItem { item -> item.toString() == branchName }
|
||||
}
|
||||
|
||||
task {
|
||||
@@ -186,7 +186,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
val checkoutAndRebaseText = GitBundle.message("branches.checkout.and.rebase.onto.branch",
|
||||
GitBranchPopupActions.getCurrentBranchTruncatedPresentation(project, repositories))
|
||||
text(GitLessonsBundle.message("git.feature.branch.checkout.and.rebase", strong(branchName), strong(checkoutAndRebaseText)))
|
||||
triggerByListItemAndHighlight(clearPreviousHighlights = false) { item ->
|
||||
triggerAndBorderHighlight { clearPreviousHighlights = false }.listItem { item ->
|
||||
item.toString().contains(checkoutAndRebaseText)
|
||||
}
|
||||
triggerOnNotification { notification -> notification.title == GitBundle.message("rebase.notification.successful.title") }
|
||||
@@ -202,7 +202,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
|
||||
task("Vcs.Push") {
|
||||
openPushDialogText(GitLessonsBundle.message("git.feature.branch.open.push.dialog", strong(branchName)))
|
||||
triggerByUiComponentAndHighlight(false, false) { _: PushLog -> true }
|
||||
triggerUI().component { _: PushLog -> true }
|
||||
test { actions(it) }
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.feature.branch.choose.force.push",
|
||||
strong(branchName), strong(forcePushText), strong(DvcsBundle.message("action.push").dropMnemonic())))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { _: BasicOptionButtonUI.ArrowButton -> true }
|
||||
triggerAndFullHighlight { usePulsation = true }.component { _: BasicOptionButtonUI.ArrowButton -> true }
|
||||
val forcePushDialogTitle = DvcsBundle.message("force.push.dialog.title")
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JDialog ->
|
||||
triggerUI().component { ui: JDialog ->
|
||||
ui.title?.contains(forcePushDialogTitle) == true
|
||||
}
|
||||
restoreByUi()
|
||||
@@ -244,7 +244,7 @@ class GitFeatureBranchWorkflowLesson : GitLesson("Git.BasicWorkflow", GitLessons
|
||||
}
|
||||
|
||||
private fun TaskContext.triggerOnBranchesPopupShown() {
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: EngravedLabel ->
|
||||
triggerUI().component { ui: EngravedLabel ->
|
||||
val branchesInRepoText = DvcsBundle.message("branch.popup.vcs.name.branches.in.repo", GitBundle.message("git4idea.vcs.name"),
|
||||
DvcsUtil.getShortRepositoryName(repository))
|
||||
ui.text?.contains(branchesInRepoText) == true
|
||||
|
||||
+13
-10
@@ -93,7 +93,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.open.context.menu"))
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.click.commit.tooltip"),
|
||||
LearningBalloonConfig(Balloon.Position.above, 0))
|
||||
triggerByUiComponentAndHighlight { ui: ActionMenuItem ->
|
||||
triggerAndFullHighlight().component { ui: ActionMenuItem ->
|
||||
ui.text == interactiveRebaseMenuItemText
|
||||
}
|
||||
showWarningIfGitWindowClosed(restoreTaskWhenResolved = true)
|
||||
@@ -132,7 +132,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
}
|
||||
}
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.select.one.commit"))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JBTable ->
|
||||
triggerUI().component { ui: JBTable ->
|
||||
if (isInsideRebaseDialog(ui)) {
|
||||
movingCommitText = ui.model.getValueAt(4, 1).toString()
|
||||
ui.selectedRow == 4
|
||||
@@ -151,13 +151,13 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
task {
|
||||
val moveUpShortcut = CommonShortcuts.MOVE_UP.shortcuts.first() as KeyboardShortcut
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.move.commit", LessonUtil.rawKeyStroke(moveUpShortcut.firstKeyStroke)))
|
||||
triggerByPartOfComponent(highlightInside = true, usePulsation = false) { ui: JBTable ->
|
||||
triggerAndFullHighlight().componentPart { ui: JBTable ->
|
||||
if (isInsideRebaseDialog(ui)) {
|
||||
ui.getCellRect(1, 1, false).apply { height = 1 }
|
||||
}
|
||||
else null
|
||||
}
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JBTable ->
|
||||
triggerUI().component { ui: JBTable ->
|
||||
isInsideRebaseDialog(ui) && ui.model.getValueAt(1, 1).toString() == movingCommitText
|
||||
}
|
||||
restoreByUi(openRebaseDialogTaskId)
|
||||
@@ -170,7 +170,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
val fixupShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.ALT_DOWN_MASK)
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.invoke.fixup", LessonUtil.rawKeyStroke(fixupShortcut),
|
||||
strong(GitBundle.message("rebase.entry.action.name.fixup"))))
|
||||
triggerByUiComponentAndHighlight { ui: BasicOptionButtonUI.ArrowButton -> isInsideRebaseDialog(ui) }
|
||||
triggerAndFullHighlight().component { ui: BasicOptionButtonUI.ArrowButton -> isInsideRebaseDialog(ui) }
|
||||
trigger("git4idea.rebase.interactive.dialog.FixupAction")
|
||||
test(waitEditorToBeReady = false) {
|
||||
invokeActionViaShortcut("ALT F")
|
||||
@@ -180,7 +180,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.select.three.commits", LessonUtil.rawKeyStroke(KeyEvent.VK_SHIFT)))
|
||||
highlightSubsequentCommitsInRebaseDialog(startRowIncl = 2, endRowExcl = 5)
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JBTable ->
|
||||
triggerUI().component { ui: JBTable ->
|
||||
isInsideRebaseDialog(ui) && ui.similarCommitsSelected()
|
||||
}
|
||||
test(waitEditorToBeReady = false) {
|
||||
@@ -197,7 +197,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
val squashShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_DOWN_MASK)
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.invoke.squash",
|
||||
LessonUtil.rawKeyStroke(squashShortcut), strong(GitBundle.message("rebase.entry.action.name.squash"))))
|
||||
triggerByUiComponentAndHighlight { ui: BasicOptionButtonUI.MainButton -> isInsideRebaseDialog(ui) }
|
||||
triggerAndFullHighlight().component { ui: BasicOptionButtonUI.MainButton -> isInsideRebaseDialog(ui) }
|
||||
trigger("git4idea.rebase.interactive.dialog.SquashAction")
|
||||
restoreState {
|
||||
val table = previous.ui as? JBTable ?: return@restoreState false
|
||||
@@ -209,7 +209,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: CommitMessage -> isInsideRebaseDialog(ui) }
|
||||
triggerUI().component { ui: CommitMessage -> isInsideRebaseDialog(ui) }
|
||||
}
|
||||
|
||||
task {
|
||||
@@ -224,7 +224,7 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
task {
|
||||
val startRebasingButtonText = GitBundle.message("rebase.interactive.dialog.start.rebase")
|
||||
text(GitLessonsBundle.message("git.interactive.rebase.start.rebasing", strong(startRebasingButtonText)))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: JButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: JButton ->
|
||||
ui.text?.contains(startRebasingButtonText) == true
|
||||
}
|
||||
triggerOnNotification {
|
||||
@@ -256,7 +256,10 @@ class GitInteractiveRebaseLesson : GitLesson("Git.InteractiveRebase", GitLessons
|
||||
endRowExcl: Int,
|
||||
highlightInside: Boolean = false,
|
||||
usePulsation: Boolean = false) {
|
||||
triggerByPartOfComponent(highlightInside = highlightInside, usePulsation = usePulsation) { ui: JBTable ->
|
||||
triggerAndBorderHighlight {
|
||||
this.highlightInside = highlightInside
|
||||
this.usePulsation = usePulsation
|
||||
}.componentPart { ui: JBTable ->
|
||||
if (isInsideRebaseDialog(ui)) {
|
||||
val rect = ui.getCellRect(startRowIncl, 1, false)
|
||||
rect.height *= endRowExcl - startRowIncl
|
||||
|
||||
@@ -71,7 +71,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
|
||||
task {
|
||||
var selectionCleared = false
|
||||
triggerByFoundPathAndHighlight(highlightInside = true) { tree, path ->
|
||||
triggerAndFullHighlight().treeItem { tree, path ->
|
||||
(path.pathCount > 1 && path.getPathComponent(1).toString() == "HEAD_NODE").also {
|
||||
if (!selectionCleared) {
|
||||
tree.clearSelection()
|
||||
@@ -87,7 +87,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
text(GitLessonsBundle.message("git.project.history.apply.branch.filter", choice))
|
||||
text(GitLessonsBundle.message("git.project.history.click.head.tooltip", choice),
|
||||
LearningBalloonConfig(Balloon.Position.above, 250))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: BranchFilterPopupComponent ->
|
||||
triggerUI().component { ui: BranchFilterPopupComponent ->
|
||||
ui.currentText?.contains("HEAD") == true
|
||||
}
|
||||
showWarningIfGitWindowClosed(restoreTaskWhenResolved = true)
|
||||
@@ -100,7 +100,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight { _: UserFilterPopupComponent -> true }
|
||||
triggerAndFullHighlight().component { _: UserFilterPopupComponent -> true }
|
||||
}
|
||||
|
||||
val meFilterText = VcsLogBundle.message("vcs.log.user.filter.me")
|
||||
@@ -108,7 +108,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
text(GitLessonsBundle.message("git.project.history.apply.user.filter"))
|
||||
text(GitLessonsBundle.message("git.project.history.click.filter.tooltip"),
|
||||
LearningBalloonConfig(Balloon.Position.above, 0))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.toString().contains(meFilterText)
|
||||
}
|
||||
showWarningIfGitWindowClosed(restoreTaskWhenResolved = true)
|
||||
@@ -122,7 +122,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.project.history.select.me", strong(meFilterText)))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: UserFilterPopupComponent ->
|
||||
triggerUI().component { ui: UserFilterPopupComponent ->
|
||||
ui.currentText?.contains(meFilterText) == true
|
||||
}
|
||||
restoreByUi(delayMillis = defaultRestoreDelay)
|
||||
@@ -135,12 +135,12 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.project.history.apply.message.filter", code(textToFind), LessonUtil.rawEnter()))
|
||||
triggerByUiComponentAndHighlight { ui: SearchTextField ->
|
||||
triggerAndFullHighlight().component { ui: SearchTextField ->
|
||||
(UIUtil.getParentOfType(MainFrame::class.java, ui) != null).also {
|
||||
if (it) IdeFocusManager.getInstance(project).requestFocus(ui, true)
|
||||
}
|
||||
}
|
||||
triggerByUiComponentAndHighlight(false, false) l@{ ui: VcsLogGraphTable ->
|
||||
triggerUI().component l@{ ui: VcsLogGraphTable ->
|
||||
val model = ui.model as? GraphTableModel ?: return@l false
|
||||
model.rowCount > 0 && model.getCommitMetadata(0).fullMessage.contains(textToFind)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.project.history.select.commit"))
|
||||
highlightSubsequentCommitsInGitLog(0)
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: VcsLogGraphTable ->
|
||||
triggerUI().component { ui: VcsLogGraphTable ->
|
||||
ui.selectedRow == 0
|
||||
}
|
||||
restoreState {
|
||||
@@ -174,7 +174,7 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
task {
|
||||
text(GitLessonsBundle.message("git.project.history.commit.details.explanation"))
|
||||
proceedLink()
|
||||
triggerByUiComponentAndHighlight(highlightInside = false, usePulsation = true) { _: CommitDetailsListPanel -> true }
|
||||
triggerAndBorderHighlight { usePulsation = true }.component { _: CommitDetailsListPanel -> true }
|
||||
showWarningIfGitWindowClosed()
|
||||
}
|
||||
|
||||
@@ -183,10 +183,10 @@ class GitProjectHistoryLesson : GitLesson("Git.ProjectHistory", GitLessonsBundle
|
||||
LearningUiHighlightingManager.clearHighlights()
|
||||
}
|
||||
text(GitLessonsBundle.message("git.project.history.click.changed.file"))
|
||||
triggerByFoundPathAndHighlight(highlightInside = true) { _, path ->
|
||||
triggerAndFullHighlight().treeItem { _, path ->
|
||||
path.getPathComponent(path.pathCount - 1).toString().contains(".yml")
|
||||
}
|
||||
triggerByUiComponentAndHighlight(false, false) { _: SimpleDiffPanel -> true }
|
||||
triggerUI().component { _: SimpleDiffPanel -> true }
|
||||
showWarningIfGitWindowClosed()
|
||||
test {
|
||||
ideFrame {
|
||||
|
||||
@@ -84,7 +84,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
findActionTaskId = taskId
|
||||
text(GitLessonsBundle.message("git.quick.start.find.action", strong(StringUtil.removeEllipsisSuffix(cloneActionText)),
|
||||
LessonUtil.rawKeyStroke(KeyEvent.VK_SHIFT), LessonUtil.actionName(it)))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: ExtendableTextField ->
|
||||
triggerAndBorderHighlight().component { ui: ExtendableTextField ->
|
||||
UIUtil.getParentOfType(SearchEverywhereUI::class.java, ui) != null
|
||||
}
|
||||
test { actions(it) }
|
||||
@@ -97,7 +97,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
}
|
||||
}
|
||||
text(GitLessonsBundle.message("git.quick.start.type.clone", code(StringUtil.removeEllipsisSuffix(cloneActionText))))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.toNullableString()?.contains(cloneActionText) == true
|
||||
}
|
||||
triggerStart(it)
|
||||
@@ -116,7 +116,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByPartOfComponent(false, false) { ui: TextFieldWithBrowseButton ->
|
||||
triggerUI().componentPart { ui: TextFieldWithBrowseButton ->
|
||||
val rect = ui.visibleRect
|
||||
Rectangle(rect.x, rect.y, 59, rect.height)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByPartOfComponent(false) { ui: VcsCloneDialogExtensionList ->
|
||||
triggerUI().componentPart { ui: VcsCloneDialogExtensionList ->
|
||||
val size = ui.model.size
|
||||
val rect = ui.getCellBounds(size - 1, size - 1)
|
||||
Rectangle(rect.x, rect.y, 96, rect.height)
|
||||
@@ -146,7 +146,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
|
||||
val cancelButtonText = CommonBundle.getCancelButtonText()
|
||||
task {
|
||||
triggerByUiComponentAndHighlight { ui: JButton ->
|
||||
triggerAndFullHighlight().component { ui: JButton ->
|
||||
ui.text?.contains(cancelButtonText) == true
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: TextPanel.WithIconAndArrows -> ui.text == "main" }
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: TextPanel.WithIconAndArrows -> ui.text == "main" }
|
||||
}
|
||||
|
||||
lateinit var showBranchesTaskId: TaskContext.TaskId
|
||||
@@ -176,7 +176,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
showBranchesTaskId = taskId
|
||||
text(GitLessonsBundle.message("git.quick.start.open.branches", action(it)))
|
||||
text(GitLessonsBundle.message("git.feature.branch.open.branches.popup.balloon"), LearningBalloonConfig(Balloon.Position.above, 0))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: EngravedLabel ->
|
||||
triggerUI().component { ui: EngravedLabel ->
|
||||
val repository = GitRepositoryManager.getInstance(project).repositories.first()
|
||||
val branchesInRepoText = DvcsBundle.message("branch.popup.vcs.name.branches.in.repo", GitBundle.message("git4idea.vcs.name"),
|
||||
DvcsUtil.getShortRepositoryName(repository))
|
||||
@@ -187,7 +187,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
|
||||
val newBranchActionText = DvcsBundle.message("new.branch.action.text")
|
||||
task {
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.toString().contains(newBranchActionText)
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
|
||||
val createButtonText = GitBundle.message("new.branch.dialog.operation.create.name")
|
||||
task {
|
||||
triggerByUiComponentAndHighlight { ui: JButton ->
|
||||
triggerAndFullHighlight().component { ui: JButton ->
|
||||
ui.text?.contains(createButtonText) == true
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
line = editor.document.getLineNumber(startOffset)
|
||||
}
|
||||
text(GitLessonsBundle.message("git.quick.start.modify.file", code("green")))
|
||||
triggerByPartOfComponent l@{ ui: EditorComponentImpl ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorComponentImpl ->
|
||||
if (ui.editor != editor) return@l null
|
||||
val endOffset = ui.editor.caretModel.offset
|
||||
if (endOffset < startOffset || ui.editor.document.getLineNumber(endOffset) != line) return@l null
|
||||
@@ -279,7 +279,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByFoundPathAndHighlight { _: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { _: JTree, path: TreePath ->
|
||||
path.getPathComponent(path.pathCount - 1).toString().contains(fileToChange)
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
before { LearningUiHighlightingManager.clearHighlights() }
|
||||
val commitButtonText = GitBundle.message("commit.action.name").dropMnemonic()
|
||||
text(GitLessonsBundle.message("git.quick.start.perform.commit", strong(commitButtonText)))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { _: CommitMessage -> true }
|
||||
triggerAndBorderHighlight().component { _: CommitMessage -> true }
|
||||
triggerOnNotification { it.displayId == COMMIT_FINISHED }
|
||||
showWarningIfCommitWindowClosed()
|
||||
test {
|
||||
@@ -306,7 +306,7 @@ class GitQuickStartLesson : GitLesson("Git.QuickStart", GitLessonsBundle.message
|
||||
val pushButtonText = DvcsBundle.message("action.push").dropMnemonic()
|
||||
task {
|
||||
openPushDialogText(GitLessonsBundle.message("git.quick.start.open.push.dialog"))
|
||||
triggerByUiComponentAndHighlight { ui: JBOptionButton ->
|
||||
triggerAndFullHighlight().component { ui: JBOptionButton ->
|
||||
ui.text?.contains(pushButtonText) == true
|
||||
}
|
||||
test { actions("Vcs.Push") }
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ abstract class CompletionWithTabLesson(private val proposal: String) :
|
||||
|
||||
task("CodeCompletion") {
|
||||
text(LessonsBundle.message("completion.with.tab.begin.completion", action(it), code(proposal)))
|
||||
triggerByListItemAndHighlight { item -> item.isToStringContains(proposal) }
|
||||
triggerAndBorderHighlight().listItem { item -> item.isToStringContains(proposal) }
|
||||
restoreIfModifiedOrMoved()
|
||||
test { actions(it) }
|
||||
}
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ abstract class ContextActionsLesson : KLesson("context.actions", LessonsBundle.m
|
||||
task("ShowIntentionActions") {
|
||||
showIntentionsTaskId = taskId
|
||||
text(LessonsBundle.message("context.actions.invoke.intentions.for.warning", LessonUtil.actionName(it), action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(warningQuickFix)
|
||||
}
|
||||
restoreIfModifiedOrMovedIncorrectly(warningPossibleArea)
|
||||
@@ -78,7 +78,7 @@ abstract class ContextActionsLesson : KLesson("context.actions", LessonsBundle.m
|
||||
task("ShowIntentionActions") {
|
||||
showIntentionsTaskId = taskId
|
||||
text(LessonsBundle.message("context.actions.invoke.general.intentions", LessonUtil.actionName(it), action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(intentionText)
|
||||
}
|
||||
restoreIfModifiedOrMovedIncorrectly(intentionPossibleArea)
|
||||
|
||||
@@ -48,7 +48,7 @@ class GotoActionLesson(private val sample: LessonSample, private val firstLesson
|
||||
showWarningIfSearchPopupClosed()
|
||||
text(LessonsBundle.message("goto.action.invoke.about.action",
|
||||
LessonUtil.actionName(it).toLowerCase(), LessonUtil.rawEnter()))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { dialog: JDialog ->
|
||||
triggerUI().component { dialog: JDialog ->
|
||||
dialog.title.isToStringContains(IdeBundle.message("about.popup.about.app", ApplicationNamesInfo.getInstance().fullProductName))
|
||||
}
|
||||
test { actions(it) }
|
||||
@@ -74,7 +74,7 @@ class GotoActionLesson(private val sample: LessonSample, private val firstLesson
|
||||
val showLineNumbersName = ActionsBundle.message("action.EditorGutterToggleGlobalLineNumbers.text")
|
||||
task(LearnBundle.message("show.line.number.prefix.to.show.first")) {
|
||||
text(LessonsBundle.message("goto.action.show.line.numbers.request", strong(it), strong(showLineNumbersName)))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
val matchedValue = item as? GotoActionModel.MatchedValue
|
||||
val actionWrapper = matchedValue?.value as? GotoActionModel.ActionWrapper
|
||||
val action = actionWrapper?.action
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ abstract class SurroundAndUnwrapLesson
|
||||
editor.caretModel.currentCaret.selectionEnd != previous.sample.selection?.second
|
||||
}
|
||||
text(LessonsBundle.message("surround.and.unwrap.invoke.surround", action(it)))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
surroundItems.all { need -> wordIsPresent(item.toNullableString(), need) }
|
||||
}
|
||||
test { actions(it) }
|
||||
@@ -61,7 +61,7 @@ abstract class SurroundAndUnwrapLesson
|
||||
editor.caretModel.currentCaret.logicalPosition.line != previous.position.line
|
||||
}
|
||||
text(LessonsBundle.message("surround.and.unwrap.invoke.unwrap", action(it)))
|
||||
triggerByListItemAndHighlight { item -> item.toNullableString() == unwrapTryText }
|
||||
triggerAndBorderHighlight().listItem { item -> item.toNullableString() == unwrapTryText }
|
||||
test { actions(it) }
|
||||
}
|
||||
task {
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ abstract class EditorCodingAssistanceLesson(private val sample: LessonSample) :
|
||||
text(LessonsBundle.message("editor.coding.assistance.show.warning.description", action(it)))
|
||||
// escapeHtml required in case of hieroglyph localization
|
||||
val inspectionInfoLabelText = StringEscapeUtils.escapeHtml(IdeBundle.message("inspection.message.inspection.info"))
|
||||
triggerByUiComponentAndHighlight<JEditorPane>(false, false) { ui ->
|
||||
triggerUI().component { ui: JEditorPane ->
|
||||
ui.text.isToStringContains(inspectionInfoLabelText)
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -75,7 +75,7 @@ abstract class EditorCodingAssistanceLesson(private val sample: LessonSample) :
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("editor.coding.assistance.fix.warning") + " " + getFixWarningText())
|
||||
triggerByPartOfComponent { ui: HyperlinkLabel ->
|
||||
triggerAndBorderHighlight().componentPart { ui: HyperlinkLabel ->
|
||||
if (ui.text == warningIntentionText) {
|
||||
Rectangle(ui.x - 20, ui.y - 10, ui.width + 125, ui.height + 10)
|
||||
}
|
||||
|
||||
+6
-6
@@ -160,8 +160,8 @@ class LocalHistoryLesson : KLesson("CodeAssistance.LocalHistory", LessonsBundle.
|
||||
invokeMenuTaskId = taskId
|
||||
text(LessonsBundle.message("local.history.imagine.restore", strong(ActionsBundle.message("action.\$Undo.text"))))
|
||||
text(LessonsBundle.message("local.history.invoke.context.menu", strong(localHistoryActionText)))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: EditorComponentImpl -> ui.editor == editor }
|
||||
triggerByUiComponentAndHighlight { ui: ActionMenu ->
|
||||
triggerAndBorderHighlight().component { ui: EditorComponentImpl -> ui.editor == editor }
|
||||
triggerAndFullHighlight().component { ui: ActionMenu ->
|
||||
ui.text.isToStringContains(localHistoryActionText)
|
||||
}
|
||||
test {
|
||||
@@ -172,7 +172,7 @@ class LocalHistoryLesson : KLesson("CodeAssistance.LocalHistory", LessonsBundle.
|
||||
task("LocalHistory.ShowHistory") {
|
||||
val showHistoryActionText = ActionsBundle.actionText(it).dropMnemonic()
|
||||
text(LessonsBundle.message("local.history.show.history", strong(localHistoryActionText), strong(showHistoryActionText)))
|
||||
triggerByUiComponentAndHighlight(clearPreviousHighlights = false) { ui: ActionMenuItem ->
|
||||
triggerAndFullHighlight { clearPreviousHighlights = false }.component { ui: ActionMenuItem ->
|
||||
ui.text == showHistoryActionText
|
||||
}
|
||||
trigger(it)
|
||||
@@ -187,7 +187,7 @@ class LocalHistoryLesson : KLesson("CodeAssistance.LocalHistory", LessonsBundle.
|
||||
|
||||
var revisionsTable: JBTable? = null
|
||||
task {
|
||||
triggerByPartOfComponent { ui: JBTable ->
|
||||
triggerAndBorderHighlight().componentPart { ui: JBTable ->
|
||||
if (checkInsideLocalHistoryFrame(ui)) {
|
||||
revisionsTable = ui
|
||||
ui.getCellRect(revisionInd, 0, false)
|
||||
@@ -202,7 +202,7 @@ class LocalHistoryLesson : KLesson("CodeAssistance.LocalHistory", LessonsBundle.
|
||||
text(LessonsBundle.message("local.history.select.revision", strong(localHistoryActionText), strong(localHistoryActionText)))
|
||||
val step = CompletableFuture<Boolean>()
|
||||
addStep(step)
|
||||
triggerByUiComponentAndHighlight(false, false, clearPreviousHighlights = false) l@{ ui: JBLoadingPanel ->
|
||||
triggerUI { clearPreviousHighlights = false }.component l@{ ui: JBLoadingPanel ->
|
||||
if (!checkInsideLocalHistoryFrame(ui)) return@l false
|
||||
ui.addListener(object : JBLoadingPanelListener {
|
||||
override fun onLoadingStart() {
|
||||
@@ -230,7 +230,7 @@ class LocalHistoryLesson : KLesson("CodeAssistance.LocalHistory", LessonsBundle.
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByPartOfComponent { ui: EditorGutterComponentEx -> findDiffGutterRect(ui) }
|
||||
triggerAndBorderHighlight().componentPart { ui: EditorGutterComponentEx -> findDiffGutterRect(ui) }
|
||||
}
|
||||
|
||||
task {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class QuickPopupsLesson(private val sample: LessonSample) :
|
||||
|
||||
task("QuickImplementations") {
|
||||
text(LessonsBundle.message("quick.popups.show.implementation", action(it)))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { _: ImplementationViewComponent -> true }
|
||||
triggerUI().component { _: ImplementationViewComponent -> true }
|
||||
restoreIfModifiedOrMoved()
|
||||
test {
|
||||
actions(it)
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ abstract class BasicCompletionLessonBase : KLesson("Basic completion", LessonsBu
|
||||
task {
|
||||
text(LessonsBundle.message("basic.completion.start.typing",
|
||||
code(item1Completion)))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JList<*> ->
|
||||
triggerUI().component { ui: JList<*> ->
|
||||
isTheFirstVariant(ui)
|
||||
}
|
||||
proposeRestore {
|
||||
@@ -68,7 +68,7 @@ abstract class BasicCompletionLessonBase : KLesson("Basic completion", LessonsBu
|
||||
task("CodeCompletion") {
|
||||
text(LessonsBundle.message("basic.completion.activate.explicitly", action(it)))
|
||||
trigger(it)
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(item2Completion)
|
||||
}
|
||||
proposeRestore {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ abstract class PostfixCompletionLesson : KLesson("Postfix completion", LessonsBu
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("postfix.completion.intro") + " " + getTypeTaskText())
|
||||
triggerByListItemAndHighlight {
|
||||
triggerAndBorderHighlight().listItem {
|
||||
it.isToStringContains(completionItem)
|
||||
}
|
||||
proposeRestore {
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ abstract class DeclarationAndUsagesLesson
|
||||
}
|
||||
text(LessonsBundle.message("declaration.and.usages.find.usages", action(it)))
|
||||
|
||||
triggerByUiComponentAndHighlight { ui: BaseLabel ->
|
||||
triggerAndFullHighlight().component { ui: BaseLabel ->
|
||||
ui.javaClass.simpleName == "ContentTabLabel" && ui.text.isToStringContains(entityName)
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -89,7 +89,7 @@ abstract class DeclarationAndUsagesLesson
|
||||
previous.ui?.let { usagesTab -> jComponent(usagesTab).rightClick() }
|
||||
}
|
||||
}
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: ActionMenuItem ->
|
||||
triggerAndBorderHighlight().component { ui: ActionMenuItem ->
|
||||
ui.text.isToStringContains(pinTabText)
|
||||
}
|
||||
restoreByUi()
|
||||
|
||||
+8
-8
@@ -38,7 +38,7 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
showPopupTaskId = taskId
|
||||
text(LessonsBundle.message("find.in.files.show.find.popup",
|
||||
action(it), LessonUtil.actionName(it)))
|
||||
triggerByUiComponentAndHighlight(false, false) { popup: FindPopupPanel ->
|
||||
triggerUI().component { popup: FindPopupPanel ->
|
||||
!popup.helper.isReplaceState
|
||||
}
|
||||
test {
|
||||
@@ -69,7 +69,7 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
|
||||
val neededText = "apple..."
|
||||
task {
|
||||
triggerByPartOfComponent { table: JTable ->
|
||||
triggerAndBorderHighlight().componentPart { table: JTable ->
|
||||
val rowIndex = table.findLastRowIndexOfItemWithText(neededText)
|
||||
if (rowIndex >= 0) {
|
||||
table.getCellRect(rowIndex, 0, false)
|
||||
@@ -110,7 +110,7 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
task("ReplaceInPath") {
|
||||
text(LessonsBundle.message("find.in.files.show.replace.popup",
|
||||
action(it), LessonUtil.actionName(it)))
|
||||
triggerByUiComponentAndHighlight(false, false) { popup: FindPopupPanel ->
|
||||
triggerUI().component { popup: FindPopupPanel ->
|
||||
popup.helper.isReplaceState
|
||||
}
|
||||
test { actions(it) }
|
||||
@@ -119,7 +119,7 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
task("orange") {
|
||||
text(LessonsBundle.message("find.in.files.type.to.replace",
|
||||
code("apple"), code(it)))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: SearchTextArea ->
|
||||
triggerAndBorderHighlight().component { ui: SearchTextArea ->
|
||||
it.startsWith(ui.textArea.text) && UIUtil.getParentOfType(FindPopupPanel::class.java, ui) != null
|
||||
}
|
||||
stateCheck {
|
||||
@@ -155,10 +155,10 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
task {
|
||||
val replaceAllButtonText = FindBundle.message("find.popup.replace.all.button").dropMnemonic()
|
||||
text(LessonsBundle.message("find.in.files.press.replace.all", strong(replaceAllButtonText)))
|
||||
triggerByUiComponentAndHighlight { button: JButton ->
|
||||
triggerAndFullHighlight().component { button: JButton ->
|
||||
button.text.isToStringContains(replaceAllButtonText)
|
||||
}
|
||||
triggerByUiComponentAndHighlight { button: JButton ->
|
||||
triggerAndFullHighlight().component { button: JButton ->
|
||||
UIUtil.getParentOfType(JDialog::class.java, button)?.isModal == true && button.text.isToStringContains(replaceButtonText)
|
||||
}
|
||||
showWarningIfPopupClosed(true)
|
||||
@@ -196,10 +196,10 @@ class FindInFilesLesson(override val existedFile: String)
|
||||
}
|
||||
|
||||
private fun TaskContext.highlightAndTriggerWhenButtonSelected(buttonText: String) {
|
||||
triggerByUiComponentAndHighlight { button: ActionButton ->
|
||||
triggerAndFullHighlight().component { button: ActionButton ->
|
||||
button.action.templateText == buttonText
|
||||
}
|
||||
triggerByUiComponentAndHighlight(false, false) { button: ActionButton ->
|
||||
triggerUI().component { button: ActionButton ->
|
||||
button.action.templateText == buttonText && button.isSelected
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -78,7 +78,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
|
||||
task("rfd") {
|
||||
text(LessonsBundle.message("recent.files.search.typing", code(it)))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: ExtendableTextField ->
|
||||
triggerUI().component { ui: ExtendableTextField ->
|
||||
ui.javaClass.name.contains("SpeedSearchBase\$SearchField")
|
||||
}
|
||||
stateCheck { checkRecentFilesSearch(it) }
|
||||
@@ -113,7 +113,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
task {
|
||||
text(LessonsBundle.message("recent.files.delete", strong(countOfFilesToDelete.toString()),
|
||||
LessonUtil.rawKeyStroke(KeyEvent.VK_DELETE)))
|
||||
triggerByUiComponentAndHighlight(false, false) l@{ list: JBListWithOpenInRightSplit<*> ->
|
||||
triggerUI().component l@{ list: JBListWithOpenInRightSplit<*> ->
|
||||
if (list != focusOwner) return@l false
|
||||
if (initialRecentFilesCount == -1) {
|
||||
initialRecentFilesCount = list.itemsCount
|
||||
@@ -138,7 +138,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
task("RecentLocations") {
|
||||
text(LessonsBundle.message("recent.files.show.recent.locations", action(it)))
|
||||
val recentLocationsText = IdeBundle.message("recent.locations.popup.title")
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: SimpleColoredComponent ->
|
||||
triggerUI().component { ui: SimpleColoredComponent ->
|
||||
ui.getCharSequence(true).contains(recentLocationsText)
|
||||
}
|
||||
test { actions(it) }
|
||||
@@ -147,7 +147,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
task(stringForRecentFilesSearch) {
|
||||
text(LessonsBundle.message("recent.files.locations.search.typing", code(it)))
|
||||
stateCheck { checkRecentLocationsSearch(it) }
|
||||
triggerByUiComponentAndHighlight(false, false) { _: SearchTextField -> true } // needed in next task to restore if search field closed
|
||||
triggerUI().component { _: SearchTextField -> true } // needed in next task to restore if search field closed
|
||||
restoreByUi()
|
||||
test {
|
||||
ideFrame {
|
||||
@@ -159,7 +159,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("recent.files.locations.search.jump", LessonUtil.rawEnter()))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(transitionFileName)
|
||||
}
|
||||
stateCheck { virtualFile.name.contains(transitionFileName) }
|
||||
@@ -215,7 +215,7 @@ abstract class RecentFilesLesson : KLesson("Recent Files and Locations", Lessons
|
||||
|
||||
private fun TaskContext.triggerOnRecentFilesShown() {
|
||||
val recentFilesText = IdeBundle.message("title.popup.recent.files")
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: JLabel ->
|
||||
triggerUI().component { ui: JLabel ->
|
||||
ui.text.isToStringContains(recentFilesText)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -37,7 +37,7 @@ abstract class SearchEverywhereLesson : KLesson("Search everywhere", LessonsBund
|
||||
|
||||
override val lessonContent: LessonContext.() -> Unit = {
|
||||
task("SearchEverywhere") {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: ExtendableTextField ->
|
||||
triggerAndBorderHighlight().component { ui: ExtendableTextField ->
|
||||
UIUtil.getParentOfType(SearchEverywhereUI::class.java, ui) != null
|
||||
}
|
||||
text(LessonsBundle.message("search.everywhere.invoke.search.everywhere", LessonUtil.actionName(it),
|
||||
@@ -61,7 +61,7 @@ abstract class SearchEverywhereLesson : KLesson("Search everywhere", LessonsBund
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
if (item is PsiNameIdentifierOwner)
|
||||
item.name == requiredClassName
|
||||
else item.isToStringContains(requiredClassName)
|
||||
@@ -104,8 +104,8 @@ abstract class SearchEverywhereLesson : KLesson("Search everywhere", LessonsBund
|
||||
task(EverythingGlobalScope.getNameText()) {
|
||||
text(LessonsBundle.message("search.everywhere.use.all.places",
|
||||
strong(ProjectScope.getProjectFilesScopeName()), strong(it)))
|
||||
triggerByUiComponentAndHighlight { _: ActionButtonWithText -> true }
|
||||
triggerByUiComponentAndHighlight(false, false) { button: ActionButtonWithText ->
|
||||
triggerAndFullHighlight().component { _: ActionButtonWithText -> true }
|
||||
triggerUI().component { button: ActionButtonWithText ->
|
||||
button.accessibleContext.accessibleName == it
|
||||
}
|
||||
showWarning(LessonsBundle.message("search.everywhere.class.popup.closed.warning.message", action("GotoClass"))) {
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ class ExtractMethodCocktailSortLesson(private val sample: LessonSample)
|
||||
task("ExtractMethod") {
|
||||
startTaskId = taskId
|
||||
text(LessonsBundle.message("extract.method.invoke.action", action(it)))
|
||||
triggerByUiComponentAndHighlight(false, false) { dialog: JDialog ->
|
||||
triggerUI().component { dialog: JDialog ->
|
||||
dialog.title == extractMethodDialogTitle
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -54,7 +54,7 @@ class ExtractMethodCocktailSortLesson(private val sample: LessonSample)
|
||||
text(LessonsBundle.message("extract.method.confirm.several.replaces", strong(yesButtonText)))
|
||||
|
||||
// Wait until the third dialog
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { dialog: JDialog ->
|
||||
triggerUI().component { dialog: JDialog ->
|
||||
dialog.title == replaceFragmentDialogTitle
|
||||
}
|
||||
restoreState(restoreId = startTaskId, delayMillis = defaultRestoreDelay) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ class ExtractVariableFromBubbleLesson(private val sample: LessonSample)
|
||||
|
||||
task {
|
||||
transparentRestore = true
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item is BaseReplaceChoice && item.formatDescription(3) == actionString(3)
|
||||
}
|
||||
restoreByTimer() // the refactoring may be called from the wrong place
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ abstract class RefactoringMenuLessonBase(lessonId: String) : KLesson(lessonId, L
|
||||
showPopupTaskId = taskId
|
||||
text(LessonsBundle.message("refactoring.menu.show.refactoring.list", action(it)))
|
||||
val refactorThisTitle = RefactoringBundle.message("refactor.this.title")
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: EngravedLabel ->
|
||||
triggerUI().component { ui: EngravedLabel ->
|
||||
ui.text.isToStringContains(refactorThisTitle)
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -39,7 +39,7 @@ abstract class RefactoringMenuLessonBase(lessonId: String) : KLesson(lessonId, L
|
||||
if (!adaptToNotNativeLocalization) {
|
||||
task(ActionsBundle.message("action.IntroduceParameter.text").dropMnemonic()) {
|
||||
text(LessonsBundle.message("refactoring.menu.introduce.parameter.eng", strong(it)))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: JList<*> ->
|
||||
triggerUI().component { ui: JList<*> ->
|
||||
ui.model.size > 0 && ui.model.getElementAt(0).isToStringContains(it)
|
||||
}
|
||||
restoreByUi(restoreId = showPopupTaskId, delayMillis = defaultRestoreDelay)
|
||||
|
||||
+5
-6
@@ -204,8 +204,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message
|
||||
|
||||
private fun LessonContext.evaluateExpressionTasks() {
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false,
|
||||
usePulsation = true) { ui: XDebuggerEmbeddedComboBox<XExpression> -> ui.isEditable }
|
||||
triggerAndBorderHighlight { usePulsation = true }.component { ui: XDebuggerEmbeddedComboBox<XExpression> -> ui.isEditable }
|
||||
}
|
||||
|
||||
val position = sample.getPosition(1)
|
||||
@@ -215,7 +214,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("debug.workflow.evaluate.expression"))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: EditorComponentImpl ->
|
||||
triggerUI().component { ui: EditorComponentImpl ->
|
||||
ui.editor.document.text == needToEvaluate
|
||||
}
|
||||
proposeSelectionChangeRestore(position)
|
||||
@@ -232,7 +231,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("debug.workflow.evaluate.it", LessonUtil.rawEnter()))
|
||||
triggerByUiComponentAndHighlight(false, false) l@{ ui: XDebuggerTree ->
|
||||
triggerUI().component l@{ ui: XDebuggerTree ->
|
||||
val resultNode = ui.root.getChildAt(0) as? WatchNodeImpl ?: return@l false
|
||||
resultNode.expression.expression == needToEvaluate
|
||||
}
|
||||
@@ -258,7 +257,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message
|
||||
text(LessonsBundle.message("debug.workflow.use.watches.shortcut", action(it),
|
||||
strong(TaskBundle.message("debugger.watches")), shortcut))
|
||||
val addToWatchActionText = ActionsBundle.actionText(it)
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: ActionButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: ActionButton ->
|
||||
ui.action.templatePresentation.text == addToWatchActionText
|
||||
}
|
||||
stateCheck {
|
||||
@@ -433,7 +432,7 @@ abstract class CommonDebugLesson(id: String) : KLesson(id, LessonsBundle.message
|
||||
|
||||
private fun LessonContext.highlightLineNumberByOffset(offset: Int) {
|
||||
task {
|
||||
triggerByPartOfComponent<EditorGutterComponentEx> l@{ ui ->
|
||||
triggerAndBorderHighlight().componentPart l@{ ui: EditorGutterComponentEx ->
|
||||
if (CommonDataKeys.EDITOR.getData(ui as DataProvider) != editor) return@l null
|
||||
val line = editor.offsetToVisualLine(offset, true)
|
||||
val y = editor.visualLineToY(line)
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ abstract class CommonRunConfigurationLesson(id: String) : KLesson(id, LessonsBun
|
||||
showWarningIfRunConfigurationsHidden()
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight<JButton> { ui ->
|
||||
triggerAndFullHighlight().component { ui: JButton ->
|
||||
ui.text == demoConfigurationName
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ abstract class CommonRunConfigurationLesson(id: String) : KLesson(id, LessonsBun
|
||||
.dropMnemonic()
|
||||
task {
|
||||
text(LessonsBundle.message("run.configuration.temporary.to.permanent"))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.toString() == saveConfigurationItemName
|
||||
}
|
||||
test {
|
||||
@@ -83,7 +83,7 @@ abstract class CommonRunConfigurationLesson(id: String) : KLesson(id, LessonsBun
|
||||
text(LessonsBundle.message("run.configuration.edit.configuration",
|
||||
strong(ActionsBundle.message("action.editRunConfigurations.text").dropMnemonic()),
|
||||
action(it)))
|
||||
triggerByUiComponentAndHighlight<JBCheckBox>(highlightInside = false) { ui ->
|
||||
triggerAndBorderHighlight().component { ui: JBCheckBox ->
|
||||
ui.text?.contains(ExecutionBundle.message("run.configuration.store.as.project.file").dropMnemonic()) == true
|
||||
}
|
||||
test {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ class KotlinBasicCompletionLesson : JavaBasicCompletionLesson() {
|
||||
|
||||
task {
|
||||
text(LessonsBundle.message("basic.completion.start.typing", code("list")))
|
||||
triggerByListItemAndHighlight l@{ item -> isListOfCompletionItem(item) }
|
||||
triggerAndBorderHighlight().listItem { item -> isListOfCompletionItem(item) }
|
||||
restoreIfTypedIncorrectly(sample, "listOf")
|
||||
test { type("li") }
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ class FStringCompletionLesson
|
||||
} == null
|
||||
if (prefixTyped) PythonLessonsBundle.message("python.f.string.completion.invoke.manually", action("CodeCompletion")) else null
|
||||
}
|
||||
triggerByListItemAndHighlight(highlightBorder = false) { item ->
|
||||
triggerUI().listItem { item ->
|
||||
item.isToStringContains(completionItem)
|
||||
}
|
||||
proposeRestore {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class PythonSmartCompletionLesson
|
||||
task("SmartTypeCompletion") {
|
||||
text(PythonLessonsBundle.message("python.smart.completion.use.smart.completion",
|
||||
code("x"), action(it)))
|
||||
triggerByListItemAndHighlight { ui ->
|
||||
triggerAndBorderHighlight().listItem { ui ->
|
||||
ui.isToStringContains(methodName)
|
||||
}
|
||||
proposeRestoreMe()
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class PythonTabCompletionLesson
|
||||
task("CodeCompletion") {
|
||||
text(PythonLessonsBundle.message("python.tab.completion.start.completion",
|
||||
code("current"), code("total"), action(it)))
|
||||
triggerByListItemAndHighlight(checkList = { ui -> isTotalItem(ui) })
|
||||
triggerAndBorderHighlight().listItem { ui -> isTotalItem(ui) }
|
||||
proposeRestoreMe()
|
||||
test { actions(it) }
|
||||
}
|
||||
|
||||
+14
-14
@@ -349,7 +349,7 @@ class PythonOnboardingTour :
|
||||
|
||||
private fun LessonContext.waitIndexingTasks() {
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { progress: NonOpaquePanel ->
|
||||
triggerAndBorderHighlight().component { progress: NonOpaquePanel ->
|
||||
progress.javaClass.name.contains("InlineProgressPanel")
|
||||
}
|
||||
}
|
||||
@@ -368,7 +368,7 @@ class PythonOnboardingTour :
|
||||
|
||||
private fun LessonContext.runTasks() {
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: EditorComponentImpl ->
|
||||
triggerAndBorderHighlight().component { ui: EditorComponentImpl ->
|
||||
ui.text.contains("find_average")
|
||||
}
|
||||
}
|
||||
@@ -377,7 +377,7 @@ class PythonOnboardingTour :
|
||||
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.onboarding.context.menu"))
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { ui: ActionMenuItem ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { ui: ActionMenuItem ->
|
||||
ui.text.isToStringContains(runItem)
|
||||
}
|
||||
restoreIfModified(sample)
|
||||
@@ -394,7 +394,7 @@ class PythonOnboardingTour :
|
||||
|
||||
task {
|
||||
val stopAction = getActionById("Stop")
|
||||
triggerByPartOfComponent(highlightInside = true, usePulsation = true) { ui: ActionToolbarImpl ->
|
||||
triggerAndFullHighlight { usePulsation = true }.componentPart { ui: ActionToolbarImpl ->
|
||||
ui.takeIf { (ui.place == ActionPlaces.NAVIGATION_BAR_TOOLBAR || ui.place == ActionPlaces.MAIN_TOOLBAR) }?.let {
|
||||
val configurations = ui.components.find { it is JPanel && it.components.any { b -> b is ComboBoxAction.ComboBoxButton } }
|
||||
val stop = ui.components.find { it is ActionButton && it.action == stopAction }
|
||||
@@ -423,7 +423,7 @@ class PythonOnboardingTour :
|
||||
|
||||
private fun LessonContext.openLearnToolwindow() {
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { stripe: StripeButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { stripe: StripeButton ->
|
||||
stripe.windowInfo.id == "Learn"
|
||||
}
|
||||
}
|
||||
@@ -473,7 +473,7 @@ class PythonOnboardingTour :
|
||||
LessonUtil.hideStandardToolwindows(project)
|
||||
}
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(usePulsation = true) { stripe: StripeButton ->
|
||||
triggerAndFullHighlight { usePulsation = true }.component { stripe: StripeButton ->
|
||||
stripe.windowInfo.id == "Project"
|
||||
}
|
||||
}
|
||||
@@ -485,7 +485,7 @@ class PythonOnboardingTour :
|
||||
action("ActivateProjectToolWindow")))
|
||||
text(PythonLessonsBundle.message("python.onboarding.balloon.project.view"),
|
||||
LearningBalloonConfig(Balloon.Position.atRight, width = 0))
|
||||
triggerByFoundPathAndHighlight { tree: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { tree: JTree, path: TreePath ->
|
||||
val result = path.pathCount >= 1 && path.getPathComponent(0).isToStringContains("PyCharmLearningProject")
|
||||
if (result) {
|
||||
if (!collapsed) {
|
||||
@@ -505,7 +505,7 @@ class PythonOnboardingTour :
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.onboarding.balloon.project.directory"),
|
||||
LearningBalloonConfig(Balloon.Position.atRight, duplicateMessage = true, width = 0))
|
||||
triggerByFoundPathAndHighlight { _: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { _: JTree, path: TreePath ->
|
||||
isDemoFilePath(path)
|
||||
}
|
||||
restoreByUi()
|
||||
@@ -541,7 +541,7 @@ class PythonOnboardingTour :
|
||||
code("values"),
|
||||
code("()"),
|
||||
action("CodeCompletion")))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { // no highlighting
|
||||
triggerAndBorderHighlight().listItem { // no highlighting
|
||||
it.isToStringContains("values")
|
||||
}
|
||||
proposeRestoreForInvalidText("values")
|
||||
@@ -581,7 +581,7 @@ class PythonOnboardingTour :
|
||||
task("ShowIntentionActions") {
|
||||
text(PythonLessonsBundle.message("python.onboarding.invoke.intention.for.warning.1"))
|
||||
text(PythonLessonsBundle.message("python.onboarding.invoke.intention.for.warning.2", action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(reformatMessage)
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -604,7 +604,7 @@ class PythonOnboardingTour :
|
||||
task("ShowIntentionActions") {
|
||||
text(PythonLessonsBundle.message("python.onboarding.invoke.intention.for.code",
|
||||
code("find_average"), action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(returnTypeMessage(project))
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -648,7 +648,7 @@ class PythonOnboardingTour :
|
||||
strong(toggleCase), code("AVERAGE")))
|
||||
text(PythonLessonsBundle.message("python.onboarding.invoke.search.everywhere.2",
|
||||
LessonUtil.rawKeyStroke(KeyEvent.VK_SHIFT), LessonUtil.actionName(it)))
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { ui: ExtendableTextField ->
|
||||
triggerAndBorderHighlight().component { ui: ExtendableTextField ->
|
||||
UIUtil.getParentOfType(SearchEverywhereUI::class.java, ui) != null
|
||||
}
|
||||
restoreIfModifiedOrMoved()
|
||||
@@ -667,7 +667,7 @@ class PythonOnboardingTour :
|
||||
}
|
||||
text(PythonLessonsBundle.message("python.onboarding.search.everywhere.description",
|
||||
strong("AVERAGE"), strong(PythonLessonsBundle.message("toggle.case.part"))))
|
||||
triggerByListItemAndHighlight { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
val value = (item as? GotoActionModel.MatchedValue)?.value
|
||||
(value as? GotoActionModel.ActionWrapper)?.action is ToggleCaseAction
|
||||
}
|
||||
@@ -696,7 +696,7 @@ class PythonOnboardingTour :
|
||||
}
|
||||
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { info: TextPanel.WithIconAndArrows ->
|
||||
triggerAndBorderHighlight().component { info: TextPanel.WithIconAndArrows ->
|
||||
info.toolTipText.isToStringContains(PyBundle.message("current.interpreter", ""))
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -49,7 +49,7 @@ class PythonInPlaceRefactoringLesson
|
||||
text(
|
||||
PythonLessonsBundle.message("python.in.place.refactoring.invoke.intentions",
|
||||
icon(AllIcons.Gutter.SuggestedRefactoringBulb), action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { ui -> // no highlighting
|
||||
triggerAndBorderHighlight().listItem { ui -> // no highlighting
|
||||
ui.isToStringContains("'s'")
|
||||
}
|
||||
proposeRestore {
|
||||
@@ -111,7 +111,7 @@ class PythonInPlaceRefactoringLesson
|
||||
icon(AllIcons.Gutter.SuggestedRefactoringBulb), action(it)))
|
||||
val updateUsagesText = RefactoringBundle.message("suggested.refactoring.change.signature.intention.text",
|
||||
RefactoringBundle.message("suggested.refactoring.usages"))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains(updateUsagesText)
|
||||
}
|
||||
proposeRestore {
|
||||
@@ -125,7 +125,7 @@ class PythonInPlaceRefactoringLesson
|
||||
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.in.place.refactoring.update.callers", action("EditorChooseLookupItem")))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: JPanel -> // no highlighting
|
||||
triggerUI().component { ui: JPanel -> // no highlighting
|
||||
ui.javaClass.name.contains("ChangeSignaturePopup")
|
||||
}
|
||||
restoreByUi(delayMillis = defaultRestoreDelay)
|
||||
@@ -134,7 +134,7 @@ class PythonInPlaceRefactoringLesson
|
||||
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.in.place.refactoring.signature.preview", LessonUtil.rawEnter()))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { ui: JLabel -> // no highlighting
|
||||
triggerUI().component { ui: JLabel -> // no highlighting
|
||||
ui.text == RefactoringBundle.message("suggested.refactoring.parameter.values.label.text")
|
||||
}
|
||||
restoreAfterStateBecomeFalse(restoreId = showIntentionsTaskId) {
|
||||
|
||||
+5
-7
@@ -41,7 +41,7 @@ class PythonQuickFixesRefactoringLesson
|
||||
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.quick.fix.refactoring.type.new.argument", code("foo"), code("y"), code(", y")))
|
||||
triggerByUiComponentAndHighlight(highlightBorder = false, highlightInside = false) { _: JBList<*> ->
|
||||
triggerUI().component { _: JBList<*> ->
|
||||
checkEditor(editor)
|
||||
}
|
||||
proposeMyRestore()
|
||||
@@ -67,7 +67,7 @@ class PythonQuickFixesRefactoringLesson
|
||||
task("ShowIntentionActions") {
|
||||
showQuickFixesTaskId = taskId
|
||||
text(PythonLessonsBundle.message("python.quick.fix.refactoring.invoke.intentions", action(it)))
|
||||
triggerByListItemAndHighlight(highlightBorder = true, highlightInside = false) { item ->
|
||||
triggerAndBorderHighlight().listItem { item ->
|
||||
item.isToStringContains("foo(")
|
||||
}
|
||||
proposeRestore {
|
||||
@@ -82,7 +82,7 @@ class PythonQuickFixesRefactoringLesson
|
||||
text(PythonLessonsBundle.message("python.quick.fix.refactoring.choose.change.signature",
|
||||
strong(PyBundle.message("QFIX.NAME.change.signature"))))
|
||||
|
||||
triggerByPartOfComponent { table: JTable ->
|
||||
triggerAndBorderHighlight().componentPart { table: JTable ->
|
||||
val model = table.model
|
||||
if (model.rowCount >= 2 && (model.getValueAt(1, 0) as? JBTableRow)?.getValueAt(0) == "y") {
|
||||
table.getCellRect(1, 0, true)
|
||||
@@ -99,11 +99,9 @@ class PythonQuickFixesRefactoringLesson
|
||||
task {
|
||||
text(PythonLessonsBundle.message("python.quick.fix.refactoring.select.new.parameter",
|
||||
action("EditorTab"), LessonUtil.rawEnter()))
|
||||
|
||||
val selector = { collection: Collection<EditorComponentImpl> ->
|
||||
triggerAndFullHighlight().withSelector { collection: Collection<EditorComponentImpl> ->
|
||||
collection.takeIf { it.size > 2 }?.maxByOrNull { it.locationOnScreen.x }
|
||||
}
|
||||
triggerByUiComponentAndHighlight(selector = selector) { editor: EditorComponentImpl ->
|
||||
}.byComponent { editor: EditorComponentImpl ->
|
||||
UIUtil.getParentOfType(JDialog::class.java, editor) != null
|
||||
}
|
||||
restoreByUi()
|
||||
|
||||
+4
-4
@@ -60,13 +60,13 @@ class PythonRenameLesson : KLesson("Rename", LessonsBundle.message("rename.lesso
|
||||
var dynamicItem: String? = null
|
||||
task("RenameElement") {
|
||||
text(PythonLessonsBundle.message("python.rename.press.rename", action(it), code("teams"), code("teams_number")))
|
||||
triggerByUiComponentAndHighlight(false, false) { ui: NameSuggestionsField ->
|
||||
triggerUI().component { ui: NameSuggestionsField ->
|
||||
ui.addDataChangedListener {
|
||||
replace = ui.enteredName
|
||||
}
|
||||
true
|
||||
}
|
||||
triggerByFoundPathAndHighlight { _: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { _: JTree, path: TreePath ->
|
||||
val pathStr = path.getPathComponent(1).toString()
|
||||
if (path.pathCount == 2 && pathStr.contains(dynamicWord)) {
|
||||
dynamicItem = pathStr
|
||||
@@ -94,7 +94,7 @@ class PythonRenameLesson : KLesson("Rename", LessonsBundle.message("rename.lesso
|
||||
text(PythonLessonsBundle.message("python.rename.expand.dynamic.references",
|
||||
code("teams"), strong(dynamicReferencesString)))
|
||||
|
||||
triggerByFoundPathAndHighlight { _: JTree, path: TreePath ->
|
||||
triggerAndBorderHighlight().treeItem { _: JTree, path: TreePath ->
|
||||
path.pathCount == 6 && path.getPathComponent(5).isToStringContains("company_members")
|
||||
}
|
||||
showWarningIfFindToolbarClosed()
|
||||
@@ -138,7 +138,7 @@ class PythonRenameLesson : KLesson("Rename", LessonsBundle.message("rename.lesso
|
||||
|
||||
val confirmRefactoringButton = RefactoringBundle.message("usageView.doAction").dropMnemonic()
|
||||
task {
|
||||
triggerByUiComponentAndHighlight(highlightInside = false) { button: JButton ->
|
||||
triggerAndBorderHighlight().component { button: JButton ->
|
||||
button.text.isToStringContains(confirmRefactoringButton)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user