BrowserView.st
changeset 1918 9beb5abaa3a5
parent 1913 b5d55f160224
child 1934 f10eff0533d0
equal deleted inserted replaced
1917:200617958f79 1918:9beb5abaa3a5
   390     ^Icon
   390     ^Icon
   391         constantNamed:#'BrowserView traceIcon'
   391         constantNamed:#'BrowserView traceIcon'
   392         ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@B**** ****(B%UU(@)UUZ@B%UZ@@)UV @B%V @@)U(@@B%(@@@)Z@@@B*@@@@* @@@B @@@@(@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@A??''?>O?0??A?8G? O<@?0A>@G8@O@@<@A @F@@@@b') ; yourself); yourself]! !
   392         ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@B**** ****(B%UU(@)UUZ@B%UZ@@)UV @B%V @@)U(@@B%(@@@)Z@@@B*@@@@* @@@B @@@@(@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@A??''?>O?0??A?8G? O<@?0A>@G8@O@@<@A @F@@@@b') ; yourself); yourself]! !
   393 
   393 
   394 !BrowserView class methodsFor:'interface specs'!
   394 !BrowserView class methodsFor:'interface specs'!
       
   395 
       
   396 methodMoveDialogSpec
       
   397     "This resource specification was automatically generated
       
   398      by the UIPainter of ST/X."
       
   399 
       
   400     "Do not manually edit this!! If it is corrupted,
       
   401      the UIPainter may not be able to read the specification."
       
   402 
       
   403     "
       
   404      UIPainter new openOnClass:BrowserView andSelector:#methodMoveDialogSpec
       
   405      BrowserView new openInterface:#methodMoveDialogSpec
       
   406     "
       
   407 
       
   408     <resource: #canvas>
       
   409 
       
   410     ^
       
   411      
       
   412        #(#FullSpec
       
   413           #window: 
       
   414            #(#WindowSpec
       
   415               #name: 'Move method to:'
       
   416               #layout: #(#LayoutFrame 290 0 207 0 628 0 334 0)
       
   417               #label: 'Move method to:'
       
   418               #min: #(#Point 10 10)
       
   419               #max: #(#Point 1280 1024)
       
   420               #bounds: #(#Rectangle 290 207 629 335)
       
   421               #usePreferredExtent: false
       
   422           )
       
   423           #component: 
       
   424            #(#SpecCollection
       
   425               #collection: 
       
   426                #(
       
   427                  #(#LabelSpec
       
   428                     #name: 'Label1'
       
   429                     #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 38 0)
       
   430                     #label: 'Move method to which class:'
       
   431                     #translateLabel: true
       
   432                     #adjust: #left
       
   433                 )
       
   434                  #(#ComboBoxSpec
       
   435                     #name: 'ComboBox1'
       
   436                     #layout: #(#LayoutFrame 0 0.0 41 0 0 1.0 66 0)
       
   437                     #model: #className
       
   438                     #comboList: #classList
       
   439                     #useIndex: true
       
   440                 )
       
   441                  #(#HorizontalPanelViewSpec
       
   442                     #name: 'HorizontalPanel1'
       
   443                     #layout: #(#LayoutFrame 0 0.0 -48 1.0 0 1.0 0 1.0)
       
   444                     #component: 
       
   445                      #(#SpecCollection
       
   446                         #collection: 
       
   447                          #(
       
   448                            #(#ActionButtonSpec
       
   449                               #name: 'Button1'
       
   450                               #label: 'Cancel'
       
   451                               #translateLabel: true
       
   452                               #model: #cancel
       
   453                               #extent: #(#Point 165 27)
       
   454                           )
       
   455                            #(#ActionButtonSpec
       
   456                               #name: 'Button2'
       
   457                               #label: 'Move'
       
   458                               #translateLabel: true
       
   459                               #model: #accept
       
   460                               #isDefault: true
       
   461                               #extent: #(#Point 165 27)
       
   462                           )
       
   463                         )
       
   464                     )
       
   465                     #horizontalLayout: #fitSpace
       
   466                     #verticalLayout: #centerMax
       
   467                     #horizontalSpace: 3
       
   468                     #verticalSpace: 3
       
   469                 )
       
   470               )
       
   471           )
       
   472       )
       
   473 !
   395 
   474 
   396 repositoryLoadSpec
   475 repositoryLoadSpec
   397     "This resource specification was automatically generated
   476     "This resource specification was automatically generated
   398      by the UIPainter of ST/X."
   477      by the UIPainter of ST/X."
   399 
   478 
  7914                 isSelector:true
  7993                 isSelector:true
  7915 
  7994 
  7916     "Modified: 10.7.1996 / 12:40:07 / cg"
  7995     "Modified: 10.7.1996 / 12:40:07 / cg"
  7917 !
  7996 !
  7918 
  7997 
       
  7998 methodInheritance
       
  7999     "launch a browser showing inherited (and overwritten) methods"
       
  8000 
       
  8001     |methodList|
       
  8002 
       
  8003     currentClass isNil ifTrue:[^ self].
       
  8004     currentSelector isNil ifTrue:[^ self].
       
  8005 
       
  8006     methodList := OrderedCollection new.
       
  8007     actualClass allSuperclasses do:[:aClass |
       
  8008         |m|
       
  8009 
       
  8010         m := aClass compiledMethodAt:currentSelector.
       
  8011         m notNil ifTrue:[
       
  8012             methodList addFirst:m
       
  8013         ]
       
  8014     ].
       
  8015     methodList size == 0 ifTrue:[
       
  8016         ^ self information:(resources
       
  8017                                 string:'''%1'' does not redefine any inherited method'
       
  8018                                 with:currentSelector).
       
  8019     ].
       
  8020     methodList addLast:(actualClass compiledMethodAt:currentSelector).
       
  8021     SystemBrowser 
       
  8022         browseMethods:methodList 
       
  8023         title:(resources string:'''%1'' inheritance & redefinition' with:currentSelector)
       
  8024         sort:false
       
  8025 !
       
  8026 
  7919 methodInspect
  8027 methodInspect
  7920     "inspect  the current method"
  8028     "inspect  the current method"
  7921 
  8029 
  7922     self checkMethodSelected ifFalse:[^ self].
  8030     self checkMethodSelected ifFalse:[^ self].
  7923     currentMethod inspect.
  8031     currentMethod inspect.
  8168         fileItems :=           #(
  8276         fileItems :=           #(
  8169                                 ('fileOut'       methodFileOut  )
  8277                                 ('fileOut'       methodFileOut  )
  8170                                 ('printOut'      methodPrintOut )
  8278                                 ('printOut'      methodPrintOut )
  8171                                 ('-'             nil            )
  8279                                 ('-'             nil            )
  8172                                 ('SPAWN_METHOD'  methodSpawn    )
  8280                                 ('SPAWN_METHOD'  methodSpawn    )
       
  8281                                 ('inheritance'   methodInheritance )
  8173                                 ('-'             nil            )
  8282                                 ('-'             nil            )
  8174                                 ).
  8283                                 ).
  8175 
  8284 
  8176         sepLocalItems := #(('-')). 
  8285         sepLocalItems := #(('-')). 
  8177 
  8286 
  8250 !
  8359 !
  8251 
  8360 
  8252 methodMove
  8361 methodMove
  8253     "move the current method into another class; typically a superclass"
  8362     "move the current method into another class; typically a superclass"
  8254 
  8363 
  8255     |newClass newClassName sup initial movedMethod list holders|
  8364     |newClass newClassName sup initial movedMethod 
       
  8365      supers subs list holders|
  8256 
  8366 
  8257     self checkMethodSelected ifFalse:[^ self].
  8367     self checkMethodSelected ifFalse:[^ self].
  8258 
  8368 
  8259     lastMethodMoveClass ~= currentClass name ifTrue:[
  8369     lastMethodMoveClass ~= currentClass name ifTrue:[
  8260         initial := lastMethodMoveClass.
  8370         initial := lastMethodMoveClass.
  8266         ] ifFalse:[
  8376         ] ifFalse:[
  8267             initial := nil.
  8377             initial := nil.
  8268         ].
  8378         ].
  8269     ].
  8379     ].
  8270 
  8380 
       
  8381     supers := (currentClass allSuperclasses reverse collect:[:cls | cls name]).
       
  8382     subs := (currentClass allSubclasses collect:[:cls | cls name]).
       
  8383     list := supers.
       
  8384     (supers notEmpty and:[subs notEmpty]) ifTrue:[
       
  8385         list := list , (Array with:'---- ' , currentClass name , ' ----')
       
  8386     ].
       
  8387     list := list , subs.
       
  8388 
       
  8389 
  8271 "/ preps to use windowSpecs ...
  8390 "/ preps to use windowSpecs ...
  8272 "/
       
  8273 "/    list := (currentClass allSuperclasses collect:[:cls | cls name]).
       
  8274 "/    list := list , (currentClass allSubclasses collect:[:cls | cls name]).
       
  8275 "/
  8391 "/
  8276 "/    holders := IdentityDictionary new.
  8392 "/    holders := IdentityDictionary new.
  8277 "/    holders at:#className put:initial asValue.
  8393 "/    holders at:#className put:initial asValue.
  8278 "/    holders at:#classList put:list.
  8394 "/    holders at:#classList put:list.
  8279 "/
  8395 "/
  8280 "/    (SystemBrowser 
  8396 "/    (SystemBrowser 
  8281 "/        openDialogInterface:#methodMoveDialogSpec
  8397 "/      openDialogInterface:#methodMoveDialogSpec
  8282 "/        withBindings:holders) ifTrue:[
  8398 "/      withBindings:holders) ifFalse:[
  8283 "/        newClassName := (holders at:#className) value.
  8399 "/        ^ self
  8284 "/    ].
  8400 "/    ].
       
  8401 "/    newClassName := (holders at:#className) value.
  8285 
  8402 
  8286     newClassName := Dialog 
  8403     newClassName := Dialog 
  8287                     request:(resources string:'move current method to which class:')
  8404                     request:(resources string:'move current method to which class:')
  8288                     initialAnswer:initial
  8405                     initialAnswer:initial
  8289                     okLabel:(resources string:'move')
  8406                     okLabel:(resources string:'move')
  8290                     title:(resources string:'move method')
  8407                     title:(resources string:'move method')
  8291                     onCancel:nil.
  8408                     onCancel:nil
       
  8409                     list:list.
  8292     newClassName isNil ifTrue:[^ self].
  8410     newClassName isNil ifTrue:[^ self].
       
  8411     (newClassName startsWith:'---- ') ifTrue:[^ self].
  8293 
  8412 
  8294     newClass := Smalltalk classNamed:newClassName.
  8413     newClass := Smalltalk classNamed:newClassName.
  8295     newClass isNil ifTrue:[
  8414     newClass isNil ifTrue:[
  8296         self warn:'no such class'.
  8415         self warn:'no such class'.
  8297         ^ self
  8416         ^ self
 12422 ! !
 12541 ! !
 12423 
 12542 
 12424 !BrowserView class methodsFor:'documentation'!
 12543 !BrowserView class methodsFor:'documentation'!
 12425 
 12544 
 12426 version
 12545 version
 12427     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.454 1998-10-05 10:20:55 cg Exp $'
 12546     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.455 1998-10-09 14:15:46 cg Exp $'
 12428 ! !
 12547 ! !
 12429 BrowserView initialize!
 12548 BrowserView initialize!