Tools__ViewTreeApplication.st
changeset 2888 9adfb8a84696
parent 2779 10fef360ad85
child 2978 a952dfdb1b6a
equal deleted inserted replaced
2887:01e4c1a45e35 2888:9adfb8a84696
   509           )
   509           )
   510          )
   510          )
   511         nil
   511         nil
   512         nil
   512         nil
   513       )
   513       )
       
   514 
       
   515     "Modified: / 27-04-2012 / 14:13:17 / cg"
   514 !
   516 !
   515 
   517 
   516 middleButtonMenu
   518 middleButtonMenu
   517     "This resource specification was automatically generated
   519     "This resource specification was automatically generated
   518      by the MenuEditor of ST/X."
   520      by the MenuEditor of ST/X."
  1365             list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
  1367             list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]).
  1366         ].
  1368         ].
  1367     ].
  1369     ].
  1368     list add:(MenuDesc separator).
  1370     list add:(MenuDesc separator).
  1369 
  1371 
  1370     (view respondsTo:#'model:') ifTrue:[
  1372     (view respondsTo:#'model') ifTrue:[
  1371         inst := view model.
  1373         inst := view model.
  1372 
  1374 
  1373         inst isNil ifTrue:[ label := value := nil ]
  1375         inst isNil 
  1374                   ifFalse:[ label := inst displayString.
  1376             ifTrue:[ label := value := nil ]
  1375                             value := [ view model inspect ].
  1377             ifFalse:[ label := inst displayString.
  1376                           ].
  1378                       label := label,(self aspectLabelFor:inst inApplicationOf:view).  
       
  1379                       value := [ view model inspect ].
       
  1380                     ].
  1377 
  1381 
  1378         list add:(MenuDesc title:'model' value:label action:value).
  1382         list add:(MenuDesc title:'model' value:label action:value).
  1379 
  1383 
  1380         (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
  1384         (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[
  1381             view modelInterface keysAndValuesDo:[:key : val|
  1385             view modelInterface keysAndValuesDo:[:key : val|
  1390     (view respondsTo:#enableChannel) ifTrue:[
  1394     (view respondsTo:#enableChannel) ifTrue:[
  1391         inst := view enableChannel.
  1395         inst := view enableChannel.
  1392 
  1396 
  1393         inst isNil ifTrue:[ label := value := nil ]
  1397         inst isNil ifTrue:[ label := value := nil ]
  1394                   ifFalse:[ label := inst displayString.
  1398                   ifFalse:[ label := inst displayString.
       
  1399                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1395                             value := [ view enableChannel inspect ].
  1400                             value := [ view enableChannel inspect ].
  1396                           ].
  1401                           ].
  1397 
  1402 
  1398         list add:(MenuDesc title:'enableChannel' value:label action:value).
  1403         list add:(MenuDesc title:'enableChannel' value:label action:value).
  1399     ].
  1404     ].
  1400 
  1405 
  1401     #( #action #pressaAction #releaseAction ) do:[:actionSelector |
  1406     #( #action #pressAction #releaseAction ) do:[:actionSelector |
  1402         (view respondsTo:actionSelector) ifTrue:[
  1407         (view respondsTo:actionSelector) ifTrue:[
  1403             inst := view perform:actionSelector.
  1408             inst := view perform:actionSelector.
  1404 
  1409 
  1405             inst isNil 
  1410             inst isNil 
  1406                 ifTrue:[ label := value := nil ]
  1411                 ifTrue:[ label := value := nil ]
  1417     (view respondsTo:#listHolder) ifTrue:[
  1422     (view respondsTo:#listHolder) ifTrue:[
  1418         inst := view listHolder.
  1423         inst := view listHolder.
  1419 
  1424 
  1420         inst isNil ifTrue:[ label := value := nil ]
  1425         inst isNil ifTrue:[ label := value := nil ]
  1421                   ifFalse:[ label := inst class printString.
  1426                   ifFalse:[ label := inst class printString.
       
  1427                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1422                             value := [ view listHolder inspect ].
  1428                             value := [ view listHolder inspect ].
  1423                           ].
  1429                           ].
  1424         list add:(MenuDesc title:'listHolder' value:label action:value).
  1430         list add:(MenuDesc title:'listHolder' value:label action:value).
  1425     ].
  1431     ].
  1426 
  1432 
  1427     (view respondsTo:#list) ifTrue:[
  1433     (view respondsTo:#list) ifTrue:[
  1428         inst := view list.
  1434         inst := view list.
  1429 
  1435 
  1430         inst isNil ifTrue:[ label := value := nil ]
  1436         inst isNil ifTrue:[ label := value := nil ]
  1431                   ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
  1437                   ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
       
  1438                             label := label,(self aspectLabelFor:inst inApplicationOf:view).  
  1432                             value := [ view list inspect ].
  1439                             value := [ view list inspect ].
  1433                           ].
  1440                           ].
  1434 
  1441 
  1435         list add:(MenuDesc title:'list' value:label action:value).
  1442         list add:(MenuDesc title:'list' value:label action:value).
  1436     ].
  1443     ].
  1437 
  1444 
  1438     list last isSeparator ifTrue:[ list removeLast ].
  1445     list last isSeparator ifTrue:[ list removeLast ].
  1439   ^ MenuDesc buildFromList:list onGC:aMenu
  1446     ^ MenuDesc buildFromList:list onGC:aMenu
  1440 
  1447 
  1441     "Modified: / 11-05-2010 / 12:53:24 / cg"
  1448     "Modified: / 27-04-2012 / 14:22:34 / cg"
  1442 !
  1449 !
  1443 
  1450 
  1444 submenuVisibility:aMenu
  1451 submenuVisibility:aMenu
  1445     "builds and returns the geometry submenu"
  1452     "builds and returns the geometry submenu"
  1446 
  1453 
  1474 
  1481 
  1475     ^ MenuDesc buildFromList:list onGC:aMenu
  1482     ^ MenuDesc buildFromList:list onGC:aMenu
  1476 ! !
  1483 ! !
  1477 
  1484 
  1478 !ViewTreeInspectorApplication methodsFor:'private'!
  1485 !ViewTreeInspectorApplication methodsFor:'private'!
       
  1486 
       
  1487 aspectLabelFor:aModel inApplicationOf:aView
       
  1488     |app|
       
  1489 
       
  1490     aModel isNil ifTrue:[^ ''].
       
  1491     aView isNil ifTrue:[^ ''].
       
  1492     (app := aView application) isNil ifTrue:[^ ''].
       
  1493     app builder bindings keysAndValuesDo:[:aspect :value |
       
  1494         value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
       
  1495     ].
       
  1496     app class allInstVarNames do:[:nm | 
       
  1497         (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
       
  1498     ].
       
  1499 
       
  1500     ^ ''
       
  1501 
       
  1502     "Created: / 27-04-2012 / 14:22:09 / cg"
       
  1503 !
  1479 
  1504 
  1480 selectFocusView
  1505 selectFocusView
  1481     |rootView focusView|
  1506     |rootView focusView|
  1482 
  1507 
  1483     rootView := model rootView.
  1508     rootView := model rootView.