VDBThreadPresenter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 23 Nov 2017 22:45:57 +0000
changeset 49 2ec7f7ed9242
parent 45 cd9f46746fd1
child 60 bcdb393c956f
permissions -rw-r--r--
License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     1
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     2
jv:vdb - Visual / VM Debugger
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     4
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     5
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     6
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     7
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
     8
"
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
"{ Package: 'jv:vdb' }"
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
38
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    11
"{ NameSpace: Smalltalk }"
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    12
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
VDBModelPresenter subclass:#VDBThreadPresenter
45
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    14
	instanceVariableNames:'thread name'
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
	classVariableNames:''
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
	poolDictionaries:''
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
	category:'VDB-Presentation'
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
!
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
49
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    20
!VDBThreadPresenter class methodsFor:'documentation'!
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    21
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    22
copyright
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    23
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    24
jv:vdb - Visual / VM Debugger
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    25
Copyright (C) 2015-now Jan Vrany
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    26
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    27
This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    28
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    29
You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    30
"
2ec7f7ed9242 License this package under 'Creative Commons Attribution-NonCommercial 4.0 International License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 45
diff changeset
    31
! !
38
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    32
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    33
!VDBThreadPresenter methodsFor:'accessing'!
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
24
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    35
icon
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    36
    thread isRunning ifTrue:[ ^ VDBIconLibrary threadRunning16x16 ].
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    37
    thread isStopped ifTrue:[ ^ VDBIconLibrary threadStopped16x16 ].
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    38
    thread isTerminated ifTrue:[ ^ VDBIconLibrary threadTerminated16x16 ].
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    39
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    40
    ^ nil
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    41
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    42
    "Created: / 22-09-2014 / 22:00:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    43
!
c33a063cb363 Added icons from Eclipse.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    44
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    45
label
45
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    46
    name isNil ifTrue:[ 
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    47
        thread isRunning ifFalse:[
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    48
            name := thread name.
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    49
        ]
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    50
    ].
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    51
    ^ '%1 [%2]' bindWith: (name notNil ifTrue:[name] ifFalse:['thread ' , thread id printString]) with: thread status
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    53
    "Created: / 22-09-2014 / 00:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
45
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    54
    "Modified: / 12-07-2017 / 14:23:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    55
!
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    56
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    57
thread
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    58
    ^ thread
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
! !
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
!VDBThreadPresenter methodsFor:'initialization'!
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
setThread: aGDBThread
45
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    64
    thread := aGDBThread.
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    "Created: / 21-09-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
45
cd9f46746fd1 Cache the thread name
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 38
diff changeset
    67
    "Modified: / 12-07-2017 / 14:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
! !
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
!VDBThreadPresenter methodsFor:'protocol-accessing'!
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
fetchChildren
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    "should compute the list of children via the model.
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
     Be aware, that the somewhat stupid 'optimization' of how the model is fetched may lead to
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
     a O(n*log n) or even O(n^2) behavior here.
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
     *** to optimize: redefine by subClass"
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    78
     thread isDead ifTrue:[ ^ #() ].
31
00f6de198c7f Minor fixes in the UI - redraw stack list when execution state changes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 24
diff changeset
    79
     thread isRunning ifTrue:[ ^ #() ].
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    80
     ^ thread stack collect:[ :f | VDBFramePresenter new setFrame: f; parent: self ]
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    "Created: / 21-09-2014 / 23:42:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
31
00f6de198c7f Minor fixes in the UI - redraw stack list when execution state changes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 24
diff changeset
    83
    "Modified: / 30-09-2014 / 00:04:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
! !
6684f4d82301 Temporary commit: reworking VDBStackApplication to support multiple threads and inferiors
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
23
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    86
!VDBThreadPresenter methodsFor:'testing'!
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    87
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    88
isThreadPresenter
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    89
    ^ true
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    90
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    91
    "Created: / 21-09-2014 / 23:54:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    92
! !
ed5f4b55cee5 Added toolbar and icons. Show all thread groups and threads in stack view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
    93
38
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    94
!VDBThreadPresenter class methodsFor:'documentation'!
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    95
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    96
version_HG
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    97
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    98
    ^ '$Changeset: <not expanded> $'
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    99
! !
9b861cb882c8 Show al thread groupd, even terminated ones
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
   100