MethodSelectionBrowser.st
changeset 646 d2fc253819c1
child 650 495b35593c09
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MethodSelectionBrowser.st	Wed Feb 18 21:32:17 1998 +0100
@@ -0,0 +1,183 @@
+"
+ 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$'
+! !