added: #findClass
authorClaus Gittinger <cg@exept.de>
Thu, 15 Oct 2009 18:07:30 +0200
changeset 2623 6e7e1b2b961f
parent 2622 e55f43981463
child 2624 d8957c9cb38c
added: #findClass
Tools__ObjectModuleInformation.st
--- a/Tools__ObjectModuleInformation.st	Wed Oct 14 17:33:36 2009 +0200
+++ b/Tools__ObjectModuleInformation.st	Thu Oct 15 18:07:30 2009 +0200
@@ -408,6 +408,11 @@
             translateLabel: true
           )
          (MenuItem
+            label: 'Find a Class...'
+            itemValue: findClass
+            translateLabel: true
+          )
+         (MenuItem
             label: '-'
           )
          (MenuItem
@@ -1199,6 +1204,43 @@
     self window setClipboardText:text.
 !
 
+findClass
+    |class moduleIndex classNamesShown classIndex|
+
+    class := Dialog requestClass:'Classname (Tab for completion):'.
+    class isEmptyOrNil ifTrue:[^ self].
+
+    moduleIndex := allModules findFirst:[:module | module isSymbol not and:[module classNames includes:class name]].
+    moduleIndex == 0 ifTrue:[
+        Dialog information:'Class is not contained in a loaded or builtIn package.'.
+        ^ self
+    ].
+    self selectedModuleIndexHolder value:moduleIndex.
+
+    classNamesShown := self shownClassNamesFor:(self selectedModuleInfo).
+    classIndex := classNamesShown indexOf:class name.
+    self selectedInfoIndexHolder value:classIndex.
+
+"/    module := allModules at:moduleIndex.
+"/    info := self selectedModuleInfo.
+"/    classNames := (self shownClassNamesFor:info) asSortedCollection.
+"/    selectedClassName := classNames at:(self selectedInfoIndex).
+"/    selectedClass := Smalltalk classNamed:selectedClassName.
+"/
+"/    selectedClass notNil ifTrue:[
+"/        Smalltalk browseInClass:selectedClass.
+"/        ^ self.
+"/    ].
+"/
+"/    "/ clicked on an extensions-module ?
+"/    (self isExtensionName:selectedClassName) ifTrue:[
+"/        self browseModuleExtensions.
+"/        ^ self.
+"/    ].
+"/
+"/    self breakPoint:#cg.
+!
+
 loadPackage
     |package ok|
 
@@ -1345,7 +1387,7 @@
                                     ].
 
         "/ sorting by reverse id brings newest ones to the top (a side effect)
-        allModules sort:[:a :b | (a id) > (b id)].
+        allModules sort:[:a :b | (a name) < (b name)].
         moduleNames := allModules collect:[:entry | entry name].
         listOfModuleNames addAll:moduleNames.
         handles addAll:allModules.