|
1 "{ Package: 'Programming Tools' }" |
|
2 |
|
3 " |
|
4 COPYRIGHT (c) 1993 by Claus Gittinger |
|
5 All Rights Reserved |
|
6 |
|
7 This software is furnished under a license and may be used |
|
8 only in accordance with the terms of that license and with the |
|
9 inclusion of the above copyright notice. This software may not |
|
10 be provided or otherwise made available to, or used by, any |
|
11 other person. No title to or ownership of the software is |
|
12 hereby transferred. |
|
13 " |
|
14 |
|
15 InspectorView subclass:#ContextInspectorView |
|
16 instanceVariableNames:'inspectedContext' |
|
17 classVariableNames:'' |
|
18 poolDictionaries:'' |
|
19 category:'Interface-Inspector' |
|
20 ! |
|
21 |
|
22 ContextInspectorView comment:' |
|
23 COPYRIGHT (c) 1993 by Claus Gittinger |
|
24 All Rights Reserved |
|
25 |
|
26 $Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.1 1994-08-11 23:38:38 claus Exp $ |
|
27 '! |
|
28 |
|
29 !ContextInspectorView class methodsFor:'documentation'! |
|
30 |
|
31 copyright |
|
32 " |
|
33 COPYRIGHT (c) 1993 by Claus Gittinger |
|
34 All Rights Reserved |
|
35 |
|
36 This software is furnished under a license and may be used |
|
37 only in accordance with the terms of that license and with the |
|
38 inclusion of the above copyright notice. This software may not |
|
39 be provided or otherwise made available to, or used by, any |
|
40 other person. No title to or ownership of the software is |
|
41 hereby transferred. |
|
42 " |
|
43 ! |
|
44 |
|
45 version |
|
46 " |
|
47 $Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.1 1994-08-11 23:38:38 claus Exp $ |
|
48 " |
|
49 ! |
|
50 |
|
51 documentation |
|
52 " |
|
53 a modified Inspector for Contexts (used in Debugger) |
|
54 " |
|
55 ! ! |
|
56 |
|
57 !ContextInspectorView methodsFor:'accessing'! |
|
58 |
|
59 inspect:con |
|
60 "set the context to be inspected" |
|
61 |
|
62 |aList homeContext method names rec sel implementorClass argNames varNames| |
|
63 |
|
64 realized ifFalse:[^ self]. |
|
65 |
|
66 inspectedObject := nil. |
|
67 inspectedContext := con. |
|
68 con isNil ifTrue:[ |
|
69 inspectedValues := nil. |
|
70 listView contents:nil. |
|
71 ^ self |
|
72 ]. |
|
73 |
|
74 homeContext := con methodHome. |
|
75 rec := homeContext receiver. |
|
76 sel := homeContext selector. |
|
77 |
|
78 implementorClass := homeContext searchClass whichClassImplements:sel. |
|
79 implementorClass notNil ifTrue:[ |
|
80 method := implementorClass compiledMethodAt:sel. |
|
81 names := method methodArgAndVarNames |
|
82 ]. |
|
83 |
|
84 "create dummy names (if there is no source available)" |
|
85 names isNil ifTrue:[ |
|
86 names := OrderedCollection new. |
|
87 1 to:homeContext nargs do:[:index | |
|
88 names add:('mArg' , index printString) |
|
89 ]. |
|
90 1 to:homeContext nvars do:[:index | |
|
91 names add:('mVar' , index printString) |
|
92 ]. |
|
93 ]. |
|
94 |
|
95 aList := OrderedCollection new. |
|
96 |
|
97 " |
|
98 stupid: should find the block via the contexts |
|
99 method-home and put real names in here |
|
100 " |
|
101 con isBlockContext ifTrue:[ |
|
102 argNames := (1 to:(con nargs)) collect:[:i | 'arg' , i printString]. |
|
103 aList addAll:argNames. |
|
104 varNames := (1 to:(con nvars)) collect:[:i | 'var' , i printString]. |
|
105 aList addAll:varNames. |
|
106 aList addAll:names. |
|
107 inspectedValues := (Array withAll:(con argsAndVars)) , homeContext argsAndVars |
|
108 ] ifFalse:[ |
|
109 aList addAll:names. |
|
110 inspectedValues := homeContext argsAndVars |
|
111 ]. |
|
112 listView contents:aList. |
|
113 |
|
114 workspace contents:nil. |
|
115 " |
|
116 self setDoitActionIn:workspace for:con. |
|
117 " |
|
118 workspace doItAction:[:theCode | |
|
119 Compiler evaluate:theCode |
|
120 in:con |
|
121 receiver:nil |
|
122 notifying:workspace |
|
123 ifFail:nil |
|
124 ] |
|
125 ! |
|
126 |
|
127 release |
|
128 "release inspected object" |
|
129 |
|
130 inspectedContext := nil. |
|
131 super release |
|
132 ! ! |
|
133 |
|
134 !ContextInspectorView methodsFor:'private'! |
|
135 |
|
136 setDoitActionIn:aWorkspace for:aContext |
|
137 aWorkspace doItAction:[:theCode | |
|
138 Compiler evaluate:theCode |
|
139 in:aContext |
|
140 receiver:nil |
|
141 notifying:aWorkspace |
|
142 ifFail:nil |
|
143 ] |
|
144 ! ! |
|
145 |
|
146 !ContextInspectorView methodsFor:'user actions'! |
|
147 |
|
148 doAccept:theText |
|
149 |value| |
|
150 |
|
151 selectedLine notNil ifTrue:[ |
|
152 value := Compiler evaluate:theText |
|
153 receiver:inspectedObject |
|
154 notifying:workspace. |
|
155 |
|
156 "yes, you can do that with a context" |
|
157 inspectedContext at:selectedLine put:value. |
|
158 ]. |
|
159 ! ! |