InspectorListView.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Jun 1999 17:44:30 +0200
changeset 1147 422c8afcb0f5
parent 810 032e13b1bfda
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     1
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     3
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     4
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     5
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     6
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     8
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     9
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    10
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    11
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    12
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    13
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    14
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    15
"{ NameSpace: NewInspector }"
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    16
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    17
SelectionInListView subclass:#InspectorListView
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    18
	instanceVariableNames:'actionHolder inspectorList includesSelf'
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    19
	classVariableNames:''
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    20
	poolDictionaries:''
810
032e13b1bfda category change
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
    21
	category:'Interface-Inspector'
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    22
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    23
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    24
!InspectorListView class methodsFor:'documentation'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    25
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    26
copyright
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    27
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    28
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    29
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    30
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    31
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    32
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    34
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    35
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    36
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    37
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    38
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    39
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    40
!
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    41
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    42
examples
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    43
"
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    44
        open a list view on an instance
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    45
                                                                        [exBegin]
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    46
        |top slv a|
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    47
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    48
        a := OrderedCollection new.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    49
        a add:1.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    50
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    51
        top := StandardSystemView new
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    52
                label:'select';
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    53
                extent:200@200.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    54
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    55
        slv := ScrollableView for:self in:top.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    56
        slv origin:0.0@0.0 corner:1.0@1.0.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    57
        slv := slv scrolledView.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    58
        slv inspect:top.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    59
        slv action:[:el|Transcript showCR:(el printString)].
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    60
        top open
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    61
                                                                        [exEnd]
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    62
"
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    63
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    64
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    65
!InspectorListView methodsFor:'accessing'!
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    66
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    67
includesSelf:aBool
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    68
    includesSelf := aBool
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    69
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    70
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    71
list
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    72
    ^ inspectorList
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    73
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    74
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    75
list:aList
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    76
    "set the lists contents from another list
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    77
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    78
    aList notNil ifTrue:[inspectorList := aList list]
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    79
                ifFalse:[inspectorList := InspectorList new].
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    80
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    81
    inspectorList includesSelf:includesSelf.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    82
    super list:(inspectorList instanceNames).
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    83
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    84
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    85
update
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    86
    "update the current list
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    87
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    88
    inspectorList update.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    89
    super list:(inspectorList instanceNames).
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    90
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    91
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    92
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    93
!InspectorListView methodsFor:'accessing actions'!
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    94
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    95
action:aOneArgAction
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    96
    "set the single click action block. If non-nil, that one is evaluated on single
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    97
     click, passing the selected instance as argument
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
    98
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
    99
    actionHolder := aOneArgAction
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   100
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   101
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   102
!InspectorListView methodsFor:'drawing'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   103
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   104
drawVisibleLineSelected:visLineNr with:fg and:bg
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   105
    "redraw a single line as selected.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   106
    "
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   107
    |nr| 
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   108
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   109
    (nr := self visibleLineToListLine:visLineNr) notNil ifTrue:[
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   110
        ^ self drawVisibleLine:visLineNr with:fg and:bg.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   111
    ].
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   112
    ^ super drawVisibleLine:visLineNr with:fg and:bg
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   113
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   114
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   115
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   116
redrawArrowVisibleLine:visLineNr
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   117
    "draw a right arrow for visible line
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   118
    "
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   119
    |nr|
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   120
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   121
    nr := self visibleLineToListLine:visLineNr.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   122
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   123
    (inspectorList instanceTypeAt:nr) == #directory ifTrue:[
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   124
        self drawRightArrowInVisibleLine:visLineNr
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   125
    ]
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   126
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   127
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   128
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   129
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   130
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   131
    "redefined to look for directory in every line
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   132
    "
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   133
    super redrawFromVisibleLine:startVisLineNr to:endVisLineNr.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   134
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   135
    startVisLineNr to:endVisLineNr do:[:visLineNr|
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   136
        self redrawArrowVisibleLine:visLineNr
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   137
    ]
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   138
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   139
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   140
redrawVisibleLine:visLineNr
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   141
    "if the line is one for a directory, draw a right arrow
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   142
    "
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   143
    super redrawVisibleLine:visLineNr.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   144
    self  redrawArrowVisibleLine:visLineNr.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   145
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   146
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   147
visibleLineNeedsSpecialCare:visLineNr
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   148
    "returns true if the visible line needs special care
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   149
    "
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   150
    |nr|
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   151
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   152
    nr := self visibleLineToListLine:visLineNr.
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 39
diff changeset
   153
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   154
    (inspectorList instanceTypeAt:nr) == #directory ifTrue:[
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   155
        ^ true
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   156
    ].
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   157
    ^ super visibleLineNeedsSpecialCare:visLineNr
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   158
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   159
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   160
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   161
widthForScrollBetween:firstLine and:lastLine
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   162
    "return the width in pixels for a scroll between firstLine and lastLine
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   163
     - return full width here since there might be directory marks
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   164
    "
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   165
    ^ (width - margin - margin)
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   166
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   167
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   168
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   169
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   170
!InspectorListView methodsFor:'event handling'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   171
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   172
sizeChanged:how
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   173
    "redraw marks
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   174
    "
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   175
    super sizeChanged:how.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   176
    shown ifTrue:[self invalidate]
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   177
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   178
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   179
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   180
!InspectorListView methodsFor:'initialization'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   181
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   182
initialize
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   183
    "initialization
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   184
    "
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   185
    super initialize.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   186
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   187
    ignoreReselect := false.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   188
    includesSelf   := false.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   189
    actionHolder   := [:el|].
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   190
    inspectorList  := InspectorList new.
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   191
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   192
    actionBlock := [:dummy|
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   193
        self setSelection:selection.
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   194
        actionHolder value:(self selectedInstanceVar)
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   195
    ].
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   196
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   197
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   198
!InspectorListView methodsFor:'private'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   199
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   200
doesNotUnderstand:aMessage
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   201
    "forward a message to the inspectorList
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   202
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   203
    (inspectorList respondsTo:(aMessage selector)) ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   204
        ^ aMessage sendTo:inspectorList
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   205
    ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   206
    ^ super doesNotUnderstand:aMessage
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   207
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   208
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   209
!
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   210
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   211
list:aCollection keepSelection:aBoolean
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   212
    "set the list - redefined, since setting the list implies unselecting
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   213
     and clearing attributes."
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   214
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   215
    "somewhat of a kludge: if selection is first line,
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   216
     we have to remove the highlight frame by hand here"
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   217
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   218
    (shown and:[hilightLevel ~~ 0]) ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   219
        selection == firstLineShown ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   220
           self paint:bgColor.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   221
           self fillRectangleX:margin y:margin
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   222
                          width:(width - (margin * 2)) 
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   223
                         height:(hilightLevel abs).
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   224
        ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   225
    ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   226
    listAttributes := nil.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   227
    super list:aCollection expandTabs:false.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   228
    super setSelection:(inspectorList selection).
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   229
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   230
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   231
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   232
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   233
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   234
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   235
!InspectorListView methodsFor:'selections'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   236
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   237
setSelection:aNumberOrNil
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   238
    "select line, aNumber or deselect if argument is nil
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   239
    "
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   240
    |oldSize|
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   241
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   242
    oldSize := inspectorList size.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   243
    inspectorList setSelection:aNumberOrNil.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   244
    oldSize == inspectorList size ifTrue:[super setSelection:(inspectorList selection)]
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   245
                                 ifFalse:[super list:(inspectorList instanceNames)].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   246
! !
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   247
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   248
!InspectorListView methodsFor:'user interaction'!
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   249
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   250
accept:aText notifying:aView
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   251
    "evaluating aText on the selected instance var; if an error occurs #Error
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   252
     is returned otherwise the inspected object instance. On success the list
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   253
     will be updated.
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   254
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   255
    |res|
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   256
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   257
    res := inspectorList accept:aText notifying:aView.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   258
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   259
    res ~~ #Error ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   260
        super list:(inspectorList instanceNames)
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   261
    ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   262
    ^ res
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   263
!
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   264
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   265
doIt:aCode notifying:aView
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   266
    "evaluating aCode on the selected instance var; if an error occurs #Error
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   267
     is returned otherwise the result returned from the evaluator. On success
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   268
     the list will be updated.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   269
    "
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   270
    |res|
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   271
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   272
    res := inspectorList doIt:aCode notifying:aView.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   273
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   274
    res ~~ #Error ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   275
        super list:(inspectorList instanceNames)
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   276
    ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   277
    ^ res
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   278
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   279
!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   280
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   281
inspect:anObject
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   282
    "inspect a new instance; update contents
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   283
    "
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   284
    (inspectorList inspectedObject) == anObject ifTrue:[
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   285
        ^ self update
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   286
    ].
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   287
    inspectorList := InspectorList for:anObject.
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   288
    inspectorList includesSelf:includesSelf.
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   289
39
03af455029eb *** empty log message ***
ca
parents: 34
diff changeset
   290
    super list:(inspectorList instanceNames).
34
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   291
! !
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   292
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   293
!InspectorListView class methodsFor:'documentation'!
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   294
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   295
version
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   296
    ^ '$Header$'
0f083a268b66 intitial checkin
ca
parents:
diff changeset
   297
! !