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