14 |
14 |
15 You should have received a copy of the GNU Lesser General Public |
15 You should have received a copy of the GNU Lesser General Public |
16 License along with this library; if not, write to the Free Software |
16 License along with this library; if not, write to the Free Software |
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 " |
18 " |
|
19 'From Smalltalk/X, Version:6.2.5.0 on 03-12-2014 at 23:46:57' ! |
|
20 |
19 "{ Package: 'stx:goodies/smallsense' }" |
21 "{ Package: 'stx:goodies/smallsense' }" |
20 |
22 |
21 "{ NameSpace: SmallSense }" |
23 "{ NameSpace: SmallSense }" |
22 |
24 |
23 SimpleDialog subclass:#CriticsWindow |
25 SimpleDialog subclass:#CriticsWindow |
90 UIPainter new openOnClass:SmallSense::CriticsWindow andSelector:#windowSpec |
92 UIPainter new openOnClass:SmallSense::CriticsWindow andSelector:#windowSpec |
91 SmallSense::CriticsWindow new openInterface:#windowSpec |
93 SmallSense::CriticsWindow new openInterface:#windowSpec |
92 SmallSense::CriticsWindow open |
94 SmallSense::CriticsWindow open |
93 " |
95 " |
94 |
96 |
95 |
97 <resource: #canvas> |
96 |
98 |
97 ^ |
99 ^ |
98 #(FullSpec |
100 #(FullSpec |
99 name: windowSpec |
101 name: windowSpec |
100 window: |
102 window: |
101 (WindowSpec |
103 (WindowSpec |
102 label: 'SmalllintRuleDetail' |
104 label: 'SmalllintRuleDetail' |
103 name: 'SmalllintRuleDetail' |
105 name: 'SmalllintRuleDetail' |
104 min: (Point 10 10) |
106 min: (Point 10 10) |
105 bounds: (Rectangle 0 0 472 308) |
107 bounds: (Rectangle 0 0 563 384) |
106 backgroundColor: (Color 100.0 100.0 75.0) |
108 backgroundColor: (Color 100.0 100.0 75.0) |
107 forceRecursiveBackgroundOfDefaultBackground: true |
109 forceRecursiveBackgroundOfDefaultBackground: true |
108 ) |
110 ) |
109 component: |
111 component: |
110 (SpecCollection |
112 (SpecCollection |
111 collection: ( |
113 collection: ( |
112 (ActionButtonSpec |
114 (ActionButtonSpec |
113 label: 'closeIcon' |
115 label: 'closeIcon' |
114 name: 'Button4' |
116 name: 'Button4' |
118 translateLabel: true |
120 translateLabel: true |
119 model: closeRequest |
121 model: closeRequest |
120 ) |
122 ) |
121 (HTMLViewSpec |
123 (HTMLViewSpec |
122 name: 'Rationale' |
124 name: 'Rationale' |
123 layout: (LayoutFrame 0 0 20 0 -20 1 -60 1) |
125 layout: (LayoutFrame 0 0 20 0 0 1 -65 1) |
124 level: 0 |
126 level: 0 |
125 visibilityChannel: rationaleVisibleHolder |
127 visibilityChannel: rationaleVisibleHolder |
126 hasHorizontalScrollBar: true |
128 hasHorizontalScrollBar: true |
127 hasVerticalScrollBar: true |
129 hasVerticalScrollBar: true |
|
130 miniScrollerHorizontal: true |
|
131 miniScrollerVertical: true |
128 htmlText: ruleRationaleAndFixesHTMLHolder |
132 htmlText: ruleRationaleAndFixesHTMLHolder |
129 postBuildCallback: setupHTMLView: |
133 postBuildCallback: setupHTMLView: |
130 ) |
134 ) |
131 (LinkButtonSpec |
135 (LinkButtonSpec |
|
136 label: 'Disable this Rule' |
|
137 name: 'Button3' |
|
138 layout: (LayoutFrame -1 0 -59 1 -16 1 -30 1) |
|
139 activeHelpKey: disableRule |
|
140 level: 0 |
|
141 translateLabel: true |
|
142 labelChannel: disableRuleString |
|
143 adjust: left |
|
144 model: disableLintRule |
|
145 keepSpaceForOSXResizeHandleH: true |
|
146 ) |
|
147 (LinkButtonSpec |
132 name: 'Button1' |
148 name: 'Button1' |
133 layout: (LayoutFrame -1 0 -59 1 -31 1 -30 1) |
149 layout: (LayoutFrame 0 0 -29 1 -16 1 0 1) |
134 activeHelpKey: browseRule |
150 activeHelpKey: browseRule |
135 level: 0 |
151 level: 0 |
136 translateLabel: true |
152 translateLabel: true |
137 labelChannel: ruleNameAspect |
153 labelChannel: ruleNameAspect |
138 adjust: left |
154 adjust: left |
139 model: browseLintRule |
155 model: browseLintRule |
140 keepSpaceForOSXResizeHandleH: true |
156 keepSpaceForOSXResizeHandleH: true |
141 ) |
157 ) |
142 (LinkButtonSpec |
|
143 label: 'Disable this Rule' |
|
144 name: 'Button3' |
|
145 layout: (LayoutFrame 0 0 -29 1 -30 1 0 1) |
|
146 activeHelpKey: disableRule |
|
147 level: 0 |
|
148 translateLabel: true |
|
149 labelChannel: disableRuleString |
|
150 adjust: left |
|
151 model: disableLintRule |
|
152 keepSpaceForOSXResizeHandleH: true |
|
153 ) |
|
154 ) |
158 ) |
155 |
159 |
156 ) |
160 ) |
157 ) |
161 ) |
158 ! ! |
162 ! ! |
159 |
163 |
160 !CriticsWindow class methodsFor:'plugIn spec'! |
164 !CriticsWindow class methodsFor:'plugIn spec'! |
221 ! ! |
225 ! ! |
222 |
226 |
223 !CriticsWindow methodsFor:'actions'! |
227 !CriticsWindow methodsFor:'actions'! |
224 |
228 |
225 browseLintRule |
229 browseLintRule |
226 |rule ruleClass sel| |
230 |rule ruleClass| |
227 |
231 |
228 rule := self ruleHolder value. |
232 rule := self ruleHolder value. |
229 rule isNil ifTrue:[^ self]. |
233 rule isNil ifTrue:[^ self]. |
230 ruleClass := rule class. |
234 ruleClass := rule class. |
231 (ruleClass implements:#rationale) ifTrue:[ |
|
232 sel := #rationale. |
|
233 ]. |
|
234 self close. |
235 self close. |
235 UserPreferences current systemBrowserClass |
236 UserPreferences current systemBrowserClass |
236 openInClass:ruleClass selector:sel. |
237 openInClass:ruleClass selector:#rationale |
237 |
238 |
238 "Created: / 07-09-2011 / 04:09:38 / cg" |
239 "Created: / 07-09-2011 / 04:09:38 / cg" |
239 "Modified: / 31-01-2012 / 11:30:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
240 "Modified: / 31-01-2012 / 11:30:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
240 ! |
241 ! |
241 |
242 |
248 RBBuiltinRuleSet rulesetBuiltinDefault reject:[:r | r class == rule class]. |
249 RBBuiltinRuleSet rulesetBuiltinDefault reject:[:r | r class == rule class]. |
249 self close. |
250 self close. |
250 ! |
251 ! |
251 |
252 |
252 doQuickFix: quickFixNo |
253 doQuickFix: quickFixNo |
253 |
|
254 self closeDownViews. |
254 self closeDownViews. |
255 [ fixer performFix: quickFixNo ] fork. |
255 "/ cg: why fork here? |
|
256 "[" fixer performFix: quickFixNo "] fork". |
256 |
257 |
257 "Created: / 16-02-2012 / 14:19:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
258 "Created: / 16-02-2012 / 14:19:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
258 ! ! |
259 ! ! |
259 |
260 |
260 !CriticsWindow methodsFor:'aspects'! |
261 !CriticsWindow methodsFor:'aspects'! |
308 |
309 |
309 (holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
310 (holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
310 holder := BlockValue |
311 holder := BlockValue |
311 with:[:h | |
312 with:[:h | |
312 "/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) |
313 "/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) |
313 ('Browse "',h name,'"-Rule (',h class name,')' "displayString") |
314 (('Browse Rule Class (',h class name,')' "displayString") |
314 colorizeAllWith: Color blue; |
315 colorizeAllWith: Color blue) |
315 actionForAll:[ self browseLintRule] |
316 actionForAll:[ self browseLintRule] |
316 ] |
317 ] |
317 argument: self ruleHolder. |
318 argument: self ruleHolder. |
318 builder aspectAt:#ruleNameAspect put:holder. |
319 builder aspectAt:#ruleNameAspect put:holder. |
319 ]. |
320 ]. |
333 |
334 |
334 "Modified (format): / 01-02-2012 / 10:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
335 "Modified (format): / 01-02-2012 / 10:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
335 ! ! |
336 ! ! |
336 |
337 |
337 !CriticsWindow methodsFor:'change & update'! |
338 !CriticsWindow methodsFor:'change & update'! |
|
339 |
|
340 printHTMLForFixesOn:aStream |
|
341 "/ fixer printHtmlOn: s. |
|
342 |
|
343 |fixes| |
|
344 |
|
345 (fixes := fixer fixes) isEmptyOrNil ifTrue:[ ^ self ]. |
|
346 |
|
347 aStream nextPutAll: '<p>'. |
|
348 fixes size > 1 ifTrue:[ |
|
349 aStream nextPutAll: '<br>'. |
|
350 aStream nextPutLine: 'Possible fixes:'. |
|
351 ]. |
|
352 aStream nextPutLine:'<ul indent="0">'. |
|
353 fixes withIndexDo:[:fix :index| |
|
354 aStream |
|
355 nextPutAll:'<li><a action="doit: self doQuickFix:'; |
|
356 nextPutAll: index printString; |
|
357 nextPutAll:'">'; |
|
358 nextPutAll: fix label; |
|
359 nextPutAll:'</a></li>'. |
|
360 ]. |
|
361 aStream nextPutLine:'</ul>'. |
|
362 ! |
338 |
363 |
339 update:something with:aParameter from:changedObject |
364 update:something with:aParameter from:changedObject |
340 "Invoked when an object that I depend upon sends a change notification." |
365 "Invoked when an object that I depend upon sends a change notification." |
341 |
366 |
342 changedObject == ruleHolder ifTrue:[ |
367 changedObject == ruleHolder ifTrue:[ |
360 html := String streamContents:[:s| |
385 html := String streamContents:[:s| |
361 s |
386 s |
362 nextPutAll: rule name; |
387 nextPutAll: rule name; |
363 nextPutAll:'<P>'; |
388 nextPutAll:'<P>'; |
364 nextPutLine: rule rationale. |
389 nextPutLine: rule rationale. |
365 fixer printHtmlOn: s. |
390 self printHTMLForFixesOn:s. |
|
391 "/ fixer printHtmlOn: s. |
366 ] |
392 ] |
367 ]. |
393 ]. |
368 |
394 |
369 self ruleRationaleAndFixesHTMLHolder value: html |
395 self ruleRationaleAndFixesHTMLHolder value: html |
370 |
396 |
407 |
433 |
408 aBuilder window allViewBackground:(aBuilder window viewBackground). |
434 aBuilder window allViewBackground:(aBuilder window viewBackground). |
409 |
435 |
410 entered := false. |
436 entered := false. |
411 self updateRationaleAndFixes. |
437 self updateRationaleAndFixes. |
412 aBuilder window |
438 aBuilder window beSlave. |
413 "windowGroup: codeView windowGroup;" |
|
414 bePopUpView; |
|
415 beSlave. |
|
416 |
439 |
417 "Created: / 03-04-2011 / 10:45:10 / Jan Vrany " |
440 "Created: / 03-04-2011 / 10:45:10 / Jan Vrany " |
418 "Modified: / 16-02-2012 / 14:14:07 / Jan Vrany " |
441 "Modified: / 16-02-2012 / 14:14:07 / Jan Vrany " |
419 ! |
442 ! |
420 |
443 |