BrowserView.st
changeset 894 8efe0f142f40
parent 892 70512e323623
child 895 cc65b9425f63
--- a/BrowserView.st	Thu Jan 02 20:29:13 1997 +0100
+++ b/BrowserView.st	Fri Jan 03 12:19:25 1997 +0100
@@ -1127,6 +1127,39 @@
 
 !BrowserView methodsFor:'class category stuff'!
 
+changeNameSpaceTo:nsName
+    |n selectedClass str|
+
+    nsName = '* all *' ifTrue:[
+        currentNamespace := nsName.
+    ] ifFalse:[
+        n := Smalltalk at:nsName asSymbol.
+        n isNamespace ifTrue:[
+            currentNamespace := n.
+        ] ifFalse:[
+            ^ self
+        ]
+    ].
+
+    selectedClass := actualClass.
+    currentClass := actualClass := nil.
+    self classCategoryUpdate.
+
+    selectedClass notNil ifTrue:[
+        (currentNamespace = '* all *'
+        or:[currentNamespace ~= selectedClass nameSpace]) ifTrue:[
+            str := selectedClass name
+        ] ifFalse:[
+            str := selectedClass nameWithoutPrefix
+        ].
+
+        self switchToClassNamed:str
+    ]
+
+    "Created: 3.1.1997 / 11:11:13 / cg"
+    "Modified: 3.1.1997 / 11:20:10 / cg"
+!
+
 checkClassCategorySelected
     currentClassCategory isNil ifTrue:[
         self warn:'select a class category first'.
@@ -1523,14 +1556,22 @@
     self doClassMenu:[:currentClass |
         |v|
 
-        v := HTMLDocumentView
-            openFullOnText:(HTMLDocGenerator htmlDocOf:currentClass) 
-            inDirectory:(Smalltalk getSystemFileName:'doc/online/english').
-        v nameSpaceForExecution:(currentClass nameSpace).
+        Autoload autoloadFailedSignal handle:[:ex |
+            self warn:'autoload failed.
+
+Check your source directory and/or 
+the abbreviation file for the classes (correct) shortened name.'.
+            ex return.
+        ] do:[
+            v := HTMLDocumentView
+                    openFullOnText:(HTMLDocGenerator htmlDocOf:currentClass) 
+                    inDirectory:(Smalltalk getSystemFileName:'doc/online/english').
+            v nameSpaceForExecution:(currentClass nameSpace).
+        ]
     ]
 
     "Created: 18.5.1996 / 12:12:20 / cg"
-    "Modified: 23.12.1996 / 12:26:19 / cg"
+    "Modified: 3.1.1997 / 11:54:07 / cg"
 !
 
 classFileOut
@@ -1644,8 +1685,8 @@
     Autoload autoloadFailedSignal handle:[:ex |
         self warn:(resources string:'autoload of %1 failed.
 
-Check your source directory for a file named %1.st
-and/or the abbreviation file for its shortened name.') with:nm.
+Check your source directory for a file named %1.st and/or 
+the abbreviation file for its (correct) shortened name.') with:nm.
         ex return.
     ] do:[
         currentClass autoload.
@@ -1657,7 +1698,7 @@
         self switchToClassNamed:nameShown
     ]
 
-    "Modified: 20.12.1996 / 22:12:29 / cg"
+    "Modified: 3.1.1997 / 11:54:14 / cg"
 !
 
 classMenu
@@ -1744,6 +1785,22 @@
         ]
     ].
 
+    (currentClass notNil
+    and:[currentClass isLoaded not]) ifTrue:[
+        specialMenu disableAll:#(
+                                     classInstancesInspect
+                                     classFileOutBinary
+                                     classModifyContainer 
+                                     classRemoveContainer
+                                     classRevisionInfo 
+                                     classLoadRevision 
+                                     classCheckin
+                                     classCompareWithNewestInRepository
+                                     classPrimitiveDefinitions
+                                     classPrimitiveVariables
+                                     classPrimitiveFunctions).
+    ].
+
     device ctrlDown ifTrue:[
         ^ specialMenu
     ].
@@ -1761,6 +1818,8 @@
                            'definition'
                            'documentation'
                            '-'
+                           'class refs'
+                           '-'
                            'new class'
                            '-'
                            'load'
@@ -1769,6 +1828,8 @@
                            classDefinition
                            classDocumentation
                            nil
+                           classRefs
+                           nil
                            classNewClass
                            nil
                            classLoad
@@ -1906,7 +1967,7 @@
     m subMenuAt:#otherMenu put:specialMenu.
     ^ m
 
-    "Modified: 23.12.1996 / 13:10:07 / cg"
+    "Modified: 3.1.1997 / 11:59:05 / cg"
 !
 
 classNewClass
@@ -3394,7 +3455,7 @@
 classSelection:lineNr
     "user clicked on a class line - show method categories"
 
-    |cls nm oldSelector|
+    |cls nm oldSelector sel|
 
     (currentClassHierarchy notNil
      and:[fullProtocol]) ifTrue:[
@@ -3414,7 +3475,14 @@
         ^ self
     ].
 
-    nm := classListView selectionValue withoutSpaces.
+    (sel := classListView selectionValue) isNil ifTrue:[
+        self classCategorySelectionChanged. 
+        aspect := nil.
+        currentClass := actualClass := nil.
+        self updateCodeView.
+        ^ self
+    ].
+    nm := sel withoutSpaces.
     cls := self findClassNamed:nm.
     cls notNil ifTrue:[
         self switchToClass:cls.
@@ -3423,7 +3491,7 @@
         self warn:'oops - no class named: ' , nm , ' found in selected namespace(s)'.
     ]
 
-    "Modified: 20.12.1996 / 16:41:35 / cg"
+    "Modified: 3.1.1997 / 11:44:02 / cg"
 !
 
 classSelectionChanged
@@ -3882,6 +3950,13 @@
         self updateClassList.
         self switchToClass:theClass.
 
+"/        (currentNamespace = '* all *'
+"/        or:[currentNamespace ~= theClass nameSpace]) ifTrue:[
+"/            str := theClass name
+"/        ] ifFalse:[
+"/            str := theClass nameWithoutPrefix
+"/        ].
+
         l := classListView list.
         l notNil ifTrue:[
             idx := l findFirst:[:line | line withoutSpaces = str].
@@ -3891,15 +3966,17 @@
         ].
 
         self instanceProtocol:meta not.
-        self classSelectionChanged.
-        classCategoryListView notNil ifTrue:[
-            classCategoryListView setSelectElement:theClass category
+        idx ~~ 0 ifTrue:[
+            self classSelectionChanged.
+            classCategoryListView notNil ifTrue:[
+                classCategoryListView setSelectElement:theClass category
+            ]
         ]
     ]
 
     "Modified: 1.9.1995 / 01:41:35 / claus"
     "Modified: 17.6.1996 / 16:54:55 / stefan"
-    "Modified: 20.12.1996 / 22:09:13 / cg"
+    "Modified: 3.1.1997 / 11:45:46 / cg"
 !
 
 updateClassList
@@ -4654,23 +4731,7 @@
                                                 receiver:self).
     nsHolder onChangeSend:#value
                        to:[
-                               |nsName n ok|
-
-                               nsName := nsHolder value.
-                               nsName = '* all *' ifTrue:[
-                                  currentNamespace := nsName.
-                                  ok := true.
-                               ] ifFalse:[
-                                  n := Smalltalk at:nsName asSymbol.
-                                  n isNamespace ifTrue:[
-                                       currentNamespace := n.
-                                       ok := true
-                                  ]
-                               ].
-                               ok ifTrue:[
-                                   currentClass := actualClass := nil.
-                                   self classCategoryUpdate
-                               ] 
+                                self changeNameSpaceTo:nsHolder value
                           ].
 
     v := HVScrollableView for:SelectionInListView miniScrollerH:true miniScrollerV:false in:hpanel.
@@ -4682,7 +4743,7 @@
 
     self createCodeViewIn:vpanel
 
-    "Modified: 23.12.1996 / 13:22:26 / cg"
+    "Modified: 3.1.1997 / 11:11:35 / cg"
 !
 
 setupForClass:aClass
@@ -5227,7 +5288,7 @@
 !
 
 methodCategoryMenu
-    |labels selectors shorties i|
+    |labels selectors shorties i m|
 
     currentClass isNil ifTrue:[
         methodCategoryListView flash.
@@ -5301,12 +5362,22 @@
         shorties at:(selectors indexOf:#methodCategoryNewCategory) put:#Cmdn
     ].
 
-    ^ PopUpMenu 
+    m := PopUpMenu 
         labels:(resources array:labels)
         selectors:selectors
-        accelerators:shorties
-
-    "Modified: 27.10.1996 / 14:16:27 / cg"
+        accelerators:shorties.
+
+    currentClass isLoaded ifFalse:[
+        m disableAll:#(
+                        methodCategoryNewCategory
+                        methodCategoryCopyCategory
+                        methodCategoryCreateAccessMethods
+                      )
+    ].
+
+    ^ m
+
+    "Modified: 3.1.1997 / 11:56:36 / cg"
 !
 
 methodCategoryNewCategory
@@ -7836,7 +7907,7 @@
     "tell the codeView what to do on accept and explain"
 
     codeView acceptAction:[:theCode |
-        |cat cls|
+        |cat cls rslt|
 
         codeView cursor:Cursor execute.
 
@@ -7848,7 +7919,7 @@
         ].
         (cat notNil and:[cat notEmpty]) ifTrue:[
             fullProtocol ifTrue:[
-                cls := acceptClass "/actualClass whichClassIncludesSelector:currentSelector.
+                cls := acceptClass 
             ].
             cls isNil ifTrue:[
                 cls := actualClass
@@ -7857,15 +7928,15 @@
             Object abortSignal catch:[
                 lockUpdates := true.
 
-                actualClass compilerClass 
+                rslt := actualClass compilerClass 
                     compile:theCode asString
                     forClass:cls
                     inCategory:cat 
                     notifying:codeView.
 
                 codeView modified:false.
-                self updateMethodListWithScroll:false.
                 currentMethod := actualClass compiledMethodAt:currentSelector.
+                self updateMethodListWithScroll:false keepSelection:(rslt == currentMethod).
                 self normalLabel.
             ].
             lockUpdates := false.
@@ -7880,7 +7951,7 @@
                                 forClass:actualClass)
     ].
 
-    "Modified: 8.2.1996 / 18:19:47 / cg"
+    "Modified: 3.1.1997 / 12:17:33 / cg"
 !
 
 setDoitActionForClass
@@ -8422,7 +8493,7 @@
 !
 
 variableListMenu
-    |labels selectors|
+    |labels selectors m|
 
     currentClass isNil ifTrue:[
         variableListView flash.
@@ -8463,10 +8534,15 @@
                                 ).
     ].
 
-    ^ PopUpMenu labels:(resources array:labels)
-                selectors:selectors
-
-    "Modified: 13.12.1995 / 12:49:49 / cg"
+    m := PopUpMenu labels:(resources array:labels)
+                selectors:selectors.
+
+    currentClass isLoaded ifFalse:[
+        m disableAll
+    ].
+    ^ m
+
+    "Modified: 3.1.1997 / 11:57:27 / cg"
 !
 
 variableSelection:lineNr
@@ -8793,6 +8869,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.231 1997-01-02 19:21:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.232 1997-01-03 11:19:25 cg Exp $'
 ! !
 BrowserView initialize!