VDBThreadPresenter.st
changeset 197 a4f790013a99
parent 60 bcdb393c956f
child 207 27e7fa4229b3
equal deleted inserted replaced
196:0f0e6f8c49d7 197:a4f790013a99
     1 "
     1 "
     2 jv:vdb - Visual / VM Debugger
     2 jv:vdb - Visual / VM Debugger
     3 Copyright (C) 2015-now Jan Vrany
     3 Copyright (C) 2015-now Jan Vrany
       
     4 Copyright (C) 2020 LabWare
     4 
     5 
     5 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
     6 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
     6 
     7 
     7 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
     8 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
     8 "
     9 "
    21 
    22 
    22 copyright
    23 copyright
    23 "
    24 "
    24 jv:vdb - Visual / VM Debugger
    25 jv:vdb - Visual / VM Debugger
    25 Copyright (C) 2015-now Jan Vrany
    26 Copyright (C) 2015-now Jan Vrany
       
    27 Copyright (C) 2020 LabWare
    26 
    28 
    27 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
    29 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
    28 
    30 
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    31 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
    30 "
    32 "
       
    33 ! !
       
    34 
       
    35 !VDBThreadPresenter class methodsFor:'menu specs'!
       
    36 
       
    37 contextMenu
       
    38     "This resource specification was automatically generated
       
    39      by the MenuEditor of ST/X."
       
    40 
       
    41     "Do not manually edit this!! If it is corrupted,
       
    42      the MenuEditor may not be able to read the specification."
       
    43 
       
    44 
       
    45     "
       
    46      MenuEditor new openOnClass:VDBThreadPresenter andSelector:#contextMenu
       
    47      (Menu new fromLiteralArrayEncoding:(VDBThreadPresenter contextMenu)) startUp
       
    48     "
       
    49 
       
    50     <resource: #menu>
       
    51 
       
    52     ^ 
       
    53      #(Menu (
       
    54          (MenuItem
       
    55             enabled: canCopyBacktrace
       
    56             label: 'Copy Backtrace To Clipboard'
       
    57             itemValue: doCopyBacktraceToClipboard
       
    58             isVisible: true
       
    59          )
       
    60        ) nil
       
    61         nil
       
    62      )
    31 ! !
    63 ! !
    32 
    64 
    33 !VDBThreadPresenter methodsFor:'accessing'!
    65 !VDBThreadPresenter methodsFor:'accessing'!
    34 
    66 
    35 icon
    67 icon
    73 
   105 
    74     "Created: / 21-09-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   106     "Created: / 21-09-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    75     "Modified: / 12-07-2017 / 14:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   107     "Modified: / 12-07-2017 / 14:21:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    76 ! !
   108 ! !
    77 
   109 
       
   110 !VDBThreadPresenter methodsFor:'menu actions'!
       
   111 
       
   112 doCopyBacktraceToClipboard
       
   113     | backtrace |
       
   114 
       
   115     backtrace := String streamContents:[:s|
       
   116         thread stack 
       
   117             do: [:frame | frame dumpOn: s ]
       
   118             separatedBy: [ s cr; nextPutAll: '--'; cr ]       
       
   119     ].
       
   120     self doCopy: backtrace
       
   121 
       
   122     "Modified: / 09-08-2020 / 07:15:42 / Jan Vrany <jan.vrany@labware.com>"
       
   123 ! !
       
   124 
       
   125 !VDBThreadPresenter methodsFor:'menu queries'!
       
   126 
       
   127 canCopyBacktrace
       
   128     ^ [ thread isStopped ]
       
   129 
       
   130     "Modified: / 09-08-2020 / 07:01:35 / Jan Vrany <jan.vrany@labware.com>"
       
   131 ! !
       
   132 
    78 !VDBThreadPresenter methodsFor:'protocol-accessing'!
   133 !VDBThreadPresenter methodsFor:'protocol-accessing'!
    79 
   134 
    80 fetchChildren
   135 fetchChildren
    81     "should compute the list of children via the model.
   136     "should compute the list of children via the model.
    82      Be aware, that the somewhat stupid 'optimization' of how the model is fetched may lead to
   137      Be aware, that the somewhat stupid 'optimization' of how the model is fetched may lead to