ContextInspectorView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 19 Jul 2017 09:42:32 +0200
branchjv
changeset 17619 edb119820fcb
parent 17276 213d590bcf54
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:
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
     1
"
d904237f7c44 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
     3
	      All Rights Reserved
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
     4
d904237f7c44 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
d904237f7c44 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
d904237f7c44 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d904237f7c44 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d904237f7c44 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
d904237f7c44 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
d904237f7c44 Initial revision
claus
parents:
diff changeset
    11
"
2717
dc997032a34e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
    12
"{ Package: 'stx:libtool' }"
dc997032a34e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2271
diff changeset
    13
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
    14
"{ NameSpace: Smalltalk }"
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
    15
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    16
InspectorView subclass:#ContextInspectorView
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
    17
	instanceVariableNames:'inspectedContext names showingTemporaries argsOnly contextSize
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
    18
		workspaceVariableNamesInDoIts'
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    19
	classVariableNames:''
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    20
	poolDictionaries:''
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    21
	category:'Interface-Inspector'
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    22
!
d904237f7c44 Initial revision
claus
parents:
diff changeset
    23
785
16809b8d468c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
    24
!ContextInspectorView class methodsFor:'documentation'!
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    25
d904237f7c44 Initial revision
claus
parents:
diff changeset
    26
copyright
d904237f7c44 Initial revision
claus
parents:
diff changeset
    27
"
d904237f7c44 Initial revision
claus
parents:
diff changeset
    28
 COPYRIGHT (c) 1993 by Claus Gittinger
45
950b84ba89e6 *** empty log message ***
claus
parents: 37
diff changeset
    29
	      All Rights Reserved
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    30
d904237f7c44 Initial revision
claus
parents:
diff changeset
    31
 This software is furnished under a license and may be used
d904237f7c44 Initial revision
claus
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
d904237f7c44 Initial revision
claus
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
d904237f7c44 Initial revision
claus
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
d904237f7c44 Initial revision
claus
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
d904237f7c44 Initial revision
claus
parents:
diff changeset
    36
 hereby transferred.
d904237f7c44 Initial revision
claus
parents:
diff changeset
    37
"
d904237f7c44 Initial revision
claus
parents:
diff changeset
    38
!
d904237f7c44 Initial revision
claus
parents:
diff changeset
    39
d904237f7c44 Initial revision
claus
parents:
diff changeset
    40
documentation
d904237f7c44 Initial revision
claus
parents:
diff changeset
    41
"
471
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    42
    a modified Inspector for Contexts (used in the Debugger)
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    43
    TODO:
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    44
        when expressions are evaluated in myself, the inst-var
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    45
        names are not known by the expression evaluator.
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    46
        This has to be fixed 
114883d63124 commentary
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
    47
        (actual work is to be done in the Parser to allow passing of a context ...)
510
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    48
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    49
    [author:]
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    50
        Claus Gittinger
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    51
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    52
    [see also:]
6543e55fb227 documentation
Claus Gittinger <cg@exept.de>
parents: 471
diff changeset
    53
        Context DebugView
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    54
"
d904237f7c44 Initial revision
claus
parents:
diff changeset
    55
! !
d904237f7c44 Initial revision
claus
parents:
diff changeset
    56
d904237f7c44 Initial revision
claus
parents:
diff changeset
    57
!ContextInspectorView methodsFor:'accessing'!
d904237f7c44 Initial revision
claus
parents:
diff changeset
    58
868
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
    59
inspect:aContext
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    60
    "set the context to be inspected"
d904237f7c44 Initial revision
claus
parents:
diff changeset
    61
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
    62
    |methodHomeContext method homeNames rec sel 
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
    63
     m blockNode 
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
    64
     numVarsInSource numVarsInContext isDoIt
5803
b43e404776f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5341
diff changeset
    65
     numArgs numVars n tempNames realTempNames 
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    66
     oldSelection oldSelectedName hCon keepList newList|
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
    67
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
    68
    oldSelection := selectionIndex.
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    69
    oldSelection notNil ifTrue:[
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    70
        oldSelectedName := (self listEntryAt:oldSelection).
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    71
        oldSelectedName notNil ifTrue:[
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    72
            oldSelectedName := oldSelectedName string
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    73
        ]
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    74
    ].
49
6fe62433cfa3 *** empty log message ***
claus
parents: 45
diff changeset
    75
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    76
    keepList := ((aContext == inspectedContext)
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    77
                "/ care for contexts which change size
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    78
                "/ (after the locals & stack-setup)
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
    79
                and:[ contextSize == inspectedContext size 
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
    80
                "/ care for JavaContexts whose set of visible variables
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
    81
                "/ may change during method execution ( nested block locals... )
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
    82
                and:[ aContext isJavaContext not 
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
    83
                ]]).
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    84
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    85
    keepList ifTrue:[
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    86
        "/ assume that the list remains unchanged;
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    87
        "/ this is no longer true, if some inst-slot has changed (bullet colors)
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    88
        UserPreferences current showTypeIndicatorInInspector ifTrue:[
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    89
            newList := self fieldList.
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    90
            newList ~= listView list ifTrue:[
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    91
                listView list:newList. 
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    92
            ]    
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
    93
        ].
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
    94
    ] ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
    95
        hasMore := argsOnly := false.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
    96
        inspectedObject := object := nil.
12456
87fdcd23e545 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 11630
diff changeset
    97
        inspectedContext := object := aContext.
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
    98
        contextSize := inspectedContext size.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
    99
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   100
        workspaceVariableNamesInDoIts := nil.
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   101
        aContext isNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   102
            names := nil.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   103
            listView list:nil. 
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   104
            ^ self
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   105
        ].
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   106
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
   107
        methodHomeContext := aContext methodHome.
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   108
        (methodHomeContext isNil) ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   109
            "its a cheap block's context"
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   110
            rec := aContext receiver.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   111
            sel := aContext selector.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   112
            homeNames := OrderedCollection new.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   113
            isDoIt := false.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   114
        ] ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   115
            rec := methodHomeContext receiver.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   116
            sel := methodHomeContext selector.
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   117
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   118
            "/ #doIt needs special handling below
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   119
            isDoIt := (sel == #doIt) or:[sel == #doIt:].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   120
            method := methodHomeContext method.
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   121
9588
dc38e81ec660 comment/format in: #inspect:
Claus Gittinger <cg@exept.de>
parents: 9426
diff changeset
   122
            (method notNil and:[method isWrapped]) ifTrue:[
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   123
                "/ in a wrapped context, locals are something different
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   124
                argsOnly := true.
1026
b863f3784b3c oops - methods with inlined blockVars did not show its vars
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   125
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   126
                m := method originalMethod.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   127
                m notNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   128
                    method := m.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   129
                ] ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   130
                    argsOnly := true.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   131
                ].
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   132
            ].
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   133
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   134
            method notNil ifTrue:[
12904
550f2f25a5b4 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12898
diff changeset
   135
                argsOnly ifFalse:[
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   136
                    homeNames := method methodArgAndVarNamesInContext: methodHomeContext.
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   137
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   138
                    "/ did it already allocate its locals ?
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   139
                    "/                 |-----------------------------| care about Java contexts where this is first arg
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   140
                    (homeNames size > (methodHomeContext arg1Index - 1 + methodHomeContext numArgs + methodHomeContext numVars)) ifTrue:[
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   141
                        argsOnly := true.
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   142
                    ].
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   143
                ].
12904
550f2f25a5b4 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12898
diff changeset
   144
                argsOnly ifTrue:[
550f2f25a5b4 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12898
diff changeset
   145
                    homeNames := method methodArgNames
550f2f25a5b4 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12898
diff changeset
   146
                ].
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   147
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   148
                "/ there is one case, where the above is by purpose:
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   149
                "/ the #doIt - method, which has been given an invalid source.
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   150
                "/ Care for this here.
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   151
                isDoIt ifTrue:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   152
                    homeNames := #().
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   153
                ] ifFalse:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   154
                    "/ check
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   155
                    numVarsInContext := methodHomeContext argsAndVars size.
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   156
                    numVarsInSource := homeNames size.
12904
550f2f25a5b4 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12898
diff changeset
   157
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   158
                    numVarsInSource > 0 ifTrue:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   159
                        numVarsInContext < numVarsInSource ifTrue:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   160
                            "/ the methods source does not correctly reflect
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   161
                            "/ the number of args&vars in the context.
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   162
                            "/ either outDated, or somehow strange.
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   163
                            "/ (happens with wrapped methods, which are not
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   164
                            "/  what they look)
947
b9625d9b0881 better block-var name detection
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   165
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   166
                            numVarsInSource > numVarsInContext ifTrue:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   167
                                homeNames := homeNames copyTo:numVarsInContext.
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   168
                            ] ifFalse:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   169
                                numVarsInContext >= methodHomeContext numArgs ifTrue:[
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   170
                                    homeNames := homeNames copyTo:methodHomeContext numArgs
977
0bd3800f9e4a oops - dont copyFrom: nil
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   171
                                ] ifFalse:[
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   172
                                    homeNames := nil
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   173
                                ]    
977
0bd3800f9e4a oops - dont copyFrom: nil
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   174
                            ]
785
16809b8d468c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   175
                        ]
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   176
                    ]
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   177
                ]
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   178
            ].
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   179
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   180
            "
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   181
             create dummy names for method vars (if there is no source available)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   182
            "
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   183
            homeNames isNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   184
                homeNames := OrderedCollection new.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   185
                1 to:methodHomeContext numArgs do:[:index |
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   186
                    homeNames add:('mArg' , index printString)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   187
                ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   188
                argsOnly ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   189
                    1 to:methodHomeContext numVars do:[:index |
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   190
                        homeNames add:('mVar' , index printString)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   191
                    ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   192
    "/                showingTemporaries ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   193
    "/                    1 to:methodHomeContext numTemps do:[:index |
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   194
    "/                        homeNames add:('mTmp' , index printString)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   195
    "/                    ]
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   196
    "/                ]
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   197
                ]
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   198
            ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   199
            showingTemporaries ifTrue:[
8581
6246a1e656b6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8516
diff changeset
   200
                homeNames := homeNames asOrderedCollection.
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   201
                1 to:methodHomeContext numTemps do:[:index |
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   202
                    homeNames add:('mTmp' , index printString)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   203
                ]
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   204
            ].
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   205
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   206
            n := homeNames size.
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   207
            n < (((argsOnly or:[methodHomeContext isJavaContext]) ifTrue:[0] ifFalse:[ methodHomeContext numVars]) + methodHomeContext numArgs) ifTrue:[
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   208
                "/ its a context which includes locals from
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   209
                "/ inlined sub-blocks.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   210
                "/ First, generate synthetic varNames ...
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   211
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   212
                homeNames := homeNames asOrderedCollection.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   213
                tempNames := OrderedCollection new.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   214
                n to:(methodHomeContext numVars + methodHomeContext numArgs - 1) do:[:inlinedTempIdx |
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   215
                    tempNames add:('*t' , (inlinedTempIdx - n + 1) printString)
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   216
                ].
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   217
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   218
                "/ now, see if we can find out more
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   219
                "/ (fails, if source is not available)
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   220
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   221
                method notNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   222
                    (isDoIt and:[tempNames size > 0]) ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   223
                        "/ special for #doIt
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   224
                        "/ my source is found in the method.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   225
                        blockNode := Compiler
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   226
                                        blockAtLine:aContext lineNumber
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   227
                                        in:nil
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   228
                                        orSource:('[' , method source , '\]') withCRs
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   229
                                        numArgs:numArgs 
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   230
                                        numVars:numVars.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   231
                    ] ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   232
                        blockNode := Compiler 
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   233
                                        blockAtLine:methodHomeContext lineNumber
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   234
                                        in:method
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   235
                                        orSource:nil
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   236
                                        numArgs:numArgs
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   237
                                        numVars:numVars.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   238
                    ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   239
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   240
                    realTempNames := OrderedCollection new.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   241
                    [blockNode notNil] whileTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   242
                        blockNode variables notNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   243
                            realTempNames := (blockNode variables collect:[:aVar | aVar name]) , realTempNames.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   244
                        ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   245
                        blockNode arguments notNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   246
                            realTempNames := (blockNode arguments collect:[:aVar | aVar name]) , realTempNames.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   247
                        ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   248
                        "/
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   249
                        "/ hidden temps used for loop.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   250
                        "/
9426
f4faa9c4aabc changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 9351
diff changeset
   251
                        blockNode invocationSelector == #timesRepeat ifTrue:[
12779
4b9dd97e4033 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12456
diff changeset
   252
                            realTempNames := realTempNames asOrderedCollection.
4b9dd97e4033 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12456
diff changeset
   253
                            realTempNames addFirst:'*loopStop*'
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   254
                        ] ifFalse:[
9426
f4faa9c4aabc changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 9351
diff changeset
   255
                            blockNode invocationSelector == #to:do: ifTrue:[
12779
4b9dd97e4033 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12456
diff changeset
   256
                                realTempNames := realTempNames asOrderedCollection.
4b9dd97e4033 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12456
diff changeset
   257
                                realTempNames addFirst:'*loopStop*'
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   258
                            ]
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   259
                        ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   260
                        blockNode := blockNode home.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   261
                    ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   262
                    tempNames 
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   263
                            replaceFrom:1 to:(tempNames size min:realTempNames size)
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   264
                            with:realTempNames.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   265
                ].
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   266
                homeNames addAll:tempNames.
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   267
            ].
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   268
            isDoIt ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   269
                "/ care for workspace- and doIt vars
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   270
                method notNil ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   271
                    |p names wsNames|
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   272
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   273
                    wsNames := Workspace workspaceVariableNames.
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   274
                    wsNames notEmptyOrNil ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   275
                        p := Parser new source:method source; parseMethodBody; yourself.
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   276
                        names := (Set withAll:p readGlobals) addAll:p modifiedGlobals; yourself.
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   277
                        workspaceVariableNamesInDoIts := (names select:[:nm | wsNames includes:nm] ) 
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   278
                                                            asOrderedCollection sort.
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   279
                    ].
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   280
                ].
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   281
            ].
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   282
        ].
1204
e2f7a2409f7d inlined vars/args are shown as *t<i>
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
   283
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   284
        "
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   285
         stupid: should find the block via the contexts
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   286
         method-home and put real names in here
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   287
        "
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   288
        aContext isBlockContext ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   289
            names := self namesOfBlockContext:aContext.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   290
            hCon := aContext home.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   291
            [hCon == methodHomeContext] whileFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   292
                names addAll:(self namesOfBlockContext:hCon).
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   293
                hCon := hCon home.
1370
d322faba88b9 better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
   294
            ].
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   295
            names addAll:homeNames.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   296
        ] ifFalse:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   297
            names := homeNames.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   298
        ].
1370
d322faba88b9 better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
   299
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   300
        listView list:(self fieldList). 
1370
d322faba88b9 better extract of block-var-names
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
   301
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   302
        workspace contents:nil.
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   303
        self setDoitActionIn:workspace for:aContext.
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   304
    ].
51
57c1ccc3d7e0 *** empty log message ***
claus
parents: 49
diff changeset
   305
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   306
    oldSelectedName notNil ifTrue:[
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   307
        |idx|
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   308
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
   309
        idx := listView list findFirst:[:entry | (entry ? '') string = oldSelectedName].
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   310
        idx ~~ 0 "(names includes:oldSelectedName)" ifTrue:[
1769
6b904f69858f try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
   311
            listView selectElement:oldSelectedName.
8516
e83b1f8fe73f reselection - keep shown entry (all locals in debugger)
Claus Gittinger <cg@exept.de>
parents: 8437
diff changeset
   312
            self showSelection:idx.
1769
6b904f69858f try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
   313
        ]
6b904f69858f try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
   314
    ].
6b904f69858f try to reselect the same name-entry, if inspected context
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
   315
11549
306407e0570b changed: #inspect:
Claus Gittinger <cg@exept.de>
parents: 11515
diff changeset
   316
    "Modified: / 03-06-2012 / 11:56:59 / cg"
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   317
    "Modified: / 05-11-2013 / 15:44:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   318
!
d904237f7c44 Initial revision
claus
parents:
diff changeset
   319
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   320
namesOfBlockContext:aContext
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   321
    |numArgs numVars argAndVarNames argNames varNames tmpNames names|
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   322
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   323
    numArgs := aContext numArgs.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   324
    numVars := aContext numVars.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   325
13720
0c9ca76c6f23 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13454
diff changeset
   326
    (numArgs + numVars) > 0 ifTrue:[
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   327
        argAndVarNames := aContext argAndVarNames.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   328
        argAndVarNames notEmptyOrNil ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   329
            argNames := argAndVarNames copyTo:numArgs.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   330
            varNames := argAndVarNames copyFrom:numArgs+1.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   331
        ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   332
    ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   333
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   334
    names := OrderedCollection new.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   335
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   336
    argNames isNil ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   337
        argNames := (1 to:numArgs) collect:[:i | 'arg' , i printString].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   338
    ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   340
    names addAll:argNames.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   341
    varNames isNil ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   342
        varNames := (1 to:numVars) collect:[:i | 'var' , i printString].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   343
    ] ifFalse:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   344
        varNames size ~~ numVars ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   345
            varNames := varNames asOrderedCollection.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   346
            varNames size+1 to:aContext numVars do:[:i |
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   347
                varNames add:('var' , i printString)
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   348
            ]
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   349
        ]
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   350
    ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   351
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   352
    names addAll:varNames.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   353
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   354
    showingTemporaries ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   355
        tmpNames := (1 to:(aContext numTemps)) collect:[:i | 'tmp' , i printString].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   356
        names addAll:tmpNames.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   357
    ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   358
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   359
    ^ names
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   360
!
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   361
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   362
release
d904237f7c44 Initial revision
claus
parents:
diff changeset
   363
    "release inspected object"
d904237f7c44 Initial revision
claus
parents:
diff changeset
   364
d904237f7c44 Initial revision
claus
parents:
diff changeset
   365
    inspectedContext := nil.
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   366
    names := nil.
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   367
    super release
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   368
297
3d34ce6e2b22 oops - leftover printMessage removed
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   369
    "Modified: 14.12.1995 / 21:49:43 / cg"
34
d904237f7c44 Initial revision
claus
parents:
diff changeset
   370
! !
d904237f7c44 Initial revision
claus
parents:
diff changeset
   371
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   372
!ContextInspectorView methodsFor:'initialization'!
51
57c1ccc3d7e0 *** empty log message ***
claus
parents: 49
diff changeset
   373
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   374
initialize
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   375
    super initialize.
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   376
    showingTemporaries := false.
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   377
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   378
! !
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   379
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   380
!ContextInspectorView methodsFor:'menu'!
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   381
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   382
fieldMenu
1596
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   383
    "return a popUpMenu for the left (fields) pane"
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   384
1361
20c353524524 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1204
diff changeset
   385
    <resource: #programMenu >
20c353524524 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1204
diff changeset
   386
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   387
    |items m sel|
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   388
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   389
    items := #(
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   390
                   ('Copy Name or Key'      #doCopyKey)
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   391
                   ('-')
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   392
                   ('Inspect'               #doInspect)
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   393
                   ('BasicInspect'          #doBasicInspect)
9351
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   394
             ).
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   395
    NewInspector::NewInspectorView notNil ifTrue:[
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   396
        items := items , #(
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   397
                       ('Inspect Hierarchical'         #doNewInspect           )
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   398
                ).
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   399
    ].
99bd94741d5d do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents: 9033
diff changeset
   400
    items := items , #(
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   401
                   ('-')
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   402
                   ('Browse'                #browse)
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   403
              ).
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   404
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   405
    sel := self selection.
12932
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   406
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   407
    (sel isSymbol) ifTrue:[
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   408
        items := items , #(
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   409
                       ('Browse Implementors'           #browseImplementorsOfSymbolValue)
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   410
              ).
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   411
    ].
63707ac51242 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12904
diff changeset
   412
6852
39c9b68020eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6491
diff changeset
   413
    Error 
39c9b68020eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6491
diff changeset
   414
        handle:[:ex| ]
39c9b68020eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6491
diff changeset
   415
        do:[
7438
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   416
            (sel isBlock or:[sel isContext]) ifTrue:[
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   417
                items := items , #(
10437
27f70bcbf968 changed: #fieldMenu
Claus Gittinger <cg@exept.de>
parents: 9588
diff changeset
   418
                               ('Browse Block''s Home'           #browseHome)
7438
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   419
                      ).
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   420
            ].
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   421
            (sel isMethod) ifTrue:[
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   422
                items := items , #(
10437
27f70bcbf968 changed: #fieldMenu
Claus Gittinger <cg@exept.de>
parents: 9588
diff changeset
   423
                               ('Browse Method''s Class'         #browseMethodsClass)
7438
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   424
                         ).
b9eab5a1a36a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6852
diff changeset
   425
            ].
6852
39c9b68020eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6491
diff changeset
   426
        ].
39c9b68020eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6491
diff changeset
   427
17208
6bebcc9d2379 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 16504
diff changeset
   428
    sel isProtoObject ifFalse:[
6bebcc9d2379 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 16504
diff changeset
   429
        items := items , (self optionalStreamSelectionItems).
6bebcc9d2379 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 16504
diff changeset
   430
        items := items , (self optionalFilenameSelectionItems).
6bebcc9d2379 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 16504
diff changeset
   431
    ].
7640
692b99f5d3fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7438
diff changeset
   432
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   433
    items := items , #(
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   434
               ('-')
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   435
              ).
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   436
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   437
    showingTemporaries ifFalse:[
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   438
        items := items , #(
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   439
                       ('Show Temporaries'      #showTemporaries)
1596
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   440
                  )
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   441
    ] ifTrue:[
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   442
        items := items , #(
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   443
                       ('Hide temporaries'      #hideTemporaries)
1596
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   444
                  )
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   445
    ].
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   446
7640
692b99f5d3fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7438
diff changeset
   447
    items := items , (self numberBaseItems).
11630
767544a6b3f7 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 11549
diff changeset
   448
    items := items , (self sortOrderItems).
7640
692b99f5d3fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7438
diff changeset
   449
3105
9d80b49560ca added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents: 2957
diff changeset
   450
    m := PopUpMenu
1596
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   451
          itemList:items
3105
9d80b49560ca added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents: 2957
diff changeset
   452
          resources:resources.
9d80b49560ca added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents: 2957
diff changeset
   453
3425
63909439cbe8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3200
diff changeset
   454
    selectionIndex isNil ifTrue:[
12935
2149c6971ded class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12932
diff changeset
   455
        m disableAll:#(doInspect doBasicInspect browse browseHome browseImplementorsOfSymbolValue)
3425
63909439cbe8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3200
diff changeset
   456
    ] ifFalse:[
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   457
        sel isBlock ifFalse:[
3425
63909439cbe8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3200
diff changeset
   458
            m disable:#browseHome
6491
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   459
        ].
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   460
        sel class hasImmediateInstances ifTrue:[
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   461
            m disableAll:#(showReferences doNewInspect)
d02c41c57d02 better menu
Claus Gittinger <cg@exept.de>
parents: 6404
diff changeset
   462
        ].
3105
9d80b49560ca added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents: 2957
diff changeset
   463
    ].
9d80b49560ca added browse blocks home menu item
Claus Gittinger <cg@exept.de>
parents: 2957
diff changeset
   464
    ^ m
1361
20c353524524 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1204
diff changeset
   465
11630
767544a6b3f7 changed: #editMenu
Claus Gittinger <cg@exept.de>
parents: 11549
diff changeset
   466
    "Modified: / 20-07-2012 / 10:51:12 / cg"
73
e332d9c71624 *** empty log message ***
claus
parents: 57
diff changeset
   467
! !
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   468
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   469
!ContextInspectorView methodsFor:'private'!
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   470
647
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   471
defaultLabel
4095
5bd36b14723d labels; added suppressPseudoVars & dereferenceValueHolders
Claus Gittinger <cg@exept.de>
parents: 3775
diff changeset
   472
    ^ 'Locals'
647
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   473
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   474
    "
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   475
     ContextInspectorView openOn:thisContext sender
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   476
    "
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   477
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   478
    "Modified: 28.6.1996 / 16:07:49 / cg"
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   479
!
1791ceddf2ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 645
diff changeset
   480
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   481
displayStringForValue:someValue 
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   482
    "return the values displayString"
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   483
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   484
    |sel|
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   485
11513
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   486
    sel := self listEntryAt:selectionIndex.
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   487
    (sel startsWith:'-all local vars') ifTrue:[
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   488
        ^ self stringWithAllLocalValues
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   489
    ].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   490
    (sel startsWith:'-all workspace vars') ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   491
        ^ self stringWithAllWorkspaceValues
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   492
    ].
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   493
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   494
    ^ super displayStringForValue:someValue
11513
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   495
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   496
    "Modified: / 16-05-2012 / 17:55:33 / cg"
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   497
!
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   498
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   499
fieldList
13454
feba94447645 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13453
diff changeset
   500
    "generate a list of names (& pseudo names) to be shown on the left side"
feba94447645 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13453
diff changeset
   501
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   502
    |list|
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   503
14051
607958377e4f Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13982
diff changeset
   504
    inspectedContext isNil ifTrue:[ ^ #() ].
607958377e4f Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13982
diff changeset
   505
13451
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   506
    names size == 0 ifTrue:[
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   507
        (inspectedContext isBlockContext and:[inspectedContext home isNil]) ifTrue:[
13451
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   508
            "/ hack to guide beginners
16504
58a9cf59cb38 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 16479
diff changeset
   509
            ^ { '>> no home in cheap block <<' withColor:Color gray }
13451
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   510
        ].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   511
        list := #()
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   512
    ] ifFalse:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   513
        list := { '-','all local vars' allItalic } 
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   514
                , (names keysAndValuesCollect:
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   515
                        [:idx :nm | self listEntryForName:nm value:(self valueAtIndex:idx) ]
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   516
                  )
13451
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   517
    ].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   518
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   519
    workspaceVariableNamesInDoIts notEmptyOrNil ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   520
        list := list 
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   521
                , { '-','all workspace vars' allItalic} 
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   522
                , (workspaceVariableNamesInDoIts keysAndValuesCollect:
13982
25d8cef3bc77 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13973
diff changeset
   523
                        [:idx :nm | self listEntryForName:nm value:(Workspace workspaceVariableAt:nm) ]
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   524
                  )
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   525
    ].
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   526
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   527
    ^ list
11515
95a16f1dc52d changed: #fieldList
Claus Gittinger <cg@exept.de>
parents: 11513
diff changeset
   528
95a16f1dc52d changed: #fieldList
Claus Gittinger <cg@exept.de>
parents: 11513
diff changeset
   529
    "Modified: / 16-05-2012 / 18:54:59 / cg"
14051
607958377e4f Fix in ContextInspectorView>>#fieldList - care for nil context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13982
diff changeset
   530
    "Modified: / 25-02-2014 / 15:10:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   531
!
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   532
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   533
hasSelfEntry
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   534
    ^ false
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   535
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   536
    "Created: 14.12.1995 / 19:29:47 / cg"
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   537
!
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   538
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   539
setDoitActionIn:aWorkspace for:aContext
1596
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   540
    aWorkspace 
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   541
        doItAction:[:theCode |
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   542
            Compiler 
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   543
                evaluate:theCode
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   544
                in:aContext
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   545
                receiver:nil
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   546
                notifying:aWorkspace
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   547
                logged:true 
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   548
                ifFail:nil
1c937a1d2d37 use new menu-creation message in PopUpMenu.
Claus Gittinger <cg@exept.de>
parents: 1523
diff changeset
   549
        ]
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   550
!
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   551
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   552
stringWithAllLocalValues
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   553
    "when clicked on '-all local vars'"
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   554
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   555
    ^ self stringWithAllNames:names andValues:((1 to:names size) collect:[:i| (self valueAtIndex:i)])
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   556
!
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   557
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   558
stringWithAllNames:names andValues:values
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   559
    "helper for '-all local vars' and '-all workspace vars'"
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   560
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   561
    |outStream  maxLen varString|
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   562
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   563
    outStream := CharacterWriteStream new.
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   564
    maxLen := (names collect:[:eachName | eachName size]) max.
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   565
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   566
    names with:values do:[:eachName :eachValue |
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   567
        outStream nextPutAll:((eachName , ' ') paddedTo:maxLen+1 with:$.).
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   568
        outStream nextPutAll:' : '.
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   569
5922
354cc187ba57 catch errors in displayString
martin
parents: 5803
diff changeset
   570
        [
8634
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   571
            |s|
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   572
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   573
            s := CharacterWriteStream new.
8634
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   574
            s writeLimit:100000.
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   575
            eachValue displayOn:s.
8634
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   576
            varString := s contents.
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   577
        ] on:Error do:[:ex |
a37194c645be limit printStrings (in case an instvar is ByteArray of size 80Mb)
Claus Gittinger <cg@exept.de>
parents: 8581
diff changeset
   578
            varString := ('*** Error in displayString (%1)***' bindWith:ex description)
5922
354cc187ba57 catch errors in displayString
martin
parents: 5803
diff changeset
   579
        ].
354cc187ba57 catch errors in displayString
martin
parents: 5803
diff changeset
   580
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   581
        (varString includes:Character cr) ifTrue:[
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   582
            varString := varString copyTo:(varString indexOf:Character cr)-1.
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   583
            varString := varString , '...'.
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   584
        ].
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   585
        outStream nextPutAll:varString.
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   586
        outStream cr.
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   587
    ].
15591
3eee78f89c1e class: ContextInspectorView
Stefan Vogel <sv@exept.de>
parents: 14616
diff changeset
   588
    ^ outStream contents
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   589
!
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   590
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   591
stringWithAllWorkspaceValues
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   592
    "when clicked on '-all workspace vars'"
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   593
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   594
    ^ self 
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   595
        stringWithAllNames:workspaceVariableNamesInDoIts 
13982
25d8cef3bc77 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13973
diff changeset
   596
        andValues:(workspaceVariableNamesInDoIts collect:[:nm| Workspace workspaceVariableAt:nm])
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   597
!
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   598
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   599
valueAtIndex:varIdx
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   600
    "helper - return the value of the selected entry"
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   601
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   602
    |methodHomeContext hCon theContext values|
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   603
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   604
    inspectedContext isNil ifTrue:[^ nil].
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   605
12898
323452deefd5 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12779
diff changeset
   606
    "/ argsOnly := false.
868
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   607
    theContext := inspectedContext.
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   608
    methodHomeContext := theContext methodHome.
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   609
868
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   610
    theContext isBlockContext ifTrue:[
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   611
        values := Array withAll:(theContext argsAndVars).
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   612
        (showingTemporaries and:[theContext numTemps ~~ 0]) ifTrue:[
b5f5f5723793 renamed vars for WIN32
Claus Gittinger <cg@exept.de>
parents: 840
diff changeset
   613
            values := values , theContext temporaries
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   614
        ].
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   615
        hCon := theContext home.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   616
        [hCon == methodHomeContext] whileFalse:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   617
            values := values , hCon argsAndVars.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   618
            (showingTemporaries and:[theContext numTemps ~~ 0]) ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   619
                values := values , hCon temporaries
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   620
            ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   621
            hCon := hCon home.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   622
        ].
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   623
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   624
        methodHomeContext notNil ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   625
            values := values , methodHomeContext args.
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   626
            argsOnly ifFalse:[
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   627
                values := values , methodHomeContext vars.
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   628
                (showingTemporaries and:[methodHomeContext numTemps ~~ 0])ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   629
                    values := values , methodHomeContext temporaries
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   630
                ]
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   631
            ].
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   632
        ].
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   633
    ] ifFalse:[
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   634
        argsOnly ifTrue:[
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   635
            values := methodHomeContext args
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   636
        ] ifFalse:[
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   637
            values := methodHomeContext argsAndVars
1395
1c7f8d3794f7 context vars
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   638
        ].
5339
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   639
        (showingTemporaries and:[methodHomeContext numTemps ~~ 0])ifTrue:[
a740e2325527 also show argAndVarNames of outer blocks.
Claus Gittinger <cg@exept.de>
parents: 5148
diff changeset
   640
            values := values , methodHomeContext temporaries
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   641
        ]
1395
1c7f8d3794f7 context vars
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   642
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   643
    ].
16479
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   644
    
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   645
    varIdx > values size ifTrue:[
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   646
        |wsIndex|
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   647
16479
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   648
        workspaceVariableNamesInDoIts notNil ifTrue:[
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   649
            wsIndex := varIdx - values size - 1.
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   650
            wsIndex <= workspaceVariableNamesInDoIts size ifTrue:[
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   651
                ^ Workspace workspaceVariableAt:(workspaceVariableNamesInDoIts at:wsIndex).
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   652
            ].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   653
        ].
13972
c503d01b46fc class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13967
diff changeset
   654
        ^ '** oops - could not find value **'
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   655
    ].
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   656
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   657
    ^ values at:varIdx.
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   658
1395
1c7f8d3794f7 context vars
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   659
    "Modified: / 13.1.1998 / 15:55:16 / cg"
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   660
!
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   661
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   662
valueAtLine:lineNr
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   663
    "helper - return the value of the selected entry"
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   664
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   665
    |varIdx l|
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   666
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   667
    inspectedContext isNil ifTrue:[^ nil].
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   668
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   669
    varIdx := lineNr.
11513
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   670
    l := self listEntryAt:lineNr.
8437
sr
parents: 7640
diff changeset
   671
    l isNil ifTrue:[ ^nil].
sr
parents: 7640
diff changeset
   672
13451
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   673
    (l startsWith:'>>') ifTrue:[
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   674
        "/ a comment (hack)
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   675
        ^ self valueForCommentLine:(self listEntryAt:lineNr)
3ae3b9b9e45e class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 12935
diff changeset
   676
    ].
8437
sr
parents: 7640
diff changeset
   677
    (l startsWith:$-) ifTrue:[
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   678
        (l ~= '-') ifTrue:[
11513
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   679
            ^ self valueForSpecialLine:(self listEntryAt:lineNr)
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   680
        ].
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   681
    ].
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   682
    ^ self valueAtIndex:(varIdx - 1). "/ for the special var
11513
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   683
79e2c470f26f nice name list
Claus Gittinger <cg@exept.de>
parents: 10437
diff changeset
   684
    "Modified: / 16-05-2012 / 17:55:57 / cg"
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   685
!
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   686
13453
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   687
valueForCommentLine:line
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   688
    "/ a hack to guide beginners
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   689
    (line startsWith:'>> no home') ifTrue:[
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   690
        ^ 'Cheapblocks do not refer to any variable in
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   691
their defining outer context 
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   692
(i.e. they only refer to self and arguments).
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   693
Therefore, they do not keep a reference to the outer context.
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   694
This is a compiler optimization, leading to a slight inconvenience here.'
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   695
    ].
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   696
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   697
    ^ nil
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   698
!
ddc48bfab4c7 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13452
diff changeset
   699
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   700
valueForSpecialLine:line
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   701
    (line startsWith:'-all local vars') ifTrue:[
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   702
        ^ inspectedObject
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   703
    ].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   704
    (line startsWith:'-all workspace vars') ifTrue:[
13982
25d8cef3bc77 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13973
diff changeset
   705
        ^ workspaceVariableNamesInDoIts collect:[:nm | Workspace workspaceVariableAt:nm].
13967
57e47c38703c class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 13809
diff changeset
   706
    ].
3775
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   707
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   708
    self error:'unknown special line'.
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   709
6537791170d8 added all local vars
Claus Gittinger <cg@exept.de>
parents: 3425
diff changeset
   710
    "Created: / 31.10.2001 / 09:17:45 / cg"
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   711
! !
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   712
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   713
!ContextInspectorView methodsFor:'user actions'!
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   714
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   715
hideTemporaries
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   716
    "do not show contexts temporaries"
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   717
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   718
    showingTemporaries := false.
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   719
    self inspect:inspectedContext
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   720
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   721
    "Modified: 14.12.1995 / 19:24:44 / cg"
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   722
!
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   723
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   724
showTemporaries
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   725
    "show contexts temporaries"
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   726
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   727
    showingTemporaries := true.
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   728
    self inspect:inspectedContext
296
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   729
b480a51cfb5f dont buffer values / keep context / update value (now try single stepping with a variable selected)
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   730
    "Modified: 14.12.1995 / 19:24:49 / cg"
13809
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   731
!
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   732
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   733
valueAtLine:lineNr put:newValue
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   734
    "helper - return the value of the selected entry"
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   735
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   736
    |indexOfFirstNonSpecial contextIndex|
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   737
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   738
    inspectedContext isNil ifTrue:[^ self].
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   739
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   740
    "/ count the special lines
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   741
    indexOfFirstNonSpecial := self fieldList findFirst:[:l | (l string startsWith:'-') not].
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   742
    indexOfFirstNonSpecial == 0 ifTrue:[
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   743
        ^ self
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   744
    ].
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   745
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   746
    contextIndex := lineNr - indexOfFirstNonSpecial + 1.
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   747
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   748
    "yes, you can do that with a context"
55d97914d757 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 13720
diff changeset
   749
    inspectedContext at:contextIndex put:newValue.
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   750
! !
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   751
785
16809b8d468c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 647
diff changeset
   752
!ContextInspectorView class methodsFor:'documentation'!
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   753
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   754
version
16479
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   755
    ^ '$Header$'
9033
abeca4d8f0f0 no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents: 8690
diff changeset
   756
!
abeca4d8f0f0 no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents: 8690
diff changeset
   757
abeca4d8f0f0 no need for #asText to emphasize a string
Claus Gittinger <cg@exept.de>
parents: 8690
diff changeset
   758
version_CVS
16479
38ff09a72df0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15591
diff changeset
   759
    ^ '$Header$'
200
01ce3d3636d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   760
! !
12456
87fdcd23e545 class: ContextInspectorView
Claus Gittinger <cg@exept.de>
parents: 11630
diff changeset
   761