MethodSelectionBrowser.st
author tz
Tue, 24 Feb 1998 21:28:25 +0100
changeset 675 25a770a729fc
parent 666 8dc197e3e07b
child 680 49c81e9cc6f7
permissions -rw-r--r--
some help text changed

"
 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 protocol'
	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: ' Protocol'
      #'labelAlignment:' #left
      #model: #protocol
      #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; protocol: 'instance'])].
        (resourceTypes includes: #class) ifTrue: [
        self listOfResources addAll:
            (((Smalltalk at: clsName) 
                class selectors
                asOrderedCollection)
             collect: [:sel| Row new selector: sel; protocol: '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'!

protocol

    ^protocol


!

protocol: aString

    protocol := aString


!

selector

    ^selector

!

selector: aSymbol

    selector := aSymbol

! !

!MethodSelectionBrowser class methodsFor:'documentation'!

version
    ^ '$Header$'
! !