Tools__BackgroundSourceProcessingService.st
changeset 14053 08f7da1dd758
parent 13881 ceebd29ba8f6
child 14054 1931f75c8318
equal deleted inserted replaced
14052:ebcdddd89b02 14053:08f7da1dd758
   163 !BackgroundSourceProcessingService methodsFor:'initialization'!
   163 !BackgroundSourceProcessingService methodsFor:'initialization'!
   164 
   164 
   165 initialize
   165 initialize
   166     job := (Smalltalk at:#BackgroundJob) 
   166     job := (Smalltalk at:#BackgroundJob) 
   167                 named:self defaultJobName
   167                 named:self defaultJobName
   168                 on:[
   168                 on:[self processSafely: true]
   169                     Error handle:[:ex |
       
   170                         (Dialog confirm:('Error while processing source:\\',ex description,'\\Debug ?') withCRs)
       
   171                         ifTrue:[
       
   172                             ex reject.
       
   173                         ]
       
   174                     ] do:[
       
   175                         self process:true
       
   176                     ]
       
   177                 ].
       
   178 
   169 
   179     "Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   170     "Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   180     "Modified: / 24-01-2012 / 12:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   181     "Modified: / 19-07-2012 / 16:17:21 / cg"
   171     "Modified: / 19-07-2012 / 16:17:21 / cg"
       
   172     "Modified: / 25-02-2014 / 19:58:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   182 ! !
   173 ! !
   183 
   174 
   184 !BackgroundSourceProcessingService methodsFor:'processing'!
   175 !BackgroundSourceProcessingService methodsFor:'processing'!
   185 
   176 
   186 process
   177 process
   212     "Created: / 24-01-2012 / 12:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   203     "Created: / 24-01-2012 / 12:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   213     "Modified: / 05-06-2012 / 23:58:20 / cg"
   204     "Modified: / 05-06-2012 / 23:58:20 / cg"
   214 !
   205 !
   215 
   206 
   216 process: delayed
   207 process: delayed
   217     "Do the real source processing. If delayed is true, actuall data update must
   208     "Actually process source code. If `delayed` is true, view should be updated
   218      be done within the event queue using #pushUserEvent:...
   209      asynchronously using #pushUserEvent:. Individual services should override
       
   210      this method.
       
   211 
       
   212      NOTE: Do not call this method from custom code directly, always call
       
   213      #processSafely: which handle possible errors and protect against
       
   214      'debugger bomb'
   219      "
   215      "
   220 
   216 
   221     self subclassResponsibility
   217     self subclassResponsibility
   222 
   218 
   223     "Created: / 24-01-2012 / 12:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   219     "Created: / 24-01-2012 / 12:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   220     "Modified (comment): / 25-02-2014 / 19:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   221 !
       
   222 
       
   223 processSafely: delayed
       
   224     "Process source code. If `delayed` is true, view should be updated
       
   225      asynchronously using #pushUserEvent:"
       
   226 
       
   227     Exception , HaltInterrupt handle:[:ex|
       
   228         "/ Kludge...    
       
   229         (codeView topView class == DebugView) ifTrue:[
       
   230             Transcript showCR: 'Error when processing source code'.
       
   231             ex suspendedContext fullPrintAllOn: Transcript.
       
   232         ] ifFalse:[
       
   233             (Dialog confirm:('Error while processing source:\\',ex description,'\\Debug ?') withCRs) ifTrue:[
       
   234                 ex reject.
       
   235             ]
       
   236         ]
       
   237     ] do:[
       
   238         self process: delayed
       
   239     ]
       
   240 
       
   241     "Created: / 25-02-2014 / 19:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   224 ! !
   242 ! !
   225 
   243 
   226 !BackgroundSourceProcessingService methodsFor:'registering'!
   244 !BackgroundSourceProcessingService methodsFor:'registering'!
   227 
   245 
   228 registerIn: aCodeView
   246 registerIn: aCodeView
   234 ! !
   252 ! !
   235 
   253 
   236 !BackgroundSourceProcessingService class methodsFor:'documentation'!
   254 !BackgroundSourceProcessingService class methodsFor:'documentation'!
   237 
   255 
   238 version
   256 version
   239     ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.4 2014-02-05 19:09:08 cg Exp $'
   257     ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.5 2014-02-25 20:04:27 vrany Exp $'
   240 !
   258 !
   241 
   259 
   242 version_CVS
   260 version_CVS
   243     ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.4 2014-02-05 19:09:08 cg Exp $'
   261     ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.5 2014-02-25 20:04:27 vrany Exp $'
   244 ! !
   262 ! !
   245 
   263