Tools__BackgroundSourceProcessingService.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 26 Mar 2016 07:59:34 +0000
branchjv
changeset 16213 f667b5b42a11
parent 15733 332bb9af57e1
parent 16190 15debc59b353
child 16445 6bc184e74f9c
permissions -rw-r--r--
Merge
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
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
    67
!BackgroundSourceProcessingService methodsFor:'acessing-defaults'!
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
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   188
    "/ this clobbers the codeViews modified state; therefore, we have to remember
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   189
    "/ 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
    ].
11558
0e93cd2b9c48 fixed process priorities
Claus Gittinger <cg@exept.de>
parents: 11183
diff changeset
   204
    prio := 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"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   210
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   211
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   212
process: delayed
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   213
    "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
   214
     asynchronously using #pushUserEvent:. Individual services should override
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   215
     this method.
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   216
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   217
     NOTE: Do not call this method from custom code directly, always call
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   218
     #processSafely: which handle possible errors and protect against
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   219
     'debugger bomb'
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   220
     "
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   221
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   222
    self subclassResponsibility
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   223
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   224
    "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
   225
    "Modified (comment): / 25-02-2014 / 19:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
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
15562
97647e9841b7 Ignore also BreakpointInterrupt in #processSafely:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15501
diff changeset
   232
    Error , HaltInterrupt , BreakPointInterrupt handle:[:ex|
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   233
        |msg|
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   234
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   235
        "/ Kludge...    
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   236
        (codeView topView class == DebugView) ifTrue:[
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   237
            Transcript showCR: 'Error when processing source code'.
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   238
            ex suspendedContext fullPrintAllOn: Transcript.
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   239
        ] ifFalse:[
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   240
            (ControlInterrupt accepts:ex creator) ifTrue:[
15732
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   241
                "/ also deal with ignored breakpoints here;
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   242
                "/ otherwise, it is almost impossible to place a breakpoint into
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   243
                "/ RB-code, and ignoring it...
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   244
                (DebugView 
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   245
                    isHaltToBeIgnoredIn:(ex suspendedContext method)
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   246
                    atLineNr:1
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   247
                    context:(ex suspendedContext)
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   248
                    modifyEntryCount:false
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   249
                ) ifTrue:[
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   250
                    Transcript showCR:'breakpoint ignored in background processing'.
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   251
                    ^ ex proceed.
a40158f53779 class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15731
diff changeset
   252
                ].
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   253
                msg := ('Halt/Breakpoint while processing source:\',ex description allBold,'\\in: ',ex suspendedContext printString,'\\Debug ?')
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   254
            ] ifFalse:[
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   255
                msg := ('Error while processing source:\',ex description allBold,'\\in: ',ex suspendedContext printString,'\\Debug ?')
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   256
            ].
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   257
            (Dialog confirm:msg withCRs) ifTrue:[
14053
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   258
                ex reject.
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   259
            ]
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   260
        ]
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   261
    ] do:[
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   262
        self process: delayed
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   263
    ]
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   264
08f7da1dd758 Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13881
diff changeset
   265
    "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
   266
    "Modified: / 27-03-2015 / 15:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   267
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   268
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   269
!BackgroundSourceProcessingService methodsFor:'registering'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   270
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   271
registerIn: aCodeView
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   272
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   273
    super registerIn: aCodeView.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   274
    textView addDependent: self.
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   275
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   276
    "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
   277
!
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   278
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   279
unregister
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   280
    job stop.
14704
5de671ef2e61 Fix in Tools::BackgroundSourceProcessingService>>unregister: remove itself from
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14493
diff changeset
   281
    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
   282
    super unregister.
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   283
c2c143bf52a0 Fix in Tools::BackgroundSourceProcessingService>>unregister: stop possibly running background job
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14054
diff changeset
   284
    "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
   285
    "Modified: / 08-08-2014 / 06:57:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   286
! !
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   287
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   288
!BackgroundSourceProcessingService class methodsFor:'documentation'!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   289
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   290
version
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   291
    ^ '$Header$'
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   292
!
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   293
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   294
version_CVS
15731
f205f06960fa class: Tools::BackgroundSourceProcessingService
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
   295
    ^ '$Header$'
11183
a0ab27f5679c initial checkin
vrany
parents:
diff changeset
   296
! !
13881
ceebd29ba8f6 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11618
diff changeset
   297