in src/main/kotlin/com/jetbrains/plugin/jtreg/analysis/TestLineMarkerProvider.kt [46:88]
override fun collectSlowLineMarkers(elements: List<PsiElement>, result: MutableCollection<in LineMarkerInfo<*>>) {
elements.forEach { element ->
if (element.containingFile !is PsiJavaFile) return@forEach
if (element !is PsiComment) return@forEach
if (!element.text.contains("@test")) return@forEach
val tags = JTRegTagParser.parseTags(element)
val runs = tags.nameToTags.getOrDefault("run", emptyList())
val runClass = element.containingFile.virtualFile.path
runs.forEach { tag ->
val range = TextRange(tag.tagStart, tag.tagEnd)
val runCmd = tag.value.substringAfter("@run ")
result.add(LineMarkerInfo(
element,
range,
AllIcons.RunConfigurations.TestState.Run,
{ "Click to perform custom action" },
{ e, elt ->
val project = elt.project
val context = SimpleDataContext.getProjectContext(project)
val modifiedContext = SimpleDataContext.builder()
.setParent(context)
.add(JTREG_RUN_CLASS, runClass)
.add(JTREG_RUN_CMD, runCmd)
.add(CommonDataKeys.PSI_ELEMENT, element)
.build()
showActionGroupPopup("jtreg.TestContextActions", modifiedContext,
e.component, Point(e.xOnScreen, e.yOnScreen))
},
GutterIconRenderer.Alignment.LEFT,
{ "Custom action" }
))
}
}
}