# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1486634207 0
# Thu Feb 09 09:56:47 2017 +0000
# Branch jv
# Node ID 9f54cb54204c6a6b75f65f7ab9bc90cc6cac932a
# Parent a294c60caf42b68bfcbb6fd4a7623f5354e48200
Issue #120: Fixed regression with Inspector2 not showing custom presentations
The cause was misuse and inconsistence between #application:, #applicationHolder:,
introduced by following commit:
* 9ff9bed9f98e: #OTHER by stefan
This commit cleans up a lot of code, making it simpler. Also fixes
the regression.
https://swing.fit.cvut.cz/projects/stx-jv/ticket/120
diff -r a294c60caf42 -r 9f54cb54204c Tools__Inspector2.st
a
|
b
|
|
24 | 24 | ! |
25 | 25 | |
26 | 26 | Model subclass:#NavigationState |
27 | | instanceVariableNames:'application theObject index tabs selectionIndex displayString' |
| 27 | instanceVariableNames:'inspector theObject index tabs selectionIndex displayString' |
28 | 28 | classVariableNames:'' |
29 | 29 | poolDictionaries:'' |
30 | 30 | privateIn:Inspector2 |
… |
… |
|
1305 | 1305 | | current new | |
1306 | 1306 | |
1307 | 1307 | new := NavigationState for: anObject. |
1308 | | new application:self. |
| 1308 | new inspector:self. |
1309 | 1309 | current := self currentState. |
1310 | 1310 | (current notNil "and:[anObject isKindOf: current theObject class]") ifTrue:[ |
1311 | 1311 | | currentTabLabel newSelectionIndex | |
… |
… |
|
1324 | 1324 | ^ new |
1325 | 1325 | |
1326 | 1326 | "Created: / 04-02-2015 / 15:27:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1327 | | "Modified: / 13-02-2015 / 20:44:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 1327 | "Modified: / 09-02-2017 / 09:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1328 | 1328 | ! |
1329 | 1329 | |
1330 | 1330 | setDoItActionForLanguage: language |
… |
… |
|
1353 | 1353 | "Modified: / 10-03-2015 / 09:46:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1354 | 1354 | ! ! |
1355 | 1355 | |
1356 | | |
1357 | 1356 | !Inspector2::NavigationState class methodsFor:'creating classes'! |
1358 | 1357 | |
1359 | 1358 | for:anObject |
… |
… |
|
1378 | 1377 | |
1379 | 1378 | !Inspector2::NavigationState methodsFor:'accessing'! |
1380 | 1379 | |
1381 | | application |
1382 | | ^ application |
1383 | | ! |
1384 | | |
1385 | 1380 | application:anInspectorApp |
1386 | | application := anInspectorApp. |
| 1381 | <resource: #obsolete> |
| 1382 | inspector := anInspectorApp. |
1387 | 1383 | ! |
1388 | 1384 | |
1389 | 1385 | index |
… |
… |
|
1394 | 1390 | index := something. |
1395 | 1391 | ! |
1396 | 1392 | |
| 1393 | inspector |
| 1394 | ^ inspector |
| 1395 | |
| 1396 | "Created: / 09-02-2017 / 09:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 1397 | ! |
| 1398 | |
| 1399 | inspector:anInspectorApp |
| 1400 | inspector := anInspectorApp. |
| 1401 | |
| 1402 | "Created: / 09-02-2017 / 09:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 1403 | ! |
| 1404 | |
1397 | 1405 | selectionIndex |
1398 | 1406 | selectionIndex isNil ifTrue:[^1]. |
1399 | 1407 | selectionIndex < 1 ifTrue:[^1]. |
… |
… |
|
1488 | 1496 | "kludge for ProtoObject, which does neither implement this selector |
1489 | 1497 | nor #perform:" |
1490 | 1498 | tab := Tools::Inspector2Tab new |
| 1499 | inspector: inspector; |
1491 | 1500 | priority: 90; |
1492 | 1501 | label:'Basic'; |
1493 | 1502 | view: (InspectorView new inspect:theObject); |
… |
… |
|
1500 | 1509 | "/ ex reject. |
1501 | 1510 | Logger error:'inspector setup: %1' with:ex description. |
1502 | 1511 | tab := Tools::Inspector2Tab new |
1503 | | application:application; |
| 1512 | inspector: inspector; |
1504 | 1513 | label:selector; |
1505 | 1514 | text:(ex description, Character cr, Character cr, |
1506 | 1515 | ex suspendedContext fullPrintAllString) |
… |
… |
|
1508 | 1517 | |
1509 | 1518 | (tab isKindOf:Tools::Inspector2Tab) ifTrue:[ |
1510 | 1519 | tabs add: tab. |
1511 | | tab |
1512 | | application:application; |
1513 | | setupView. |
| 1520 | tab inspector: inspector. |
1514 | 1521 | ] |
1515 | 1522 | |
1516 | 1523 | "Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
diff -r a294c60caf42 -r 9f54cb54204c Tools__Inspector2Tab.st
a
|
b
|
|
14 | 14 | "{ NameSpace: Tools }" |
15 | 15 | |
16 | 16 | Object subclass:#Inspector2Tab |
17 | | instanceVariableNames:'label view application priority viewHolder applicationHolder' |
| 17 | instanceVariableNames:'inspector label view application priority' |
18 | 18 | classVariableNames:'' |
19 | 19 | poolDictionaries:'' |
20 | 20 | category:'Interface-Inspector2' |
… |
… |
|
86 | 86 | ^ self new |
87 | 87 | priority: 0; |
88 | 88 | label:label; |
89 | | viewHolder: makeView; |
| 89 | view: makeView; |
90 | 90 | yourself |
91 | 91 | |
92 | 92 | " |
93 | 93 | GenericToolbarIconLibrary systemBrowserIcon inspect |
94 | 94 | " |
| 95 | |
| 96 | "Modified: / 09-02-2017 / 00:33:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
95 | 97 | ! ! |
96 | 98 | |
97 | 99 | !Inspector2Tab methodsFor:'accessing'! |
98 | 100 | |
99 | | application |
100 | | ^ application |
101 | | |
102 | | "Created: / 16-01-2008 / 16:51:05 / janfrog" |
103 | | ! |
104 | | |
105 | | application:anApplicationModelOrBlock |
106 | | application := anApplicationModelOrBlock. |
| 101 | application:anApplicationModelOrBlockOrValueModel |
| 102 | view := [ |
| 103 | ApplicationSubView new |
| 104 | client: anApplicationModelOrBlockOrValueModel value; |
| 105 | yourself |
| 106 | ]. |
107 | 107 | |
108 | 108 | "Created: / 16-01-2008 / 16:51:05 / janfrog" |
109 | 109 | "Modified: / 17-02-2008 / 08:58:34 / janfrog" |
| 110 | "Modified: / 09-02-2017 / 09:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
110 | 111 | ! |
111 | 112 | |
112 | | applicationHolder:something |
113 | | applicationHolder := something. |
| 113 | applicationHolder:aValueModelOrBlock |
| 114 | <resource: #obsolete> "/ use #application: |
| 115 | self application: aValueModelOrBlock |
| 116 | |
| 117 | "Modified: / 09-02-2017 / 09:23:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 118 | ! |
| 119 | |
| 120 | inspector: anInspector2 |
| 121 | inspector := anInspector2 |
| 122 | |
| 123 | "Created: / 09-02-2017 / 00:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
114 | 124 | ! |
115 | 125 | |
116 | 126 | label |
… |
… |
|
148 | 158 | |
149 | 159 | view |
150 | 160 | view isNil ifTrue:[ |
151 | | viewHolder notNil ifTrue:[ |
152 | | view := viewHolder value |
153 | | ] ifFalse:[ |
154 | | applicationHolder notNil ifTrue:[ |
155 | | view := ApplicationSubView new. |
156 | | view client: applicationHolder value. |
157 | | ] |
| 161 | application notNil ifTrue:[ |
| 162 | view := ApplicationSubView new. |
| 163 | view client: application value. |
158 | 164 | ] |
| 165 | ] ifFalse:[ |
| 166 | view isBlock ifTrue:[ |
| 167 | view := view value. |
| 168 | ]. |
159 | 169 | ]. |
| 170 | self setupView. |
160 | 171 | ^ view |
161 | 172 | |
162 | 173 | "Created: / 16-01-2008 / 16:51:05 / janfrog" |
163 | 174 | "Modified: / 17-02-2008 / 10:38:59 / janfrog" |
164 | 175 | "Modified: / 13-06-2012 / 14:57:25 / cg" |
165 | | "Modified: / 24-03-2014 / 18:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 176 | "Modified: / 09-02-2017 / 09:24:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
166 | 177 | ! |
167 | 178 | |
168 | | view:aViewOrBlock |
169 | | aViewOrBlock isBlock ifTrue:[ |
170 | | viewHolder := aViewOrBlock |
171 | | ] ifFalse:[ |
172 | | view := aViewOrBlock. |
173 | | ] |
| 179 | view:aViewOrBlockOrValueModel |
| 180 | view := aViewOrBlockOrValueModel. |
| 181 | |
174 | 182 | |
175 | 183 | "Created: / 16-01-2008 / 16:51:05 / janfrog" |
176 | 184 | "Modified: / 17-02-2008 / 08:58:46 / janfrog" |
177 | 185 | "Modified: / 21-05-2015 / 21:31:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
178 | 186 | ! |
179 | 187 | |
180 | | viewHolder:something |
181 | | viewHolder := something. |
| 188 | viewHolder:aValueModelOrBlock |
| 189 | <resource: #obsolete> "/ use #view: |
| 190 | self view: aValueModelOrBlock |
| 191 | |
| 192 | "Modified: / 09-02-2017 / 09:23:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
182 | 193 | ! |
183 | 194 | |
184 | 195 | viewOrNil |
… |
… |
|
193 | 204 | |
194 | 205 | (view respondsTo:#setMasterInspectorApplication:) ifTrue:[ |
195 | 206 | "this is for BridgeOjectInspectorView" |
196 | | view setMasterInspectorApplication:application. |
| 207 | view setMasterInspectorApplication:inspector. |
197 | 208 | ]. |
198 | 209 | (view respondsTo:#sortOrderHolder:) ifTrue:[ |
199 | | view sortOrderHolder:(application sortOrderHolder) |
| 210 | view sortOrderHolder:(inspector sortOrderHolder) |
200 | 211 | ]. |
| 212 | |
| 213 | "Modified: / 09-02-2017 / 09:24:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
201 | 214 | ! ! |
202 | 215 | |
203 | 216 | !Inspector2Tab class methodsFor:'documentation'! |