@@ -6,7 +6,6 @@ import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator
6
6
import com.intellij.codeInspection.InspectionEngine
7
7
import com.intellij.codeInspection.InspectionManager
8
8
import com.intellij.codeInspection.ProblemDescriptor
9
- import com.intellij.codeInspection.ProblemHighlightType
10
9
import com.intellij.codeInspection.ex.GlobalInspectionContextBase
11
10
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper
12
11
import com.intellij.lang.annotation.HighlightSeverity
@@ -32,22 +31,6 @@ import javax.swing.JPanel
32
31
import javax.swing.JTable
33
32
import javax.swing.table.DefaultTableModel
34
33
35
- data class SketchInspectionError (
36
- val lineNumber : Int ,
37
- val description : String ,
38
- val highlightType : ProblemHighlightType ,
39
- ) {
40
- companion object {
41
- fun from (problemDescriptor : ProblemDescriptor ): SketchInspectionError {
42
- return SketchInspectionError (
43
- problemDescriptor.lineNumber,
44
- problemDescriptor.descriptionTemplate,
45
- problemDescriptor.highlightType
46
- )
47
- }
48
- }
49
- }
50
-
51
34
object SketchCodeInspection {
52
35
fun showErrors (errors : List <SketchInspectionError >, panel : JPanel ) {
53
36
val columnNames = arrayOf(" Line" , " Description" , " Highlight Type" )
@@ -64,17 +47,19 @@ object SketchCodeInspection {
64
47
val scrollPane = JBScrollPane (table).apply {
65
48
preferredSize = Dimension (480 , 400 )
66
49
}
50
+
67
51
val errorLabel = JBLabel (AutoDevBundle .message(" sketch.lint.error" , errors.size)).apply {
68
52
border = BorderFactory .createEmptyBorder(5 , 5 , 5 , 5 )
53
+ addMouseListener(object : MouseAdapter () {
54
+ override fun mouseClicked (e : MouseEvent ? ) {
55
+ createPopup(scrollPane, table, errors).showInCenterOf(panel)
56
+ }
57
+
58
+ override fun mouseEntered (e : MouseEvent ) {
59
+ toolTipText = AutoDevBundle .message(" sketch.lint.error.tooltip" )
60
+ }
61
+ })
69
62
}
70
- errorLabel.addMouseListener(object : MouseAdapter () {
71
- override fun mouseClicked (e : MouseEvent ? ) {
72
- createPopup(scrollPane, table, errors).showInCenterOf(panel)
73
- }
74
- override fun mouseEntered (e : MouseEvent ) {
75
- errorLabel.toolTipText = AutoDevBundle .message(" sketch.lint.error.tooltip" )
76
- }
77
- })
78
63
79
64
val errorPanel = JPanel ().apply {
80
65
background = JBColor .WHITE
@@ -142,7 +127,8 @@ object SketchCodeInspection {
142
127
it.initialize(globalContext)
143
128
}
144
129
145
- val toolsCopy: MutableList <LocalInspectionToolWrapper > = ArrayList <LocalInspectionToolWrapper >(toolWrappers.size)
130
+ val toolsCopy: MutableList <LocalInspectionToolWrapper > =
131
+ ArrayList <LocalInspectionToolWrapper >(toolWrappers.size)
146
132
for (tool in toolWrappers) {
147
133
if (tool is LocalInspectionToolWrapper ) {
148
134
toolsCopy.add(tool.createCopy())
0 commit comments