VDBAbstractListApplication.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 08 Jun 2017 13:43:34 +0100
changeset 44 41cc5a7840fe
parent 37 f417fe8685c5
child 46 6b857f3cec8c
permissions -rw-r--r--
Debugger UI improvements * fixed exec-button enablements in main debugger UI * improved thread group (inferior) presentation to show whether it has finished or it has been terminated prematurely. * added option to flush event log in log view * added option to enable frame filters and pretty printing for VDB UI (i.e, when enabled VDB shows pretty printed values and frames in backtrace list view and frame view * use code font in both hacktrace view and frame view (code font is likely non-proportional and this makes things easier to read when pretty printer / frame decorator formats additional info in "columns" * doubleclick on variable copies the value to clipboard

"{ Package: 'jv:vdb' }"

"{ NameSpace: Smalltalk }"

VDBAbstractApplication subclass:#VDBAbstractListApplication
	instanceVariableNames:'internalListHolder internalListView internalSelectionHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Abstract'
!

!VDBAbstractListApplication class methodsFor:'interface specs'!

columnsSpec
    ^ #()

    "Created: / 02-06-2017 / 07:26:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractListApplication class methodsFor:'menu specs'!

contextMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."


    "
     MenuEditor new openOnClass:VDBStackApplication andSelector:#contextMenu
     (Menu new fromLiteralArrayEncoding:(VDBStackApplication contextMenu)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            label: 'Menu Slice'
            submenuChannel: contextMenuInspectSlice
            isMenuSlice: true
          )
         )
        nil
        nil
      )
!

contextMenuInspectSlice
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."


    "
     MenuEditor new openOnClass:VDBAbstractListApplication andSelector:#contextMenuInspectSlice
     (Menu new fromLiteralArrayEncoding:(VDBAbstractListApplication contextMenuInspectSlice)) startUp
    "

    <resource: #menu>

    ^ 
     #(Menu
        (
         (MenuItem
            enabled: hasSelection
            label: 'Inspect Model'
            itemValue: doInspectModel
          )
         (MenuItem
            label: 'Inspect Presenter'
            itemValue: doInspectPresenter
          )
         (MenuItem
            label: '-'
          )
         (MenuItem
            label: 'Update'
            itemValue: duUpdateList
          )
         )
        nil
        nil
      )
! !

!VDBAbstractListApplication class methodsFor:'queries'!

isAbstract
    "Return if this class is an abstract class.
     True is returned here for myself only; false for subclasses.
     Abstract subclasses must redefine again."

    ^ self == VDBAbstractListApplication.
! !

!VDBAbstractListApplication methodsFor:'actions'!

postBuildInternalListView: aView
    <resource: #uiCallback>

    | columns |

    internalListView := aView.
    internalListView font: CodeView defaultFont.

    columns := self class columnsSpec.
    columns notEmptyOrNil ifTrue:[
        | renderer |

        renderer := aView setupTableRenderer.
        renderer columnDescriptors: columns
    ].

    "Modified: / 11-06-2017 / 22:16:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractListApplication methodsFor:'aspects-private'!

internalListHolder
    "return/create the 'listHolder' value holder (automatically generated)"

    internalListHolder isNil ifTrue:[
        internalListHolder := ValueHolder new.
    ].
    ^ internalListHolder

    "Created: / 27-02-2015 / 15:55:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

internalSelectionHolder
    "return/create the 'internalSelectionHolder' value holder (automatically generated)"

    internalSelectionHolder isNil ifTrue:[
        internalSelectionHolder := ValueHolder new.
        internalSelectionHolder addDependent:self.
    ].
    ^ internalSelectionHolder
! !

!VDBAbstractListApplication methodsFor:'change & update'!

enqueueDelayedUpdateInternalList
    self window sensor pushUserEvent:#delayedUpdateInternalList for:self

    "Created: / 20-09-2014 / 23:05:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

enqueueDelayedUpdateSelection
    self window sensor pushUserEvent:#delayedUpdateSelection   for:self

    "Created: / 27-02-2015 / 15:35:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

update:aspect with:param from:sender
    "Invoked when an object that I depend upon sends a change notification."
    sender == internalSelectionHolder ifTrue:[ 
        self enqueueDelayedUpdateSelection.
        ^ self
    ].

    super update:aspect with:param from:sender

    "Created: / 27-02-2015 / 15:44:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractListApplication methodsFor:'change & update-delayed'!

delayedUpdateInternalList
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
!

delayedUpdateSelection
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility
! !

!VDBAbstractListApplication methodsFor:'hooks'!

commonPostOpen
    "a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:."

    self enqueueDelayedUpdateInternalList

    "Created: / 18-09-2014 / 00:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 20-09-2014 / 23:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractListApplication methodsFor:'menu'!

contextMenu
    ^ builder menuFor: #contextMenu

    "Created: / 12-06-2017 / 12:02:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBAbstractListApplication methodsFor:'menu actions'!

doInspectModel
    | selection |

    selection := self internalSelectionHolder value.
    selection notEmptyOrNil ifTrue:[ 
        selection isThreadGroupPresenter ifTrue: [ selection threadGroup inspect ].
        selection isThreadPresenter ifTrue: [ selection thread inspect ].
        selection isFramePresenter ifTrue: [ selection frame inspect ].    
        selection isVariablePresenter ifTrue: [ selection variable inspect ].    
    ].

    "Modified: / 02-06-2017 / 00:05:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

doInspectPresenter
    self internalSelectionHolder value inspect

    "Modified: / 22-09-2014 / 01:17:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

duUpdateList
    <resource: #uiCallback>

    self enqueueDelayedUpdateInternalList

    "Modified: / 12-06-2017 / 12:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !