File tree Expand file tree Collapse file tree 11 files changed +100
-3
lines changed
kotlin/com/github/xepozz/testo Expand file tree Collapse file tree 11 files changed +100
-3
lines changed Original file line number Diff line number Diff line change 11package com.github.xepozz.testo
22
3+ import com.intellij.icons.AllIcons
34import com.intellij.openapi.util.IconLoader
5+ import com.intellij.ui.LayeredIcon
46
57// https://intellij-icons.jetbrains.design
68// https://plugins.jetbrains.com/docs/intellij/icons.html#new-ui-tool-window-icons
79// https://plugins.jetbrains.com/docs/intellij/icons-style.html
810object TestoIcons {
911 @JvmField
1012 val TESTO = IconLoader .getIcon(" /icons/testo/icon.svg" , this ::class .java)
13+
14+ object PHP {
15+ @JvmField
16+ val FILE = IconLoader .getIcon(" /icons/php/file.svg" , this ::class .java)
17+ @JvmField
18+ val CLASS = IconLoader .getIcon(" /icons/php/class.svg" , this ::class .java)
19+ @JvmField
20+ val CLASS_ABSTRACT = IconLoader .getIcon(" /icons/php/classAbstract.svg" , this ::class .java)
21+ }
22+
23+ val TEST_FILE = LayeredIcon .layeredIcon {
24+ arrayOf(
25+ PHP .FILE ,
26+ AllIcons .Nodes .JunitTestMark ,
27+ )
28+ }
29+ val FINAL_TESTO_CLASS = LayeredIcon .layeredIcon {
30+ arrayOf(
31+ PHP .CLASS ,
32+ AllIcons .Nodes .FinalMark ,
33+ AllIcons .Nodes .JunitTestMark ,
34+ )
35+ }
36+ val ABSTRACT_TESTO_CLASS = LayeredIcon .layeredIcon {
37+ arrayOf(
38+ PHP .CLASS_ABSTRACT ,
39+ AllIcons .Nodes .JunitTestMark ,
40+ )
41+ }
1142}
Original file line number Diff line number Diff line change 1+ package com.github.xepozz.testo.ui
2+
3+ import com.github.xepozz.testo.TestoIcons
4+ import com.github.xepozz.testo.isTestoFile
5+ import com.intellij.ide.IconProvider
6+ import com.intellij.openapi.util.Iconable
7+ import com.intellij.psi.PsiElement
8+ import com.intellij.psi.util.PsiTreeUtil
9+ import com.jetbrains.php.lang.psi.PhpFile
10+ import com.jetbrains.php.lang.psi.elements.PhpClass
11+ import javax.swing.Icon
12+
13+ class TestoIconProvider : IconProvider () {
14+ override fun getIcon (element : PsiElement , @Iconable.IconFlags flags : Int ): Icon ? {
15+ val phpFile = element as ? PhpFile ? : return null
16+
17+ if (! phpFile.isTestoFile()) return null
18+
19+ val phpClass = PsiTreeUtil .findChildOfType(phpFile, PhpClass ::class .java)
20+
21+ return when {
22+ phpClass == null -> TestoIcons .TEST_FILE
23+ phpClass.modifier.isAbstract -> TestoIcons .ABSTRACT_TESTO_CLASS
24+ phpClass.modifier.isFinal -> TestoIcons .FINAL_TESTO_CLASS
25+ else -> TestoIcons .TEST_FILE
26+ }
27+ }
28+ }
Original file line number Diff line number Diff line change 1010 <resource-bundle >messages.TestoBundle</resource-bundle >
1111
1212 <extensions defaultExtensionNs =" com.intellij" >
13+ <fileType
14+ name =" PHP"
15+ fileNames =" testo;testo.php;testo.bat" />
1316 <runLineMarkerContributor
1417 language =" PHP"
1518 implementationClass =" com.github.xepozz.testo.TestoTestRunLineMarkerProvider" />
2427 implementation =" com.github.xepozz.testo.tests.run.TestoDebugRunner" />
2528 <implicitUsageProvider
2629 implementation =" com.github.xepozz.testo.references.TestFunctionImplicitUsageProvider" />
27- <fileType name =" PHP" fileNames =" testo;testo.php;testo.bat" />
30+ <iconProvider
31+ implementation =" com.github.xepozz.testo.ui.TestoIconProvider" />
2832
2933<!-- <notificationGroup-->
3034<!-- id="Testo"-->
You can’t perform that action at this time.
0 commit comments