Tools__BackgroundSourceProcessingService.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 04:00:37 +0200
changeset 18220 d1ebaddf1100
parent 17717 13cd6ef0aeb8
child 18363 89b39d823747
permissions -rw-r--r--
#UI_ENHANCEMENT by cg class: Tools::CheckinInfoDialog class changed: #windowSpec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     1
"
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     3
              All Rights Reserved
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     4
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     5
 This software is furnished under a license and may be used
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     6
 only in accordance with the terms of that license and with the
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
     9
 other person.  No title to or ownership of the software is
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    10
 hereby transferred.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    11
"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    12
"{ Package: 'stx:libtool' }"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    13
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    14
"{ NameSpace: Tools }"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    15
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    16
CodeViewService subclass:#BackgroundSourceProcessingService
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    17
	instanceVariableNames:'job done modified'
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    18
	classVariableNames:''
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    19
	poolDictionaries:''
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    20
	category:'Interface-CodeView'
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    21
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    22
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    23
!BackgroundSourceProcessingService class methodsFor:'documentation'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    24
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    25
copyright
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    26
"
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    27
 COPYRIGHT (c) 2006 by eXept Software AG
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    28
              All Rights Reserved
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    29
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    30
 This software is furnished under a license and may be used
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    31
 only in accordance with the terms of that license and with the
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    34
 other person.  No title to or ownership of the software is
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    35
 hereby transferred.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    36
"
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    37
!
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    38
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    39
documentation
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    40
"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    41
    An abstract base class for all services that process current
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    42
    (displayed) source code. All processing is done in background
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    43
    job, that is restarted whenever a text in the editor is changed.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    44
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    45
    [author:]
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    46
        Jan Vrany <jan.vrany@fit.cvut.cz>
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    47
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    48
    [instance variables:]
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    49
        job         <BackgroundJob> A background job.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    50
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    51
    [class variables:]
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    52
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    53
    [see also:]
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    54
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    55
"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    56
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    57
16190
15debc59b353 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 15732
diff changeset
    58
!BackgroundSourceProcessingService class methodsFor:'queries'!
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    59
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    60
isAbstract
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    61
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    62
    ^self == Tools::BackgroundSourceProcessingService
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    63
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    64
    "Created: / 24-01-2012 / 12:27:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    65
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    66
16763
54beb079381d #OTHER by mawalch
mawalch
parents: 16435
diff changeset
    67
!BackgroundSourceProcessingService methodsFor:'accessing-defaults'!
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    68
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    69
defaultJobName
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    70
    "Returns a human-readable job name, to ease identification in process browser"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    71
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    72
    ^ 'CodeView2''s source processing job'
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    73
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    74
    "Created: / 24-01-2012 / 12:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    75
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    76
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    77
!BackgroundSourceProcessingService methodsFor:'change & update'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    78
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    79
modelChanged
15501
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    80
    "Model has changed (i.e. value holder keeping displayed text"
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    81
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    82
    self sourceChanged: true
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    83
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    84
    "Created: / 17-03-2012 / 15:45:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    85
!
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    86
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    87
sourceChanged:force
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    88
    "Called when codeview's text changes"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    89
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
    90
    (force or:[codeView reallyModified]) ifTrue:[
15501
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    91
        self process.
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    92
        "/ cg: tried to avoid multiple processing,
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    93
        "/ but it seems to not help - still doing multiple
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    94
        "/ when clicking on a new method in a mixed-class-method list
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    95
        "/ (one for the method-class, one for the source)
46e2abb0c3e2 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
    96
        "/ codeView sensor enqueueMessage:#process for:self arguments:nil "/  self process
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    97
    ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    98
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    99
    "Modified: / 22-08-2011 / 13:51:53 / cg"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   100
    "Modified (format): / 05-09-2011 / 05:06:40 / cg"
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   101
    "Modified: / 17-03-2012 / 16:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   102
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   103
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   104
update:aspect with:param from:sender 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   105
    textView notNil ifTrue:[
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   106
        "/sender == textView modifiedChannel ifTrue:[^self codeChanged: false].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   107
        sender == textView model ifTrue:[
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   108
            sender value ~= textView contents ifTrue:[
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   109
                self modelChanged.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   110
                ^self.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   111
            ].
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   112
        ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   113
        (sender == textView and:[aspect == #sizeOfContents]) ifTrue:[
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   114
            self sourceChanged:true.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   115
            ^self.
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   116
        ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   117
    ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   118
    codeView notNil ifTrue:[
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   119
        sender == codeView languageHolder ifTrue:[
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   120
            self sourceChanged:true.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   121
            ^self
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   122
        ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   123
        sender == codeView classHolder ifTrue:[
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   124
            self sourceChanged:true.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   125
            ^self
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   126
        ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   127
    ].
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   128
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   129
    aspect == #codeAspect ifTrue:[
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   130
        self sourceChanged:true.
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   131
        ^self
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   132
    ].
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   133
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   134
    super 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   135
        update:aspect
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   136
        with:param
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   137
        from:sender
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   138
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   139
    "Created: / 06-03-2010 / 19:38:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   140
    "Modified: / 13-09-2011 / 12:00:29 / cg"
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   141
    "Modified: / 22-02-2012 / 15:02:16 / jv"
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   142
    "Modified: / 15-04-2013 / 23:00:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   143
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   144
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   145
!BackgroundSourceProcessingService methodsFor:'event handling'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   146
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   147
linesDeletedFrom:start to:end 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   148
    self sourceChanged:true
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   149
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   150
    "Created: / 06-07-2011 / 17:14:36 / jv"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   151
    "Created: / 16-09-2011 / 15:18:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   152
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   153
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   154
linesInsertedFrom:start to:end 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   155
    self sourceChanged:true
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   156
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   157
    "Created: / 06-07-2011 / 17:14:36 / jv"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   158
    "Created: / 16-09-2011 / 15:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   159
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   160
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   161
linesModifiedFrom:start to:end 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   162
    self sourceChanged:true
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   163
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   164
    "Created: / 06-07-2011 / 17:14:36 / jv"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   165
    "Created: / 16-09-2011 / 15:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   166
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   167
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   168
!BackgroundSourceProcessingService methodsFor:'initialization'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   169
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   170
initialize
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   171
    job := (Smalltalk at:#BackgroundJob) 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   172
                named:self defaultJobName
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   173
                on:[self processSafely: true]
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   174
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   175
    "Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11618
29842c419b87 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 11558
diff changeset
   176
    "Modified: / 19-07-2012 / 16:17:21 / cg"
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   177
    "Modified: / 25-02-2014 / 19:58:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   178
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   179
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   180
!BackgroundSourceProcessingService methodsFor:'processing'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   181
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   182
process
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   183
    "(Re)starts the processing job. Should be called whenever a source 
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   184
     must be (re)processed."
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   185
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   186
    | prio browser |
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   187
17717
13cd6ef0aeb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17356
diff changeset
   188
    "/ this clobbers the codeView's modified state; 
13cd6ef0aeb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17356
diff changeset
   189
    "/ therefore, we have to remember this info somewhere ...
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   190
    (browser := codeView browser) notNil ifTrue:[
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   191
        textView modified ifTrue:[
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   192
            browser navigationState realModifiedState: true
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   193
        ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   194
        textView modifiedChannel setValue:false.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   195
    ].
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   196
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   197
    job scheduled ifTrue:[
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   198
        job running ifFalse:[
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   199
            "/ process already created, but did not get a change to start yet;
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   200
            ^ self
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   201
        ].
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   202
        job stop.
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   203
    ].
17165
4089fe579338 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 16763
diff changeset
   204
    prio := (Processor activePriority - 1) min:Processor userBackgroundPriority.
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   205
    job startWithPriority: prio.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   206
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   207
    "Modified: / 07-07-2011 / 12:26:12 / Jan Vrany <jan.vrant@fit.cvut,cz>"
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   208
    "Created: / 24-01-2012 / 12:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   209
    "Modified: / 05-06-2012 / 23:58:20 / cg"
17717
13cd6ef0aeb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17356
diff changeset
   210
    "Modified (format): / 21-10-2017 / 13:12:54 / cg"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   211
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   212
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   213
process: delayed
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   214
    "Actually process source code. If `delayed` is true, view should be updated
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   215
     asynchronously using #pushUserEvent:. Individual services should override
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   216
     this method.
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   217
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   218
     NOTE: Do not call this method from custom code directly, always call
17717
13cd6ef0aeb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17356
diff changeset
   219
     #processSafely: which handles possible errors and protects against 'debugger bomb'"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   220
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   221
    self subclassResponsibility
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   222
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   223
    "Created: / 24-01-2012 / 12:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   224
    "Modified (comment): / 25-02-2014 / 19:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
17717
13cd6ef0aeb8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 17356
diff changeset
   225
    "Modified (comment): / 21-10-2017 / 13:17:48 / cg"
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   226
!
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   227
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   228
processSafely: delayed
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   229
    "Process source code. If `delayed` is true, view should be updated
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   230
     asynchronously using #pushUserEvent:"
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   231
16435
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   232
    DebugView 
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   233
        withOptionToIgnoreException:(BreakPointInterrupt,HaltInterrupt,Error) 
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   234
        do:[
17356
c3f338f412b9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 17165
diff changeset
   235
            (Error , ControlInterrupt) handle:[:ex|
16435
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   236
                "/ Kludge...    
17356
c3f338f412b9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 17165
diff changeset
   237
                (codeView topView notNil and:[codeView topView isDebugView]) ifTrue:[
c3f338f412b9 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 17165
diff changeset
   238
                    Transcript showCR: 'Error/Interrupt when processing source code'.
16435
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   239
                    ex suspendedContext fullPrintAllOn: Transcript.
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   240
                    ex return.
15732
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   241
                ].
16435
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   242
                ex reject "/ go ask for debugging
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   243
            ] do:[
0f3c8e9f8c63 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
   244
                self process: delayed
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   245
            ]
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   246
        ]
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   247
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   248
    "Created: / 25-02-2014 / 19:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
15562
97647e9841b7 Ignore also BreakpointInterrupt in #processSafely:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15501
diff changeset
   249
    "Modified: / 27-03-2015 / 15:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   250
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   251
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   252
!BackgroundSourceProcessingService methodsFor:'registering'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   253
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   254
registerIn: aCodeView
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   255
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   256
    super registerIn: aCodeView.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   257
    textView addDependent: self.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   258
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   259
    "Created: / 27-07-2011 / 13:25:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14493
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   260
!
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   261
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   262
unregister
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   263
    job stop.
14704
5de671ef2e61 Fix in Tools::BackgroundSourceProcessingService>>unregister: remove itself from
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14493
diff changeset
   264
    textView removeDependent: self.     
14493
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   265
    super unregister.
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   266
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   267
    "Created: / 13-06-2014 / 15:36:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14704
5de671ef2e61 Fix in Tools::BackgroundSourceProcessingService>>unregister: remove itself from
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14493
diff changeset
   268
    "Modified: / 08-08-2014 / 06:57:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   269
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   270
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   271
!BackgroundSourceProcessingService class methodsFor:'documentation'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   272
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   273
version
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   274
    ^ '$Header$'
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   275
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   276
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   277
version_CVS
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   278
    ^ '$Header$'
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   279
! !
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   280