tools/JavaCompilerProblemService.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 08 Aug 2013 10:41:42 +0100
branchdevelopment
changeset 2647 8feaf04a003d
parent 2646 39856623a013
child 2648 f871848ecfa8
permissions -rw-r--r--
- JavaSyntaxHighlighter class: JavaSyntaxHighlighter changed: #format:kind:in: - JavaCompilerProblemService class: JavaCompilerProblemService changed: #updateProblems:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:libjava/tools' }"
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Tools::CodeViewService subclass:#JavaCompilerProblemService
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
     4
	instanceVariableNames:'problems'
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
	classVariableNames:''
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	poolDictionaries:''
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	category:'Languages-Java-Tools-Editor'
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
!
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    11
!JavaCompilerProblemService class methodsFor:'image specs'!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    12
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    13
javaCompilerError16x16
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    14
    "This resource specification was automatically generated
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    15
     by the ImageEditor of ST/X."
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    16
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    17
    "Do not manually edit this!! If it is corrupted,
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    18
     the ImageEditor may not be able to read the specification."
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    19
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    20
    "
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    21
     self javaCompilerError16x16 inspect
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    22
     ImageEditor openOnClass:self andSelector:#javaCompilerError16x16
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    23
     Icon flushCachedIcons
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    24
    "
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    25
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    26
    <resource: #image>
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    27
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    28
    ^Icon
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    29
        constantNamed:'JavaCompilerProblemService javaCompilerError16x16'
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    30
        ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(8)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    31
K"8.K"8.K"8.K"8.K"8.K"8.K"4-KR4-K"8.K"8.K"8.K"4&J20+I"4.K"8.K"8.K"8)JBL#H2\*KR8.K"8.K"8.IA,_F1<[IR4.K"8.K"8.K"DTE1TWD2H-
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    32
KR4-KR8.K"8 DQ@RD@@@@@@@@@@.K"8.G!!$OKP<@@ TAAPH@K"8.K"4ZGB4]@@T-AB4E@B8.K"8.KQXFF@@AAB4D@P@.K"8.K"4LKP @@PP-A@D@K"8.K"8-
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    33
C \J@@T-AB4E@B8.K"8.KP4IB0@BAPDE@0@.K"8.K"8-KR4@@@@@@@@@K"8.K"8.K"8.KR4-KR4-KR8.K"8.K"8.K"8.K"8.K"8.K @@@@@@@@@@@@@@@@@@
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    34
@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[216 66 79 221 91 102 227 119 128 231 136 144 232 144 151 236 160 167 199 213 238 175 182 194 81 106 139 75 96 121 92 112 135 175 185 196 133 172 208 179 192 204 132 163 188 249 246 194 253 252 236 248 242 175 253 251 228 251 238 178 251 239 178 252 242 196 186 173 121 252 242 198 181 167 115 239 199 71 253 224 127 252 233 175 250 209 100 251 211 101 248 220 142 253 232 174 238 186 57 239 184 63 237 183 63 255 231 181 237 176 63 236 175 63 239 189 97 243 191 99 242 191 99 241 190 102 241 191 102 236 170 64 236 172 67 255 255 255 255 255 255]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@_@C>@O<@?0C?<O?0??C?<G?0_?A?<G?0O?@G<@@@b') ; yourself); yourself]
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    35
!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    36
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    37
javaCompilerWarning16x16
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    38
    "This resource specification was automatically generated
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    39
     by the ImageEditor of ST/X."
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    40
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    41
    "Do not manually edit this!! If it is corrupted,
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    42
     the ImageEditor may not be able to read the specification."
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    43
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    44
    "
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    45
     self javaCompilerWarning16x16 inspect
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    46
     ImageEditor openOnClass:self andSelector:#javaCompilerWarning16x16
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    47
     Icon flushCachedIcons
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    48
    "
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    49
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    50
    <resource: #image>
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    51
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    52
    ^Icon
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    53
        constantNamed:'JavaCompilerProblemService javaCompilerWarning16x16'
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    54
        ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(8)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    55
PDA@PDA@PDA@PDA@PDA@PDA@PC<?O3<?PDA@PDA@PDA@PC</MSX5K3=@PDA@PDA@PD@2LR,+J3@3O4A@PDA@PDA@KA !!FBDXKS=@PDA@PDA@PBXOD!!@RC"\?
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    56
O3=@PDA@PD@"B0(MB ,#OC =O4A@PDA@GQTIO0$VG# LNC=@PDA@PC<WFS<$D30\O!!0<O4A@PDA@O1D@EC<8GC8\NC=@PDA@PC<FO0H;JA0.GB$:PDA@PD@?
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    57
B@DDNA,4O#PZNDA@PDA@O0\CAS\_HB( IS]@PDA@PD@?O3<9M3\7M3\9PDA@PDA@PDA@O3<?O3<?O4A@PDA@PDA@PDA@PDA@PDA@P@@@@@@@@@@@@@@@@@@@
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    58
@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[199 213 238 175 182 194 81 106 139 75 96 121 92 112 135 198 205 213 133 172 208 179 192 204 132 163 188 249 246 194 253 252 236 248 242 175 255 252 211 253 251 228 251 238 178 251 239 178 252 242 196 186 173 121 252 242 198 253 226 129 181 167 115 239 199 71 239 200 71 253 224 127 252 233 175 250 209 100 253 221 130 253 222 130 248 216 128 248 220 142 248 221 143 254 227 150 240 216 144 253 232 174 238 186 57 238 187 58 247 203 90 255 226 150 239 184 63 237 183 63 237 192 96 237 191 96 181 148 82 255 231 181 237 176 63 236 175 63 210 157 62 239 189 97 243 191 99 242 191 99 241 190 102 241 191 102 237 194 116 236 170 64 236 172 67 198 133 46 225 165 85 229 199 160 226 179 120 225 179 120 234 192 141 234 201 159 80 40 0 255 255 255 255 255 255]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@_@C>@O<@?0C?0O? ?>C?<G?0_?A?<G?0O?@G<@@@b') ; yourself); yourself]
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    59
! !
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
    60
2644
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    61
!JavaCompilerProblemService class methodsFor:'queries'!
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    62
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    63
isUsefulFor:aCodeView
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    64
    "this filters useful services.
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    65
     must be redefined to return true in subclasses (but each class must do it only
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    66
     for itself - not for subclasses"
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    67
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    68
    ^ self == JavaCompilerProblemService
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    69
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    70
    "Created: / 04-08-2013 / 14:19:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    71
! !
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    72
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
!JavaCompilerProblemService methodsFor:'accessing'!
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
syntaxHighlighter
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    "Returns a syntax highligter class or nil. The highlighting
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
     process gather all syntaxHighlighterClasses from all services
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
     and then use them one by one to highlight the text. Individual
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
     services may override this method to provide additional 
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
     highliging of the source code"
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
2644
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    83
    | lang |        
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    JavaCompiler isNil ifTrue:[ ^ nil ].
2644
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    85
    lang := codeView language.
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    86
    ^(lang notNil and:[lang isJava]) 
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    87
        ifTrue:[JavaCompilerProblemHighlighter new]
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    88
        ifFalse:[nil]
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    "Created: / 15-04-2013 / 23:35:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2644
e61250315ca8 Performance optimization in JavaCompilerpProblemService.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2515
diff changeset
    91
    "Modified: / 04-08-2013 / 14:26:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
! !
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
2645
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    94
!JavaCompilerProblemService methodsFor:'change & update'!
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    95
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    96
update: aspect with: param from: sender
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    97
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    98
    "Get updated whenever something changes in the code view.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
    99
     Subclasses may override this"
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   100
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   101
    aspect == #problems ifTrue:[
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   102
        | cls method |
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   103
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   104
        method := codeView method.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   105
        cls := method notNil ifTrue:[method mclass] ifFalse:[codeView classHolder value].
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   106
        cls == param ifTrue:[
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   107
            self updateProblems: cls
2645
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   108
        ]
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   109
    ].
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   110
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   111
    "Created: / 06-08-2013 / 10:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   112
    "Modified: / 06-08-2013 / 21:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   113
!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   114
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   115
updateProblems: class
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   116
    problems := JavaCompilerProblemRegistry problemsFor: class.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   117
    self rehighlight: true.
2647
8feaf04a003d - JavaSyntaxHighlighter
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2646
diff changeset
   118
    gutterView invalidate.
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   119
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   120
    "Created: / 06-08-2013 / 20:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2647
8feaf04a003d - JavaSyntaxHighlighter
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2646
diff changeset
   121
    "Modified: / 08-08-2013 / 00:19:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   122
! !
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   123
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   124
!JavaCompilerProblemService methodsFor:'drawing'!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   125
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   126
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   127
    "Called by both gutterView and textView (well, not yet) to
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   128
     allow services to draw custom things on text view.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   129
     Ask JV what the args means if unsure (I'm lazy to document
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   130
     them, now it is just an experiment...)"
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   131
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   132
    | problem |        
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   133
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   134
    problems isEmptyOrNil ifTrue:[ ^ self ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   135
    problem :=  self problemAtLine: lineNo.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   136
    problem notNil ifTrue:[
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   137
        self 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   138
            drawAnnotationIcon: (problem isError 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   139
                                    ifTrue:[self class javaCompilerError16x16] 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   140
                                    ifFalse:[self class javaCompilerWarning16x16])
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   141
            atX: x y: y  width: w height: h.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   142
    ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   143
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   144
    "Created: / 06-08-2013 / 21:29:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   145
    "Modified: / 06-08-2013 / 23:30:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   146
! !
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   147
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   148
!JavaCompilerProblemService methodsFor:'event handling'!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   149
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   150
buttonPress:button x:x y:y in:view 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   151
    |lineNr|
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   152
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   153
    problems isEmptyOrNil ifTrue:[
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   154
        ^ false
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   155
    ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   156
    view == gutterView ifTrue:[
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   157
        button == 1 ifTrue:[
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   158
            lineNr := textView yVisibleToLineNr:y.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   159
            lineNr notNil ifTrue:[ 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   160
                ^ self showProblemAtLine: lineNr 
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   161
            ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   162
            ^ false.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   163
        ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   164
    ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   165
    ^ false
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   166
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   167
    "Created: / 07-08-2013 / 00:00:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2645
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   168
! !
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   169
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   170
!JavaCompilerProblemService methodsFor:'private'!
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   171
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   172
problemAtLine: lineNr
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   173
    ^ problems detect:[:p | p getSourceLineNumber == lineNr ] ifNone:[nil].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   174
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   175
    "Created: / 06-08-2013 / 23:28:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   176
!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   177
2645
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   178
rehighlight: delayed
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   179
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   180
    | service |
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   181
    service := self service: SmallSenseSyntaxHighlightingService name.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   182
    service isNil ifTrue:[
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   183
        service := self service: Tools::CodeHighlightingService name
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   184
    ].
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   185
    service notNil ifTrue:[
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   186
        service sourceChanged: true.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   187
    ]
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   188
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   189
    "Created: / 27-01-2012 / 17:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   190
    "Modified: / 06-08-2013 / 10:32:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2646
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   191
!
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   192
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   193
showProblemAtLine: lineNr
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   194
    | p |
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   195
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   196
    p := self problemAtLine: lineNr.
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   197
    p isNil ifTrue:[ ^ false ].
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   198
    JavaCompilerProblemPopup new
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   199
        problem: p;
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   200
        codeView: codeView;
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   201
        allButOpen;
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   202
        openWindowAt: (Screen current pointerPosition - (20@20)).
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   203
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   204
    ^ true
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   205
39856623a013 Added Java compiler problem annotations and popup window.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2645
diff changeset
   206
    "Created: / 07-08-2013 / 00:00:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2645
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   207
! !
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   208
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   209
!JavaCompilerProblemService methodsFor:'registering'!
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   210
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   211
registerIn: aCodeView
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   212
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   213
    "Installs myself in aCodeView"
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   214
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   215
    super registerIn: aCodeView.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   216
    JavaCompilerProblemRegistry instance addDependent: self.
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   217
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   218
    "Created: / 06-08-2013 / 10:33:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   219
! !
b7a540a27521 Java compiler problem highlighting improved.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2644
diff changeset
   220
2515
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   221
!JavaCompilerProblemService class methodsFor:'documentation'!
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   222
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   223
version_HG
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
    ^ '$Changeset: <not expanded> $'
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
! !
bcfe9f4dca6b Improvements in JavaCompiler.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227