author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 21 Jun 2013 19:05:40 +0100 | |
branch | jv |
changeset 13173 | e9da2324940d |
parent 12678 | d6e678a09423 |
child 15566 | 184cea584be5 |
permissions | -rw-r--r-- |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
1 |
" |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
3 |
All Rights Reserved |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
4 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
5 |
This software is furnished under a license and may be used |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
10 |
hereby transferred. |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
11 |
" |
11183 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
16 |
CodeViewService subclass:#BackgroundSourceProcessingService |
11183 | 17 |
instanceVariableNames:'job done modified' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-CodeView' |
|
21 |
! |
|
22 |
||
23 |
!BackgroundSourceProcessingService class methodsFor:'documentation'! |
|
24 |
||
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
25 |
copyright |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
26 |
" |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
28 |
All Rights Reserved |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
29 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
30 |
This software is furnished under a license and may be used |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
31 |
only in accordance with the terms of that license and with the |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
32 |
inclusion of the above copyright notice. This software may not |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
33 |
be provided or otherwise made available to, or used by, any |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
34 |
other person. No title to or ownership of the software is |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
35 |
hereby transferred. |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
36 |
" |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
37 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
38 |
|
11183 | 39 |
documentation |
40 |
" |
|
41 |
An abstract base class for all services that process current |
|
42 |
(displayed) source code. All processing is done in background |
|
43 |
job, that is restarted whenever a text in the editor is changed. |
|
44 |
||
45 |
[author:] |
|
46 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
47 |
||
48 |
[instance variables:] |
|
49 |
job <BackgroundJob> A background job. |
|
50 |
||
51 |
[class variables:] |
|
52 |
||
53 |
[see also:] |
|
54 |
||
55 |
" |
|
56 |
! ! |
|
57 |
||
58 |
!BackgroundSourceProcessingService class methodsFor:'testing'! |
|
59 |
||
60 |
isAbstract |
|
61 |
||
62 |
^self == Tools::BackgroundSourceProcessingService |
|
63 |
||
64 |
"Created: / 24-01-2012 / 12:27:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
! ! |
|
66 |
||
67 |
!BackgroundSourceProcessingService methodsFor:'acessing-defaults'! |
|
68 |
||
69 |
defaultJobName |
|
70 |
"Returns a human-readable job name, to ease identification in process browser" |
|
71 |
||
72 |
^ 'CodeView2''s source processing job' |
|
73 |
||
74 |
"Created: / 24-01-2012 / 12:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
75 |
! ! |
|
76 |
||
77 |
!BackgroundSourceProcessingService methodsFor:'change & update'! |
|
78 |
||
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
79 |
modelChanged |
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
80 |
"Model has changed (i.e., value holder keeping displayed text" |
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
81 |
|
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
82 |
self sourceChanged: true |
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
83 |
|
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
84 |
"Created: / 17-03-2012 / 15:45:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
85 |
! |
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
86 |
|
11183 | 87 |
sourceChanged:force |
88 |
"Called when codeview's text changes" |
|
89 |
||
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
90 |
(force or:[codeView reallyModified]) ifTrue:[ |
11183 | 91 |
self process |
92 |
]. |
|
93 |
||
94 |
"Modified: / 22-08-2011 / 13:51:53 / cg" |
|
95 |
"Modified (format): / 05-09-2011 / 05:06:40 / cg" |
|
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
96 |
"Modified: / 17-03-2012 / 16:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11183 | 97 |
! |
98 |
||
99 |
update:aspect with:param from:sender |
|
100 |
textView notNil ifTrue:[ |
|
101 |
"/sender == textView modifiedChannel ifTrue:[^self codeChanged: false]. |
|
102 |
sender == textView model ifTrue:[ |
|
12172
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
103 |
sender value ~= textView contents ifTrue:[ |
12194
4639848e5517
Improvements in syntax highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12172
diff
changeset
|
104 |
self modelChanged. |
12172
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
105 |
^self. |
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
106 |
]. |
11183 | 107 |
]. |
108 |
(sender == textView and:[aspect == #sizeOfContents]) ifTrue:[ |
|
12172
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
109 |
self sourceChanged:true. |
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
110 |
^self. |
11183 | 111 |
]. |
112 |
]. |
|
113 |
codeView notNil ifTrue:[ |
|
114 |
sender == codeView languageHolder ifTrue:[ |
|
12678
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
115 |
self sourceChanged:true. |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
116 |
^self |
11183 | 117 |
]. |
118 |
sender == codeView classHolder ifTrue:[ |
|
12678
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
119 |
self sourceChanged:true. |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
120 |
^self |
11183 | 121 |
]. |
122 |
]. |
|
12678
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
123 |
|
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
124 |
aspect == #codeAspect ifTrue:[ |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
125 |
self sourceChanged:true. |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
126 |
^self |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
127 |
]. |
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
128 |
|
11183 | 129 |
super |
130 |
update:aspect |
|
131 |
with:param |
|
132 |
from:sender |
|
133 |
||
134 |
"Created: / 06-03-2010 / 19:38:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
135 |
"Modified: / 13-09-2011 / 12:00:29 / cg" |
|
12172
047fafb1c37f
Avoid reprocessing when test has not changed
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12128
diff
changeset
|
136 |
"Modified: / 22-02-2012 / 15:02:16 / jv" |
12678
d6e678a09423
Fix in CodeView2 - propagate change in codeAspect to services...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12431
diff
changeset
|
137 |
"Modified: / 15-04-2013 / 23:00:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11183 | 138 |
! ! |
139 |
||
140 |
!BackgroundSourceProcessingService methodsFor:'event handling'! |
|
141 |
||
142 |
linesDeletedFrom:start to:end |
|
143 |
self sourceChanged:true |
|
144 |
||
145 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
146 |
"Created: / 16-09-2011 / 15:18:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
147 |
! |
|
148 |
||
149 |
linesInsertedFrom:start to:end |
|
150 |
self sourceChanged:true |
|
151 |
||
152 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
153 |
"Created: / 16-09-2011 / 15:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
154 |
! |
|
155 |
||
156 |
linesModifiedFrom:start to:end |
|
157 |
self sourceChanged:true |
|
158 |
||
159 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
160 |
"Created: / 16-09-2011 / 15:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
161 |
! ! |
|
162 |
||
163 |
!BackgroundSourceProcessingService methodsFor:'initialization'! |
|
164 |
||
165 |
initialize |
|
166 |
job := (Smalltalk at:#BackgroundJob) |
|
167 |
named:self defaultJobName |
|
11618 | 168 |
on:[ |
169 |
Error handle:[:ex | |
|
170 |
(Dialog confirm:('Error while processing source:\\',ex description,'\\Debug ?') withCRs) |
|
171 |
ifTrue:[ |
|
172 |
ex reject. |
|
173 |
] |
|
174 |
] do:[ |
|
175 |
self process:true |
|
176 |
] |
|
177 |
]. |
|
11183 | 178 |
|
179 |
"Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
180 |
"Modified: / 24-01-2012 / 12:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11618 | 181 |
"Modified: / 19-07-2012 / 16:17:21 / cg" |
11183 | 182 |
! ! |
183 |
||
184 |
!BackgroundSourceProcessingService methodsFor:'processing'! |
|
185 |
||
186 |
process |
|
187 |
"(Re)starts the processing job. Should be called whenever a source |
|
188 |
must be (re)processed." |
|
189 |
||
11558 | 190 |
| prio browser | |
11183 | 191 |
|
192 |
"/ this clobbers the codeViews modified state; therefore, we have to remember |
|
193 |
"/ this info somewhere ... |
|
11558 | 194 |
(browser := codeView browser) notNil ifTrue:[ |
11183 | 195 |
textView modified ifTrue:[ |
11558 | 196 |
browser navigationState realModifiedState: true |
11183 | 197 |
]. |
198 |
textView modifiedChannel setValue:false. |
|
199 |
]. |
|
200 |
||
201 |
job scheduled ifTrue:[ |
|
202 |
job running ifFalse:[ |
|
203 |
"/ process already created, but did not get a change to start yet; |
|
204 |
^ self |
|
11558 | 205 |
]. |
206 |
job stop. |
|
11183 | 207 |
]. |
11558 | 208 |
prio := Processor userBackgroundPriority. |
11183 | 209 |
job startWithPriority: prio. |
210 |
||
211 |
"Modified: / 07-07-2011 / 12:26:12 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
212 |
"Created: / 24-01-2012 / 12:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11558 | 213 |
"Modified: / 05-06-2012 / 23:58:20 / cg" |
11183 | 214 |
! |
215 |
||
216 |
process: delayed |
|
217 |
"Do the real source processing. If delayed is true, actuall data update must |
|
218 |
be done within the event queue using #pushUserEvent:... |
|
219 |
" |
|
220 |
||
221 |
self subclassResponsibility |
|
222 |
||
223 |
"Created: / 24-01-2012 / 12:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
224 |
! ! |
|
225 |
||
226 |
!BackgroundSourceProcessingService methodsFor:'registering'! |
|
227 |
||
228 |
registerIn: aCodeView |
|
229 |
||
230 |
super registerIn: aCodeView. |
|
231 |
textView addDependent: self. |
|
232 |
||
233 |
"Created: / 27-07-2011 / 13:25:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
234 |
! ! |
|
235 |
||
236 |
!BackgroundSourceProcessingService class methodsFor:'documentation'! |
|
237 |
||
238 |
version |
|
11618 | 239 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.3 2012-07-19 15:19:59 cg Exp $' |
11183 | 240 |
! |
241 |
||
242 |
version_CVS |
|
11618 | 243 |
^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.3 2012-07-19 15:19:59 cg Exp $' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
244 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
245 |
|
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
246 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
247 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
248 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
249 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
250 |
|
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
251 |
version_SVN |
12265 | 252 |
^ '$Id: Tools__BackgroundSourceProcessingService.st 8022 2012-07-25 09:51:30Z vranyj1 $' |
11183 | 253 |
! ! |
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
254 |