Tools__LintService.st
changeset 11382 c078e68a2ffe
parent 11227 3d57003855a7
child 11389 41cbd2e426f7
equal deleted inserted replaced
11381:baba3049428c 11382:c078e68a2ffe
    76 ! !
    76 ! !
    77 
    77 
    78 !LintService methodsFor:'accessing'!
    78 !LintService methodsFor:'accessing'!
    79 
    79 
    80 syntaxHighlighter
    80 syntaxHighlighter
    81 
       
    82     | app rules |
    81     | app rules |
    83 
    82 
    84     ((app :=codeView application) respondsTo: #selectedLintRules) ifTrue:[
    83     app := codeView application.
    85         rules := self ruleHolderFromApp value.
    84     app notNil ifTrue:[
    86         rules isEmptyOrNil not ifTrue:[
    85         true "(app respondsTo: #selectedLintRules)" ifTrue:[
    87             highlighter rules: rules.
    86             rules := self ruleHolderFromApp value.
    88             ^highlighter
    87             rules notEmptyOrNil ifTrue:[
    89         ]
    88                 highlighter rules: rules.
       
    89                 ^ highlighter
       
    90             ]
       
    91         ].
    90     ].
    92     ].
    91     ^nil
    93     ^nil
    92 
    94 
    93     "Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    95     "Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    96     "Modified (format): / 07-03-2012 / 17:22:14 / cg"
    94 ! !
    97 ! !
    95 
    98 
    96 !LintService methodsFor:'aspects'!
    99 !LintService methodsFor:'aspects'!
    97 
   100 
    98 ruleHolderFromApp
   101 ruleHolderFromApp
    99     "return/create the 'ruleHolderFromApp' value holder (automatically generated)"
   102     "return/create the 'ruleHolderFromApp' value holder (automatically generated)"
   100 
   103 
       
   104     |app|
       
   105 
   101     ruleHolderFromApp isNil ifTrue:[
   106     ruleHolderFromApp isNil ifTrue:[
   102         ruleHolderFromApp := ValueHolder new.
   107         (app := self application) notNil ifTrue:[
   103         ruleHolderFromApp addDependent:self.
   108             self ruleHolderFromApp: app selectedLintRules
       
   109             "/ ruleHolderFromApp := ValueHolder new.
       
   110             "/ ruleHolderFromApp addDependent:self.
       
   111         ].
   104     ].
   112     ].
   105     ^ ruleHolderFromApp
   113     ^ ruleHolderFromApp
       
   114 
       
   115     "Modified: / 07-03-2012 / 17:20:42 / cg"
   106 !
   116 !
   107 
   117 
   108 ruleHolderFromApp:something
   118 ruleHolderFromApp:something
   109     "set the 'ruleHolderFromApp' value holder (automatically generated)"
   119     "set the 'ruleHolderFromApp' value holder (automatically generated)"
   110 
   120 
   125 ! !
   135 ! !
   126 
   136 
   127 !LintService methodsFor:'change & update'!
   137 !LintService methodsFor:'change & update'!
   128 
   138 
   129 update: aspect with: param from: sender
   139 update: aspect with: param from: sender
   130 
   140     aspect == #sizeOfView ifFalse:[
   131 
   141         sender == ruleHolderFromApp ifTrue:[
   132     sender == ruleHolderFromApp ifTrue:[
   142             self syntaxHighlight: true.
   133         self syntaxHighlight: true
   143             ^ self.
   134     ]
   144         ]
       
   145     ].
       
   146     super update: aspect with: param from: sender.
   135 
   147 
   136     "Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   148     "Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   149     "Modified: / 07-03-2012 / 17:16:59 / cg"
   137 ! !
   150 ! !
   138 
   151 
   139 !LintService methodsFor:'initialization'!
   152 !LintService methodsFor:'initialization'!
   140 
   153 
   141 initialize
   154 initialize
   162 ! !
   175 ! !
   163 
   176 
   164 !LintService methodsFor:'registering'!
   177 !LintService methodsFor:'registering'!
   165 
   178 
   166 registerIn: aCodeView
   179 registerIn: aCodeView
       
   180     |app|
   167 
   181 
   168     super registerIn: aCodeView.
   182     super registerIn: aCodeView.
   169     (self application respondsTo: #selectedLintRules) ifTrue:[
   183 
   170         self ruleHolderFromApp: self application selectedLintRules
   184     app := self application.
       
   185     app notNil ifTrue:[
       
   186         "/ bad design; better idea would be to pass the lintRuleHolder back from the
       
   187         "/ application to me explicitely (in a postBuild method for some ruleCanvas of the app)
       
   188         true "(app respondsTo: #selectedLintRules)" ifTrue:[
       
   189             self ruleHolderFromApp: app selectedLintRules
       
   190         ]
   171     ].
   191     ].
   172 
   192 
   173     "Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   193     "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>"
   194     "Created: / 05-08-2011 / 11:47:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   195     "Modified (format): / 07-03-2012 / 17:21:27 / cg"
   175 ! !
   196 ! !
   176 
   197 
   177 !LintService class methodsFor:'documentation'!
   198 !LintService class methodsFor:'documentation'!
   178 
   199 
   179 version
   200 version
   180     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.2 2012-01-27 21:18:53 vrany Exp $'
   201     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.3 2012-03-07 17:19:49 cg Exp $'
   181 !
   202 !
   182 
   203 
   183 version_CVS
   204 version_CVS
   184     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.2 2012-01-27 21:18:53 vrany Exp $'
   205     ^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.3 2012-03-07 17:19:49 cg Exp $'
   185 ! !
   206 ! !