MethodSelectionBrowser.st
author tz
Wed, 18 Feb 1998 21:33:25 +0100
changeset 647 4a16c0a3be56
parent 646 d2fc253819c1
child 650 495b35593c09
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice. This software may not
 be provided or otherwise made available to, or used by, any
 other person. No title to or ownership of the software is
 hereby transferred.
"



ResourceSelectionBrowser subclass:#MethodSelectionBrowser
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Dialogs'
!

Object subclass:#Row
	instanceVariableNames:'selector type'
	classVariableNames:''
	poolDictionaries:''
	privateIn:MethodSelectionBrowser
!

!MethodSelectionBrowser class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice. This software may not
 be provided or otherwise made available to, or used by, any
 other person. No title to or ownership of the software is
 hereby transferred.
"


!

documentation
"
    [start with:]
        MethodSelectionBrowser open

    [author:]
        Thomas Zwick
"

! !

!MethodSelectionBrowser class methodsFor:'instance creation'!

request: aTitle onSuperclass: aSuperclass andClass: aClass andSelector: aSelector withTypes: aResourceTypes

    "self
        request: 'Select A Method'
        onSuperclass: #ApplicationModel 
        andClass: #ToolApplicationModel 
        andSelector: #saveIcon 
        withTypes: #(class)  
    "

    ^self new
        title: aTitle;
        openOnSuperclass: aSuperclass
        andClass: aClass
        andSelector: aSelector
        withTypes: aResourceTypes


! !

!MethodSelectionBrowser class methodsFor:'list specs'!

columnsOfDataSetView

  ^ #(
   #(#DataSetColumnSpec
      #label: 'Selector'
      #model: #selector
      #canSelect: false
  )
   (#DataSetColumnSpec
      #label: 'Type'
      #model: #type
      #canSelect: false
  ))




! !

!MethodSelectionBrowser methodsFor:'callbacks - user'!

classSelected: anIndex

    self selectionOfClass value isNil ifTrue: [^nil].
    self withWaitCursorDo:
    [
        |clsName|
        resourceTypes isNil ifTrue: [resourceTypes := #(instance class)].
        clsName := self listOfClassesView list at: anIndex.
        self valueOfClassName value: clsName.
        self class lastSelection: clsName.
        (resourceTypes includes: #instance) ifTrue: [
        self listOfResources contents:
            (((Smalltalk at: clsName) 
                selectors
                asOrderedCollection)
             collect: [:sel| Row new selector: sel; type: 'instance'])].
        (resourceTypes includes: #class) ifTrue: [
        self listOfResources addAll:
            (((Smalltalk at: clsName) 
                class selectors
                asOrderedCollection)
             collect: [:sel| Row new selector: sel; type: 'class'])].
    ]


! !

!MethodSelectionBrowser methodsFor:'instance creation'!

openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withTypes: aResourceTypes

    ^super openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes



! !

!MethodSelectionBrowser methodsFor:'startup / release'!

postBuildWith:aBuilder

    title := 'Method Selection Browser'.

    ^super postBuildWith:aBuilder

! !

!MethodSelectionBrowser::Row methodsFor:'accessing'!

selector

    selector isNil ifTrue: [selector := method who methodSelector].
    ^selector

!

selector: aSymbol

    selector := aSymbol

!

type

    ^type


!

type: aString

    type := aString


! !

!MethodSelectionBrowser class methodsFor:'documentation'!

version
    ^ '$Header$'
! !