Tools__ViewTreeApplication.st
changeset 3174 cd45c49a0d63
parent 3171 16cec0f0e3b4
child 3183 cd02c3731897
     1.1 --- a/Tools__ViewTreeApplication.st	Sun Dec 14 18:01:38 2014 +0100
     1.2 +++ b/Tools__ViewTreeApplication.st	Thu Dec 18 00:52:06 2014 +0100
     1.3 @@ -437,7 +437,7 @@
     1.4       by the MenuEditor of ST/X."
     1.5  
     1.6      "Do not manually edit this!! If it is corrupted,
     1.7 -     the MenuEditor may not be able to read the specification."
     1.8 +     the MenuEditor may not be able to read the specification."      
     1.9  
    1.10  
    1.11      "
    1.12 @@ -580,6 +580,19 @@
    1.13                    label: '-'
    1.14                  )
    1.15                 (MenuItem
    1.16 +                  enabled: canBrowseWindowSpecMethod
    1.17 +                  label: 'Browse Window Spec Method'
    1.18 +                  itemValue: doBrowseWindowSpecMethod
    1.19 +                )
    1.20 +               (MenuItem
    1.21 +                  enabled: canEditWindowSpec
    1.22 +                  label: 'Edit Window Spec'
    1.23 +                  itemValue: doEditWindowSpec
    1.24 +                )
    1.25 +               (MenuItem
    1.26 +                  label: '-'
    1.27 +                )
    1.28 +               (MenuItem
    1.29                    enabled: hasTargetWidgetChannel
    1.30                    label: 'All Applications'
    1.31                    submenuChannel: submenuApplications:
    1.32 @@ -937,6 +950,14 @@
    1.33  
    1.34  !ViewTreeInspectorApplication methodsFor:'aspects'!
    1.35  
    1.36 +canBrowseWindowSpecMethod
    1.37 +    ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
    1.38 +!
    1.39 +
    1.40 +canEditWindowSpec
    1.41 +    ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
    1.42 +!
    1.43 +
    1.44  followFocusChannel
    1.45      "boolean holder, which indicates whether selection changed dependend on the focus view"
    1.46  
    1.47 @@ -1049,6 +1070,52 @@
    1.48       true:  no  input events are eaten and no  selection is shown on the target view."
    1.49  
    1.50      ^ model testModeChannel
    1.51 +!
    1.52 +
    1.53 +windowSpecMethodOfSelection
    1.54 +    |item view app spec builder specSelector implementors|
    1.55 +
    1.56 +    item := model selectedItem.
    1.57 +    item isNil ifTrue:[^ nil]. 
    1.58 +
    1.59 +    view := item widget.
    1.60 +    view isNil ifTrue:[^ nil]. 
    1.61 +
    1.62 +    app := view application.
    1.63 +    app isNil ifTrue:[^ nil]. 
    1.64 +
    1.65 +    builder := app builder.
    1.66 +    builder isNil ifTrue:[^ nil]. 
    1.67 +
    1.68 +    spec := builder spec.
    1.69 +    spec isNil ifTrue:[^ nil].
    1.70 +
    1.71 +    specSelector := spec name.
    1.72 +    specSelector isNil ifTrue:[^ nil].
    1.73 +
    1.74 +    (app class theNonMetaclass canUnderstand:specSelector) ifTrue:[
    1.75 +        ^ app class theNonMetaclass lookupMethodFor:specSelector.
    1.76 +    ].
    1.77 +    (app class theMetaclass canUnderstand:specSelector) ifTrue:[
    1.78 +        ^ app class theMetaclass lookupMethodFor:specSelector.
    1.79 +    ].
    1.80 +
    1.81 +    "/ maybe a simple dialog given a spec
    1.82 +    app masterApplication notNil ifTrue:[
    1.83 +        (app masterApplication class theNonMetaclass canUnderstand:specSelector) ifTrue:[     
    1.84 +            ^ app masterApplication class theNonMetaclass lookupMethodFor:specSelector.
    1.85 +        ].
    1.86 +        (app masterApplication class theMetaclass canUnderstand:specSelector) ifTrue:[    
    1.87 +            ^ app masterApplication class theMetaclass lookupMethodFor:specSelector.
    1.88 +        ].
    1.89 +    ].
    1.90 +
    1.91 +    implementors := Smalltalk allImplementorsOf: specSelector.
    1.92 +    implementors size == 1 ifTrue:[
    1.93 +        ^ implementors first compiledMethodAt:specSelector.
    1.94 +    ].
    1.95 +
    1.96 +    ^ nil
    1.97  ! !
    1.98  
    1.99  !ViewTreeInspectorApplication methodsFor:'change & update'!
   1.100 @@ -1063,8 +1130,9 @@
   1.101      |info view item|
   1.102  
   1.103      item := model selectedItem.
   1.104 -
   1.105 -    item notNil ifTrue:[ |state|
   1.106 +    item notNil ifTrue:[ 
   1.107 +        |state|
   1.108 +
   1.109          view := item widget.
   1.110  
   1.111          view id isNil ifTrue:[
   1.112 @@ -1078,7 +1146,6 @@
   1.113          ].
   1.114          info := '%1 [%2] - %3' bindWith:(view class name)
   1.115                                     with:(view name ? '') with:state allBold.
   1.116 -
   1.117      ] ifFalse:[
   1.118          info := ''
   1.119      ].
   1.120 @@ -1940,6 +2007,13 @@
   1.121      "Modified: / 28-08-2013 / 23:57:42 / cg"
   1.122  !
   1.123  
   1.124 +doBrowseWindowSpecMethod
   1.125 +    |mthd|
   1.126 +
   1.127 +    mthd := self windowSpecMethodOfSelection.
   1.128 +    NewSystemBrowser openInClass:mthd mclass selector:mthd selector
   1.129 +!
   1.130 +
   1.131  doCatchEvents
   1.132      model catchEvents:true.
   1.133      isCatchingEventsChannel value:true.
   1.134 @@ -1996,6 +2070,13 @@
   1.135      ].
   1.136  !
   1.137  
   1.138 +doEditWindowSpec
   1.139 +    |mthd|
   1.140 +
   1.141 +    mthd := self windowSpecMethodOfSelection.
   1.142 +    UIPainter openOnClass:mthd mclass andSelector:mthd selector
   1.143 +!
   1.144 +
   1.145  doFlash
   1.146      "flash the selected view"
   1.147