Tools__LintService.st
branchjv
changeset 12205 f210b6224ef0
parent 12128 a7ff7d66ee85
child 12206 927183c7da24
--- a/Tools__LintService.st	Wed Mar 21 14:05:42 2012 +0000
+++ b/Tools__LintService.st	Wed Mar 21 17:50:14 2012 +0000
@@ -27,7 +27,7 @@
 
 "{ NameSpace: Tools }"
 
-CodeViewService subclass:#LintService
+Tools::CodeViewService subclass:#LintService
 	instanceVariableNames:'ruleHolderFromApp highlighter'
 	classVariableNames:''
 	poolDictionaries:''
@@ -78,19 +78,20 @@
 !LintService methodsFor:'accessing'!
 
 syntaxHighlighter
-
     | app rules |
 
-    ((app :=codeView application) respondsTo: #selectedLintRules) ifTrue:[
+    app := codeView application.
+    app notNil ifTrue:[
         rules := self ruleHolderFromApp value.
-        rules isEmptyOrNil not ifTrue:[
+        rules notEmptyOrNil ifTrue:[
             highlighter rules: rules.
-            ^highlighter
-        ]
+            ^ highlighter
+        ].
     ].
     ^nil
 
     "Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-03-2012 / 01:23:48 / cg"
 ! !
 
 !LintService methodsFor:'aspects'!
@@ -98,11 +99,18 @@
 ruleHolderFromApp
     "return/create the 'ruleHolderFromApp' value holder (automatically generated)"
 
+    |app|
+
     ruleHolderFromApp isNil ifTrue:[
-        ruleHolderFromApp := ValueHolder new.
-        ruleHolderFromApp addDependent:self.
+        (app := self application) notNil ifTrue:[
+            self fetchLintRuleHolder
+            "/ ruleHolderFromApp := ValueHolder new.
+            "/ ruleHolderFromApp addDependent:self.
+        ].
     ].
     ^ ruleHolderFromApp
+
+    "Modified: / 08-03-2012 / 01:17:15 / cg"
 !
 
 ruleHolderFromApp:something
@@ -127,13 +135,16 @@
 !LintService methodsFor:'change & update'!
 
 update: aspect with: param from: sender
-
-
-    sender == ruleHolderFromApp ifTrue:[
-        self syntaxHighlight: true
-    ]
+    aspect == #sizeOfView ifFalse:[
+        sender == ruleHolderFromApp ifTrue:[
+            self syntaxHighlight: true.
+            ^ self.
+        ]
+    ].
+    super update: aspect with: param from: sender.
 
     "Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-03-2012 / 17:16:59 / cg"
 ! !
 
 !LintService methodsFor:'initialization'!
@@ -163,27 +174,43 @@
 
 !LintService methodsFor:'registering'!
 
+fetchLintRuleHolder
+    |app|
+
+    app := self application.
+    app notNil ifTrue:[
+        "/ bad design; better idea would be to pass the lintRuleHolder back from the
+        "/ application to me explicitely (in a postBuild method for some ruleCanvas of the app)
+        (app respondsTo: #selectedLintRules) ifTrue:[
+            self ruleHolderFromApp: app selectedLintRules
+        ] ifFalse:[
+            self breakPoint:#jv.
+            "/ Transcript showCR:'LintService [info]: app does not provide a lintRuleHolder'
+        ]
+    ].
+
+    "Created: / 08-03-2012 / 01:16:38 / cg"
+!
+
 registerIn: aCodeView
-
     super registerIn: aCodeView.
-    (self application respondsTo: #selectedLintRules) ifTrue:[
-        self ruleHolderFromApp: self application selectedLintRules
-    ].
+    self fetchLintRuleHolder.
 
     "Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Created: / 05-08-2011 / 11:47:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-03-2012 / 01:16:51 / cg"
 ! !
 
 !LintService class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Tools__LintService.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.6 2012/03/12 18:20:05 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.2 2012/01/27 21:18:53 vrany Exp §'
+    ^ '§Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.6 2012/03/12 18:20:05 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: Tools__LintService.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+    ^ '$Id: Tools__LintService.st 7952 2012-03-21 17:50:14Z vranyj1 $'
 ! !