10484
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
25 |
"
|
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
|
28 |
"{ NameSpace: Tools }"
|
|
29 |
|
|
30 |
CodeViewService subclass:#LintService
|
|
31 |
instanceVariableNames:'ruleHolderFromApp highlighter'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Interface-Lint'
|
|
35 |
!
|
|
36 |
|
|
37 |
!LintService class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
|
41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
|
42 |
All Rights Reserved
|
|
43 |
|
|
44 |
Permission is hereby granted, free of charge, to any person
|
|
45 |
obtaining a copy of this software and associated documentation
|
|
46 |
files (the 'Software'), to deal in the Software without
|
|
47 |
restriction, including without limitation the rights to use,
|
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the
|
|
50 |
Software is furnished to do so, subject to the following
|
|
51 |
conditions:
|
|
52 |
|
|
53 |
The above copyright notice and this permission notice shall be
|
|
54 |
included in all copies or substantial portions of the Software.
|
|
55 |
|
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
63 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
64 |
"
|
|
65 |
! !
|
|
66 |
|
|
67 |
!LintService class methodsFor:'accessing'!
|
|
68 |
|
|
69 |
label
|
|
70 |
|
|
71 |
"Answers short label - for UI"
|
|
72 |
|
|
73 |
^'SmallLint Checker'
|
|
74 |
|
|
75 |
"Created: / 05-08-2011 / 11:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
76 |
! !
|
|
77 |
|
|
78 |
!LintService methodsFor:'accessing'!
|
|
79 |
|
|
80 |
syntaxHighlighter
|
|
81 |
|
|
82 |
| app rules |
|
|
83 |
|
|
84 |
((app :=codeView application) respondsTo: #selectedLintRules) ifTrue:[
|
|
85 |
rules := self ruleHolderFromApp value.
|
|
86 |
rules isEmptyOrNil not ifTrue:[
|
|
87 |
highlighter rules: rules.
|
|
88 |
^highlighter
|
|
89 |
]
|
|
90 |
].
|
|
91 |
^nil
|
|
92 |
|
|
93 |
"Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
94 |
! !
|
|
95 |
|
|
96 |
!LintService methodsFor:'aspects'!
|
|
97 |
|
|
98 |
ruleHolderFromApp
|
|
99 |
"return/create the 'ruleHolderFromApp' value holder (automatically generated)"
|
|
100 |
|
|
101 |
ruleHolderFromApp isNil ifTrue:[
|
|
102 |
ruleHolderFromApp := ValueHolder new.
|
|
103 |
ruleHolderFromApp addDependent:self.
|
|
104 |
].
|
|
105 |
^ ruleHolderFromApp
|
|
106 |
!
|
|
107 |
|
|
108 |
ruleHolderFromApp:something
|
|
109 |
"set the 'ruleHolderFromApp' value holder (automatically generated)"
|
|
110 |
|
|
111 |
|oldValue newValue|
|
|
112 |
|
|
113 |
ruleHolderFromApp notNil ifTrue:[
|
|
114 |
oldValue := ruleHolderFromApp value.
|
|
115 |
ruleHolderFromApp removeDependent:self.
|
|
116 |
].
|
|
117 |
ruleHolderFromApp := something.
|
|
118 |
ruleHolderFromApp notNil ifTrue:[
|
|
119 |
ruleHolderFromApp addDependent:self.
|
|
120 |
].
|
|
121 |
newValue := ruleHolderFromApp value.
|
|
122 |
oldValue ~~ newValue ifTrue:[
|
|
123 |
self update:#value with:newValue from:ruleHolderFromApp.
|
|
124 |
].
|
|
125 |
! !
|
|
126 |
|
|
127 |
!LintService methodsFor:'change & update'!
|
|
128 |
|
|
129 |
update: aspect with: param from: sender
|
|
130 |
|
|
131 |
|
|
132 |
sender == ruleHolderFromApp ifTrue:[
|
|
133 |
self syntaxHighlight: true
|
|
134 |
]
|
|
135 |
|
|
136 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
137 |
! !
|
|
138 |
|
|
139 |
!LintService methodsFor:'initialization'!
|
|
140 |
|
|
141 |
initialize
|
|
142 |
|
|
143 |
super initialize.
|
|
144 |
|
|
145 |
highlighter := LintHighlighter new
|
|
146 |
|
|
147 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
148 |
"Created: / 05-08-2011 / 11:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
149 |
! !
|
|
150 |
|
|
151 |
!LintService methodsFor:'private'!
|
|
152 |
|
|
153 |
syntaxHighlight: delayed
|
|
154 |
|
|
155 |
| service |
|
|
156 |
service := self service: #'Tools::CodeHighlightingService'.
|
|
157 |
service notNil ifTrue:[
|
|
158 |
service syntaxHighlight: delayed
|
|
159 |
]
|
|
160 |
|
|
161 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
162 |
! !
|
|
163 |
|
|
164 |
!LintService methodsFor:'registering'!
|
|
165 |
|
|
166 |
registerIn: aCodeView
|
|
167 |
|
|
168 |
super registerIn: aCodeView.
|
|
169 |
(self application respondsTo: #selectedLintRules) ifTrue:[
|
|
170 |
self ruleHolderFromApp: self application selectedLintRules
|
|
171 |
].
|
|
172 |
|
|
173 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
174 |
"Created: / 05-08-2011 / 11:47:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
175 |
! !
|
|
176 |
|
|
177 |
!LintService class methodsFor:'documentation'!
|
|
178 |
|
|
179 |
version
|
|
180 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.1 2011-08-05 11:11:54 vrany Exp $'
|
|
181 |
!
|
|
182 |
|
|
183 |
version_CVS
|
|
184 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.1 2011-08-05 11:11:54 vrany Exp $'
|
|
185 |
! !
|