MethodSelectionBrowser.st
author tz
Sun, 22 Feb 1998 21:37:09 +0100
changeset 664 6ed67e67d321
parent 650 495b35593c09
child 665 be9ead6a517b
permissions -rw-r--r--
label for class tree added

"
 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

    "
    MethodSelectionBrowser
        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'
      #'labelAlignment:' #left
      #model: #selector
      #canSelect: false
  )
   (#DataSetColumnSpec
      #label: ' Type'
      #'labelAlignment:' #left
      #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

    |message type row|
    message := super openOnSuperclass: aSuperclassOrSymbol 
        andClass: aClassOrSymbol 
        andSelector: aSelector 
        withResourceTypes: aResourceTypes.

    (message notNil and:
    [((row := self selectionOfResource value) notNil and:
    [(type := row type) = 'class'])])
    ifTrue:
    [   
        message := message replChar:$  withString: ' class '
    ].
    ^message



! !

!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$'
! !