author | Claus Gittinger <cg@exept.de> |
Wed, 26 Feb 2014 11:36:06 +0100 | |
changeset 14059 | 3ede3ee7643b |
parent 13899 | 85faafbcb77c |
child 14061 | aec91e761d33 |
permissions | -rw-r--r-- |
13840 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libtool' }" |
|
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
AbstractSettingsApplication subclass:#LintRuleSettingsApplication |
|
17 |
instanceVariableNames:'rulesetList rulesetSelectionHolder hasSelectionHolder' |
|
18 |
classVariableNames:'LastFileName' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Lint' |
|
21 |
! |
|
22 |
||
23 |
!LintRuleSettingsApplication class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
38 |
||
39 |
!LintRuleSettingsApplication class methodsFor:'class initialization'! |
|
40 |
||
41 |
initialize |
|
42 |
||
43 |
Smalltalk addStartBlock:[ |
|
44 |
NewLauncher |
|
45 |
addSettingsApplicationByClass: self name |
|
46 |
withName: 'Tools/SmallLint' |
|
47 |
icon: nil. |
|
48 |
] |
|
49 |
||
50 |
"Created: / 04-02-2012 / 21:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
51 |
"Modified: / 27-02-2013 / 22:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
52 |
! ! |
|
53 |
||
54 |
!LintRuleSettingsApplication class methodsFor:'interface opening'! |
|
55 |
||
56 |
open |
|
57 |
||
58 |
| settingsApp | |
|
59 |
||
60 |
settingsApp := SettingsDialog new. |
|
61 |
settingsApp addApplClass:self fullName |
|
62 |
withName:'SmallLint Rules'. |
|
63 |
settingsApp showRoot: false. |
|
64 |
settingsApp selectedItem value: |
|
65 |
(settingsApp applicationList root children anyOne). |
|
66 |
settingsApp open. |
|
67 |
||
68 |
"Created: / 26-05-2008 / 12:17:20 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
69 |
"Modified: / 27-02-2013 / 11:25:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
70 |
! ! |
|
71 |
||
72 |
!LintRuleSettingsApplication class methodsFor:'interface specs'! |
|
73 |
||
74 |
windowSpec |
|
75 |
"This resource specification was automatically generated |
|
76 |
by the UIPainter of ST/X." |
|
77 |
||
78 |
"Do not manually edit this!! If it is corrupted, |
|
79 |
the UIPainter may not be able to read the specification." |
|
80 |
||
81 |
" |
|
82 |
UIPainter new openOnClass:Tools::LintRuleSettingsApplication andSelector:#windowSpec |
|
83 |
Tools::LintRuleSettingsApplication new openInterface:#windowSpec |
|
84 |
Tools::LintRuleSettingsApplication open |
|
85 |
" |
|
86 |
||
87 |
<resource: #canvas> |
|
88 |
||
89 |
^ |
|
90 |
#(FullSpec |
|
91 |
name: windowSpec |
|
92 |
window: |
|
93 |
(WindowSpec |
|
94 |
label: 'Profiles' |
|
95 |
name: 'Profiles' |
|
96 |
min: (Point 10 10) |
|
97 |
bounds: (Rectangle 0 0 782 552) |
|
98 |
) |
|
99 |
component: |
|
100 |
(SpecCollection |
|
101 |
collection: ( |
|
102 |
(LabelSpec |
|
103 |
label: 'Predefined SmallLint Rule Sets' |
|
104 |
name: 'Label' |
|
105 |
layout: (LayoutFrame 0 0 35 0 0 1 65 0) |
|
106 |
translateLabel: true |
|
107 |
adjust: left |
|
108 |
) |
|
109 |
(SelectionInListModelViewSpec |
|
110 |
name: 'ProfileList' |
|
111 |
layout: (LayoutFrame 0 0 65 0 -100 1 0 1) |
|
112 |
enableChannel: svnEnabled |
|
113 |
model: rulesetSelectionHolder |
|
114 |
hasHorizontalScrollBar: true |
|
115 |
hasVerticalScrollBar: true |
|
116 |
listModel: rulesetList |
|
117 |
useIndex: false |
|
118 |
highlightMode: line |
|
119 |
doubleClickSelector: doEdit |
|
120 |
) |
|
121 |
(VerticalPanelViewSpec |
|
122 |
name: 'Buttons1' |
|
123 |
layout: (LayoutFrame -95 1 65 0 0 1 0 0.7) |
|
124 |
horizontalLayout: fit |
|
125 |
verticalLayout: top |
|
126 |
horizontalSpace: 5 |
|
127 |
verticalSpace: 3 |
|
128 |
component: |
|
129 |
(SpecCollection |
|
130 |
collection: ( |
|
131 |
(ActionButtonSpec |
|
132 |
label: 'Add' |
|
133 |
name: 'ButtonAdd' |
|
134 |
translateLabel: true |
|
135 |
model: doAdd |
|
136 |
extent: (Point 95 22) |
|
137 |
) |
|
138 |
(ActionButtonSpec |
|
139 |
label: 'Copy' |
|
140 |
name: 'ButtonCopy' |
|
141 |
translateLabel: true |
|
142 |
model: doCopy |
|
143 |
enableChannel: canCopyHolder |
|
144 |
extent: (Point 95 22) |
|
145 |
) |
|
146 |
(ActionButtonSpec |
|
147 |
label: 'Edit' |
|
148 |
name: 'ButtonEdit' |
|
149 |
translateLabel: true |
|
150 |
model: doEdit |
|
151 |
enableChannel: canEditHolder |
|
152 |
extent: (Point 95 22) |
|
153 |
) |
|
154 |
(ActionButtonSpec |
|
155 |
label: 'Remove' |
|
156 |
name: 'ButtonRemove' |
|
157 |
translateLabel: true |
|
158 |
model: doRemove |
|
159 |
enableChannel: canRemoveHolder |
|
160 |
extent: (Point 95 22) |
|
161 |
) |
|
162 |
) |
|
163 |
||
164 |
) |
|
165 |
) |
|
166 |
(VerticalPanelViewSpec |
|
167 |
name: 'Buttons2' |
|
168 |
layout: (LayoutFrame -95 1 0 0.7 0 1 0 1) |
|
169 |
horizontalLayout: fit |
|
170 |
verticalLayout: bottom |
|
171 |
horizontalSpace: 5 |
|
172 |
verticalSpace: 3 |
|
173 |
component: |
|
174 |
(SpecCollection |
|
175 |
collection: ( |
|
176 |
(ActionButtonSpec |
|
177 |
label: 'Export' |
|
178 |
name: 'Button2' |
|
179 |
translateLabel: true |
|
180 |
model: doExport |
|
181 |
enableChannel: canExportHolder |
|
182 |
extent: (Point 95 22) |
|
183 |
) |
|
184 |
(ActionButtonSpec |
|
185 |
label: 'Import' |
|
186 |
name: 'Button3' |
|
187 |
translateLabel: true |
|
188 |
model: doImport |
|
189 |
extent: (Point 95 22) |
|
190 |
) |
|
191 |
) |
|
192 |
||
193 |
) |
|
194 |
) |
|
195 |
) |
|
196 |
||
197 |
) |
|
198 |
) |
|
199 |
||
200 |
"Modified: / 28-02-2013 / 10:03:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
201 |
! ! |
|
202 |
||
203 |
!LintRuleSettingsApplication methodsFor:'accessing'! |
|
204 |
||
205 |
selection |
|
206 |
||
207 |
^self selectionHolder value |
|
208 |
||
209 |
"Created: / 25-08-2010 / 14:10:03 / Jan Vrany <enter your email here>" |
|
210 |
! |
|
211 |
||
212 |
selection: anObject |
|
213 |
||
214 |
self selectionHolder value: anObject |
|
215 |
||
216 |
"Created: / 25-08-2010 / 14:09:40 / Jan Vrany <enter your email here>" |
|
217 |
! ! |
|
218 |
||
219 |
!LintRuleSettingsApplication methodsFor:'actions'! |
|
220 |
||
221 |
doAdd |
|
222 |
<resource: #uiCallback> |
|
223 |
||
224 |
self doAdd: RBCompositeLintRule new |
|
225 |
||
226 |
"Modified: / 27-02-2013 / 11:25:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
227 |
! |
|
228 |
||
229 |
doAdd: anRBCompositeLintRule |
|
230 |
||
231 |
anRBCompositeLintRule name isNil ifTrue:[ |
|
232 |
anRBCompositeLintRule name: 'New Rule Set ' , (self rulesetList size + 1) printString |
|
233 |
]. |
|
234 |
self rulesetList add: anRBCompositeLintRule. |
|
235 |
self rulesetSelectionHolder value: anRBCompositeLintRule. |
|
236 |
self updateModifiedChannel. |
|
237 |
self doEdit. |
|
238 |
||
239 |
"Created: / 27-02-2013 / 11:25:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
240 |
! |
|
241 |
||
242 |
doCopy |
|
243 |
<resource: #uiCallback> |
|
244 |
||
245 |
| ruleset | |
|
246 |
||
247 |
ruleset := self rulesetSelectionHolder value deepCopy. |
|
248 |
ruleset name: ruleset name , ' (copy)'. |
|
249 |
self doAdd: ruleset |
|
250 |
||
251 |
"Modified: / 27-02-2013 / 11:30:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
252 |
! |
|
253 |
||
254 |
doEdit |
|
255 |
<resource: #uiCallback> |
|
256 |
||
257 |
| rule | |
|
258 |
rule := self rulesetSelectionHolder value. |
|
259 |
LintRuleEditDialog new |
|
260 |
rule: rule; |
|
261 |
open. |
|
262 |
self updateModifiedChannel |
|
263 |
||
264 |
"Modified: / 27-02-2013 / 11:57:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
265 |
! |
|
266 |
||
267 |
doExport |
|
268 |
<resource: #uiCallback> |
|
269 |
||
270 |
| file | |
|
271 |
||
272 |
file := Dialog requestFileName: (resources string: 'Select file') default: (LastFileName ? Filename currentDirectory / 'exported-ruleset.st'). |
|
273 |
file isEmptyOrNil ifTrue:[ ^ self ]. |
|
274 |
||
275 |
self shouldImplement |
|
276 |
||
277 |
"Modified: / 27-02-2013 / 23:53:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
278 |
! |
|
279 |
||
280 |
doImport |
|
281 |
<resource: #uiCallback> |
|
282 |
||
283 |
"automatically generated by UIPainter..." |
|
284 |
||
285 |
"*** the code below performs no action" |
|
286 |
"*** (except for some feedback on the Transcript)" |
|
287 |
"*** Please change as required and accept in the browser." |
|
288 |
"*** (and replace this comment by something more useful ;-)" |
|
289 |
||
290 |
"action to be defined here..." |
|
291 |
||
292 |
Transcript showCR:self class name, ': action for doImport ...'. |
|
293 |
! |
|
294 |
||
295 |
doRemove |
|
296 |
<resource: #uiCallback> |
|
297 |
||
298 |
| rule idx | |
|
299 |
||
300 |
rule := self rulesetSelectionHolder value. |
|
301 |
idx := self rulesetList indexOf: rule. |
|
302 |
idx ~~ 0 ifTrue:[ |
|
303 |
self rulesetList remove: rule. |
|
304 |
self rulesetList size > 0 ifTrue:[ |
|
305 |
self rulesetSelectionHolder value: (self rulesetList at: ((idx -1 ) max: 1)) |
|
306 |
] |
|
307 |
]. |
|
308 |
self updateModifiedChannel |
|
309 |
||
310 |
"Modified: / 27-02-2013 / 11:57:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
311 |
! ! |
|
312 |
||
313 |
!LintRuleSettingsApplication methodsFor:'aspects'! |
|
314 |
||
315 |
canCopyHolder |
|
316 |
^self hasSelectionHolder |
|
317 |
||
318 |
"Created: / 27-02-2013 / 11:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
319 |
! |
|
320 |
||
321 |
canEditHolder |
|
322 |
^self hasSelectionHolder |
|
323 |
||
324 |
"Created: / 27-02-2013 / 11:24:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
325 |
! |
|
326 |
||
327 |
canExportHolder |
|
328 |
^self hasSelectionHolder |
|
329 |
||
330 |
"Created: / 27-02-2013 / 11:24:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
331 |
! |
|
332 |
||
333 |
canRemoveHolder |
|
334 |
^self hasSelectionHolder |
|
335 |
||
336 |
"Created: / 27-02-2013 / 11:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
337 |
! |
|
338 |
||
339 |
hasSelectionHolder |
|
340 |
"return/create the 'hasSelectionHolder' value holder (automatically generated)" |
|
341 |
||
342 |
hasSelectionHolder isNil ifTrue:[ |
|
343 |
hasSelectionHolder := (AspectAdaptor forAspect: #notNil) subjectChannel: self rulesetSelectionHolder |
|
344 |
]. |
|
345 |
^ hasSelectionHolder |
|
346 |
||
347 |
"Modified: / 27-02-2013 / 11:24:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
348 |
! |
|
349 |
||
350 |
rulesetList |
|
351 |
"return/create the 'rulesetList' value holder (automatically generated)" |
|
352 |
||
353 |
rulesetList isNil ifTrue:[ |
|
354 |
rulesetList := List new. |
|
355 |
]. |
|
356 |
^ rulesetList |
|
357 |
||
358 |
"Modified: / 27-02-2013 / 11:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
! |
|
360 |
||
361 |
rulesetSelectionHolder |
|
362 |
"return/create the 'rulesetSelectionHolder' value holder (automatically generated)" |
|
363 |
||
364 |
rulesetSelectionHolder isNil ifTrue:[ |
|
365 |
rulesetSelectionHolder := ValueHolder new. |
|
366 |
]. |
|
367 |
^ rulesetSelectionHolder |
|
368 |
! ! |
|
369 |
||
370 |
!LintRuleSettingsApplication methodsFor:'protocol'! |
|
371 |
||
372 |
basicReadSettings |
|
373 |
"superclass AbstractSettingsApplication says that I am responsible to implement this method" |
|
374 |
||
13899
85faafbcb77c
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13840
diff
changeset
|
375 |
RBCompositeLintRule notNil ifTrue:[ |
85faafbcb77c
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13840
diff
changeset
|
376 |
self rulesetList removeAll; addAll: RBCompositeLintRule rulesets |
85faafbcb77c
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13840
diff
changeset
|
377 |
]. |
13840 | 378 |
|
379 |
"Modified: / 27-02-2013 / 11:15:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
380 |
! |
|
381 |
||
382 |
basicSaveSettings |
|
383 |
"superclass AbstractSettingsApplication says that I am responsible to implement this method" |
|
384 |
||
385 |
RBCompositeLintRule rulesets: self rulesetList asOrderedCollection |
|
386 |
||
387 |
"Modified: / 27-02-2013 / 11:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
388 |
! |
|
389 |
||
390 |
helpFilename |
|
391 |
"subclasses must return the relative name of a helpFile |
|
392 |
in the doc/online/<language>/help directory. |
|
393 |
Or nil, if no help is available." |
|
394 |
||
395 |
^ nil |
|
396 |
||
397 |
"Modified: / 27-02-2013 / 11:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
398 |
! ! |
|
399 |
||
400 |
!LintRuleSettingsApplication methodsFor:'queries'! |
|
401 |
||
402 |
hasUnsavedChanges |
|
403 |
"superclass AbstractSettingsApplication says that I am responsible to implement this method" |
|
404 |
||
13899
85faafbcb77c
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13840
diff
changeset
|
405 |
RBCompositeLintRule isNil ifTrue:[^ false]. |
14059
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
406 |
SequenceableCollection missingClassInLiteralArrayErrorSignal handle:[:ex | |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
407 |
"/ maybe we have to load additional packages... |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
408 |
(Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling') ifFalse:[ |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
409 |
Smalltalk loadPackage:'stx:goodies/refactoryBrowser/lint/spelling'. |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
410 |
ex restart. |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
411 |
]. |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
412 |
ex reject. |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
413 |
] do:[ |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
414 |
^ RBCompositeLintRule rulesets asArray ~= self rulesetList asArray |
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
415 |
]. |
13840 | 416 |
|
417 |
"Modified: / 28-02-2013 / 10:03:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
418 |
! ! |
|
419 |
||
420 |
!LintRuleSettingsApplication class methodsFor:'documentation'! |
|
421 |
||
422 |
version |
|
14059
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
423 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.3 2014-02-26 10:36:06 cg Exp $' |
13840 | 424 |
! |
425 |
||
426 |
version_CVS |
|
14059
3ede3ee7643b
class: Tools::LintRuleSettingsApplication
Claus Gittinger <cg@exept.de>
parents:
13899
diff
changeset
|
427 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleSettingsApplication.st,v 1.3 2014-02-26 10:36:06 cg Exp $' |
13840 | 428 |
! ! |
429 |
||
430 |
||
431 |
LintRuleSettingsApplication initialize! |