allow browserClass to be set in preferences
authorClaus Gittinger <cg@exept.de>
Tue, 15 Aug 2000 16:12:55 +0200
changeset 2696 bc8ab69f2a56
parent 2695 6cf8801118a3
child 2697 b4f4e431b71e
allow browserClass to be set in preferences
AbstractLauncherApplication.st
--- a/AbstractLauncherApplication.st	Fri Aug 11 19:35:06 2000 +0200
+++ b/AbstractLauncherApplication.st	Tue Aug 15 16:12:55 2000 +0200
@@ -121,6 +121,30 @@
 
 !AbstractLauncherApplication methodsFor:'private'!
 
+findApplicationClass:classOrClassName nameSpace:aNameSpace
+    "find some application, given the classes name.
+     Look for it in Smalltalk and the given nameSpace"
+
+    |cls|
+
+    classOrClassName isBehavior ifTrue:[
+        cls := classOrClassName.
+    ] ifFalse:[
+        cls := Smalltalk at:classOrClassName asSymbol.
+        cls isNil ifTrue:[
+            "/ look if its in the nameSpace
+            aNameSpace notNil ifTrue:[
+                cls := aNameSpace at:classOrClassName asSymbol
+            ]
+        ].
+        cls isNil ifTrue:[
+            self warn:(resources string:'Sorry, the %1 class is not available.' with:classOrClassName).
+            ^ nil
+        ].
+    ].
+    ^ cls
+!
+
 findWindow:title
     "a helper for find & destroy and find & raise operations;
      let user choose a view and return it; return nil on cancel"
@@ -208,30 +232,18 @@
 
     |cls|
 
-    classOrClassName isBehavior ifTrue:[
-	cls := classOrClassName.
-    ] ifFalse:[
-	cls := Smalltalk at:classOrClassName asSymbol.
-	cls isNil ifTrue:[
-	    "/ look if its in the nameSpace
-	    aNameSpace notNil ifTrue:[
-		cls := aNameSpace at:classOrClassName asSymbol
-	    ]
-	].
-	cls isNil ifTrue:[
-	    self warn:(resources string:'Sorry, the %1 class is not available.' with:classOrClassName).
-	    ^ self
-	].
+    cls := self findApplicationClass:classOrClassName nameSpace:aNameSpace.
+    cls isNil ifTrue:[
+        ^ self
     ].
 
     Autoload autoloadFailedSignal handle:[:ex |
-	self warn:(resources string:'Sorry, the %1 class seems to be not available.' with:cls name)
+        self warn:(resources string:'Sorry, the %1 class seems to be not available.' with:cls name)
     ] do:[
-	self withWaitCursorDo:[
-	    cls perform:aSelector
-	]
+        self withWaitCursorDo:[
+            cls perform:aSelector
+        ]
     ]
-
 !
 
 pickAView
@@ -568,10 +580,9 @@
     "open a browser showing all breakPointed/traced methods
      (but, to get rid of them, there is also a menu itme to remove them all)"
 
-    SystemBrowser 
-	browseMethods: WrappedMethod allInstances 
-	title:'all breakPointed/traced methods'
-
+    UserPreferences current systemBrowserClass
+        browseMethods:(WrappedMethod allInstances)
+        title:'all breakPointed/traced methods'
 !
 
 browseImplementors
@@ -580,17 +591,17 @@
     |enterBox selector|
 
     enterBox := EnterBox 
-		    title:(resources at:'Browse implementors of:') withCRs
-		    okText:(resources at:'browse')
-		    action:[:acceptedString | selector := acceptedString].
+                    title:(resources at:'Browse implementors of:') withCRs
+                    okText:(resources at:'browse')
+                    action:[:acceptedString | selector := acceptedString].
     enterBox showAtPointer.
 
     selector notNil ifTrue:[
-	self withWaitCursorDo:[
-	    SystemBrowser browseImplementorsOf:selector
-	]  
+        self withWaitCursorDo:[
+            UserPreferences current systemBrowserClass
+                browseImplementorsOf:selector
+        ]  
     ].
-
 !
 
 browseResources
@@ -626,30 +637,30 @@
     box destroy.
 
     box accepted ifTrue:[
-	rsrc := resourceHolder value.
-	value := valueHolder value.
-
-	(rsrc size == 0 or:[rsrc = '*' or:[rsrc = anyString]]) ifTrue:[
-	    t := 'methods with any resource'.
-	    rsrc := nil
-	] ifFalse:[
-	    t := 'methods with #' , rsrc , '-resource'.
-	    rsrc := rsrc withoutSeparators asSymbol
-	].
-	(value size == 0 or:[value = '*']) ifTrue:[
-	    t := t , ' and any value'.
-	    value := nil
-	] ifFalse:[
-	    t := t , ' and value ' , value.
-	].
-	self withWaitCursorDo:[
-	    SystemBrowser browseForResource:rsrc
-			  containing:value
-			  in:(Smalltalk allClasses)
-			  title:t
-	]  
+        rsrc := resourceHolder value.
+        value := valueHolder value.
+
+        (rsrc size == 0 or:[rsrc = '*' or:[rsrc = anyString]]) ifTrue:[
+            t := 'methods with any resource'.
+            rsrc := nil
+        ] ifFalse:[
+            t := 'methods with #' , rsrc , '-resource'.
+            rsrc := rsrc withoutSeparators asSymbol
+        ].
+        (value size == 0 or:[value = '*']) ifTrue:[
+            t := t , ' and any value'.
+            value := nil
+        ] ifFalse:[
+            t := t , ' and value ' , value.
+        ].
+        self withWaitCursorDo:[
+            UserPreferences current systemBrowserClass
+                browseForResource:rsrc
+                containing:value
+                in:(Smalltalk allClasses)
+                title:t
+        ]  
     ].
-
 !
 
 browseSenders
@@ -658,29 +669,28 @@
     |enterBox selector|
 
     enterBox := EnterBox 
-		    title:(resources at:'Browse senders of:') withCRs
-		    okText:(resources at:'browse')
-		    action:[:acceptedString | selector := acceptedString].
+                    title:(resources at:'Browse senders of:') withCRs
+                    okText:(resources at:'browse')
+                    action:[:acceptedString | selector := acceptedString].
     enterBox showAtPointer.
 
     selector notNil ifTrue:[
-	self withWaitCursorDo:[
-	    SystemBrowser browseAllCallsOn:selector
-	]  
+        self withWaitCursorDo:[
+            UserPreferences current systemBrowserClass
+                browseAllCallsOn:selector
+        ]  
     ].
-
 !
 
 browseUndeclared
     "open a browser on methods refering to undeclared variables"
 
     self withWaitCursorDo:[
-	SystemBrowser 
-	    browseReferendsOf:(Smalltalk underclaredPrefix , '*')
-	    title:(resources string:'references to undeclared variables')
-	    warnIfNone:true
+        UserPreferences current systemBrowserClass
+            browseReferendsOf:(Smalltalk underclaredPrefix , '*')
+            title:(resources string:'references to undeclared variables')
+            warnIfNone:true
     ]
-
 !
 
 removeAllBreakAndTracePoints
@@ -693,22 +703,19 @@
 startClassBrowser
     "open a classBrowser; asks for class"
 
-    SystemBrowser askThenBrowseClass
-
+    UserPreferences current systemBrowserClass askThenBrowseClass
 !
 
 startClassHierarchyBrowser
     "open a classHierarchyBrowser; asks for class"
 
-    SystemBrowser askThenBrowseClassHierarchy
-
+    UserPreferences current systemBrowserClass askThenBrowseClassHierarchy
 !
 
 startFullClassBrowser
     "open a fullClass systemBrowser; asks for class"
 
-    SystemBrowser askThenBrowseFullClassProtocol
-
+    UserPreferences current systemBrowserClass askThenBrowseFullClassProtocol
 ! !
 
 !AbstractLauncherApplication methodsFor:'user actions - demos'!
@@ -3956,7 +3963,7 @@
     "open a dialog on tool settings"
 
     |box resources currentUserPrefs in acceptChannel
-     useNewInspector useNewChangesBrowser useNewVersionDiffBrowser
+     useNewInspector useNewChangesBrowser useNewSystemBrowser useNewVersionDiffBrowser
      showClockInLauncher showClock launcher transcriptBufferSize|
 
     currentUserPrefs := UserPreferences current.
@@ -3968,6 +3975,7 @@
     "/
     useNewInspector := currentUserPrefs useNewInspector asValue.
     useNewChangesBrowser := currentUserPrefs useNewChangesBrowser asValue.
+    useNewSystemBrowser := currentUserPrefs useNewSystemBrowser asValue.
     showClockInLauncher := currentUserPrefs showClockInLauncher asValue.
     useNewVersionDiffBrowser := currentUserPrefs useNewVersionDiffBrowser asValue.
     transcriptBufferSize := Transcript current lineLimit printString asValue.
@@ -3984,6 +3992,8 @@
 
     box addCheckBox:(resources string:'Use the new Changes Browser') on:useNewChangesBrowser.
     box addHorizontalLine.
+    box addCheckBox:(resources string:'Use the new System Browser') on:useNewSystemBrowser.
+    box addHorizontalLine.
     box addCheckBox:(resources string:'Use the new VersionDiff Browser') on:useNewVersionDiffBrowser.
     box addHorizontalLine.
     box addCheckBox:(resources string:'Use Hierarchical Inspector') on:useNewInspector.
@@ -4014,6 +4024,7 @@
 
         currentUserPrefs useNewInspector:useNewInspector value.
         currentUserPrefs useNewChangesBrowser:useNewChangesBrowser value.
+        currentUserPrefs useNewSystemBrowser:useNewSystemBrowser value.
         currentUserPrefs useNewVersionDiffBrowser:useNewVersionDiffBrowser value.
 
         showClock := showClockInLauncher value.
@@ -4320,7 +4331,7 @@
                         menu actionAt:#inspect put:[ method inspect ].
                         menu actionAt:#browse put:[ |who|
                                                     who := method who.
-                                                    SystemBrowser 
+                                                    UserPreferences current systemBrowserClass
                                                         openInClass:(who methodClass) 
                                                         selector:(who methodSelector) 
                                                   ].
@@ -5490,5 +5501,5 @@
 !AbstractLauncherApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.105 2000-08-04 17:03:35 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.106 2000-08-15 14:12:55 cg Exp $'
 ! !