tools/JavaLintService.st
changeset 3418 3df0a2df585e
parent 3214 c38fcee7b0da
child 3438 83b000465fe0
equal deleted inserted replaced
3417:1cde6fd1d7c7 3418:3df0a2df585e
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2006 by eXept Software AG
     4  COPYRIGHT (c) 2006 by eXept Software AG
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     8  be provided or otherwise made available to, or used by, any
    10  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    11  other person.  No title to or ownership of the software is
    10  hereby transferred.
    12  hereby transferred.
    11 "
    13 "
    12 "{ Package: 'stx:libjava/tools' }"
    14 "{ Package: 'stx:libjava/tools' }"
       
    15 
       
    16 "{ NameSpace: Smalltalk }"
    13 
    17 
    14 Tools::BackgroundSourceProcessingService subclass:#JavaLintService
    18 Tools::BackgroundSourceProcessingService subclass:#JavaLintService
    15 	instanceVariableNames:'highlighter showingJava'
    19 	instanceVariableNames:'highlighter showingJava'
    16 	classVariableNames:'Debugging'
    20 	classVariableNames:'Debugging'
    17 	poolDictionaries:''
    21 	poolDictionaries:''
   308      
   312      
   309      NOTE: Do not call this method from custom code directly, always call
   313      NOTE: Do not call this method from custom code directly, always call
   310      #processSafely: which handle possible errors and protect against
   314      #processSafely: which handle possible errors and protect against
   311      'debugger bomb'"
   315      'debugger bomb'"
   312 
   316 
       
   317     | lang |
       
   318 
   313     done := false.
   319     done := false.
   314     modified := false.
   320     modified := false.
   315 
   321 
   316     Delay waitForMilliseconds: 1000."Give user some time to finish coding"
   322     Delay waitForMilliseconds: 1000."Give user some time to finish coding"
   317 
   323     lang := codeView language.
   318                        
   324     lang isJava ifFalse:[ ^ self ].
       
   325 
   319     modified ifFalse:[
   326     modified ifFalse:[
   320         | code |
   327         | code |
   321         code := textView list asStringWithoutEmphasis.
   328         code := textView list asStringWithoutEmphasis.
   322         modified ifFalse:[
   329         code notEmptyOrNil ifTrue:[ 
   323             | problems |
   330             modified ifFalse:[
   324 
   331                 | problems |
   325             problems := JavaCompiler new check: code.
   332 
   326             modified ifFalse:[ 
   333                 problems := JavaCompiler new check: code.
   327                 highlighter problems: problems.
   334                 modified ifFalse:[ 
   328                 self rehighlight: delayed  
   335                     highlighter problems: problems.
   329             ].
   336                     self rehighlight: delayed  
   330         ]
   337                 ].
       
   338             ]
       
   339         ].
   331     ]
   340     ]
   332 
   341 
   333     "Created: / 07-08-2014 / 00:41:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   342     "Created: / 07-08-2014 / 00:41:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   343     "Modified: / 27-03-2015 / 16:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   334 ! !
   344 ! !
   335 
   345 
   336 !JavaLintService methodsFor:'redrawing'!
   346 !JavaLintService methodsFor:'redrawing'!
   337 
   347 
   338 drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg 
   348 drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg