Move new class completion UI to SmallSense jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 25 Nov 2013 12:37:11 +0000
branchjv
changeset 13744 bbb5b8748724
parent 13743 d789bfa8a626
child 13745 0d5992b3cfe6
Move new class completion UI to SmallSense
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Tue Nov 19 12:17:07 2013 +0000
+++ b/Tools__NewSystemBrowser.st	Mon Nov 25 12:37:11 2013 +0000
@@ -50,13 +50,6 @@
 	category:'Interface-Browsers-New'
 !
 
-Object subclass:#ClassCompletionEntry
-	instanceVariableNames:'klass showPrefix'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:NewSystemBrowser
-!
-
 ListEntry subclass:#OwnershipGraph
 	instanceVariableNames:'ownershipInfo cachedForm'
 	classVariableNames:''
@@ -19033,6 +19026,8 @@
     "Created: / 24.2.2000 / 23:28:06 / cg"
 ! !
 
+
+
 !NewSystemBrowser methodsFor:'aspects-organization'!
 
 categoryMenuVisible
@@ -22730,6 +22725,7 @@
     ^ UserPreferences current useSearchBarInBrowser or:[self codeView searchBarActionBlock notNil]
 ! !
 
+
 !NewSystemBrowser methodsFor:'change & update'!
 
 categorySelectionChanged
@@ -38250,6 +38246,7 @@
     HTMLDocumentView openFullOnDocumentationFile:'TOP.html'
 ! !
 
+
 !NewSystemBrowser methodsFor:'menu actions-inheritance'!
 
 inheritanceMenuNavigateToClass
@@ -47741,6 +47738,7 @@
     "Modified: / 28-02-2012 / 16:48:38 / cg"
 ! !
 
+
 !NewSystemBrowser methodsFor:'menu actions-variables'!
 
 browseVarRefsOrModsWithTitle:browserTitle boxTitle:boxTitle variables:varType access:accessType all:browseAll
@@ -51024,6 +51022,7 @@
     "Modified: / 19-10-2011 / 16:48:31 / cg"
 ! !
 
+
 !NewSystemBrowser methodsFor:'menus-dynamic-popup'!
 
 categoryPopUpMenu
@@ -55539,6 +55538,7 @@
     ^ navigationState projectListApplication
 ! !
 
+
 !NewSystemBrowser methodsFor:'private-history'!
 
 lastSearchPatterns
@@ -56294,67 +56294,36 @@
     "Created: / 04-12-2011 / 22:11:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-searchCompletionEntryForClass: aClass showPrefix: showPrefix
-
-    ^ClassCompletionEntry new klass: aClass; showPrefix: showPrefix.
-
-    "Created: / 06-04-2012 / 12:55:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 searchCompletionNew: patternString
 
-    "/sorry, no method search yet"
-    ^ self searchCompletionNewForClass: patternString
-
-    "Modified: / 04-08-2011 / 19:05:28 / cg"
-    "Created: / 04-12-2011 / 22:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-searchCompletionNewForClass: patternString
-
-    | env pattern matcher matches relax withPrefix |
+    | env pattern matches |
 
     patternString isEmptyOrNil ifTrue:[^#('' #())].
 
     env := self theSingleSelectedNamespace ? #Smalltalk.
     env = NavigatorModel nameListEntryForALL ifTrue:[env := #Smalltalk].
-    env := Smalltalk at: env.
-
-    withPrefix := patternString includes: $:.
+    env := environment at: env.
+
     pattern := StringPattern readFrom: patternString onError: [^#('' #())].
-
-
-    withPrefix ifTrue:[
-	matcher := [:cls|pattern match: cls name]
-    ] ifFalse:[
-	matcher := [:cls|pattern match: cls nameWithoutPrefix]
-    ].
-
-    relax := 1.
-    [ matches isEmptyOrNil and:[relax <= 3] ] whileTrue:[
-	matches := OrderedCollection new.
-	env keysDo:[:nm|
-	    | cls |
-
-	    cls := env at: nm.
-	    (cls notNil and:[cls isBehavior and:[(matches includesIdentical: cls)not]]) ifTrue:[
-		(matcher value: cls) ifTrue:[
-		    matches add: cls
-		].
-	    ].
-	].
-	relax := relax + 1.
-    ].
-
-    matches isEmpty ifTrue:[
-	^ #(nil #())
-    ] ifFalse:[
-	matches := matches collect:[:cls|self searchCompletionEntryForClass: cls showPrefix: withPrefix].
-	^ { matches first . matches }
-    ]
-
-    "Created: / 06-04-2012 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
+    matches := OrderedCollection new.
+
+    env keysDo:[:nm|
+        | cls nmWihoutPrefix |
+
+        cls := env at: nm.
+        (cls notNil and:[cls isBehavior]) ifTrue:[
+            (pattern match: (nmWihoutPrefix := cls nameWithoutPrefix)) ifTrue:[
+                matches add: nmWihoutPrefix
+            ].
+        ].
+    ].
+    matches isEmpty ifTrue:[ ^ #( nil #() ) ].
+    ^ { matches first . matches }
+
+    "Modified: / 04-08-2011 / 19:05:28 / cg"
+    "Created: / 04-12-2011 / 22:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 
 !NewSystemBrowser methodsFor:'private-semantic checks'!
 
@@ -60526,99 +60495,6 @@
     "Modified (format): / 29-11-2011 / 14:49:08 / cg"
 ! !
 
-!NewSystemBrowser::ClassCompletionEntry methodsFor:'accessing'!
-
-klass
-    ^ klass
-!
-
-klass:something
-    klass := something.
-!
-
-showPrefix
-    ^ showPrefix
-!
-
-showPrefix:something
-    showPrefix := something.
-! !
-
-!NewSystemBrowser::ClassCompletionEntry methodsFor:'converting'!
-
-asString
-    ^klass isJavaClass ifTrue:[
-	klass javaName
-    ] ifFalse:[
-	klass name
-    ].
-
-    "Created: / 04-04-2012 / 13:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!NewSystemBrowser::ClassCompletionEntry methodsFor:'displaying'!
-
-displayOn:aGC x:x y:y opaque:opaque
-
-    | name namespace lw cnw fg |
-
-    showPrefix ifTrue:[
-	name := klass name.
-	namespace := nil
-    ] ifFalse:[
-	name := klass nameWithoutPrefix.
-	klass isJavaClass ifFalse:[
-	    namespace := klass  nameSpace name.
-	] ifTrue:[
-	    namespace := klass javaPackage.
-	]
-    ].
-
-    name displayOn:aGC x:x y:y opaque:opaque.
-
-    (namespace notNil and:[namespace ~~ #Smalltalk]) ifTrue:[
-	namespace := 'in ', namespace.
-	lw :=  x + 16 + (name widthOn: aGC).
-	cnw := aGC widthOfString: namespace.
-
-	(aGC width > (lw + cnw + 5)) ifTrue:[
-	    fg := aGC paint.
-	    aGC paint: (Color gray: 40).
-	    namespace displayOn:aGC x: aGC width - cnw - 5 y:y opaque:opaque.
-	    aGC paint: fg.
-	]
-    ]
-
-    "Created: / 04-04-2012 / 13:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-displayString
-
-    | name |
-
-    showPrefix ifTrue:[
-	name := klass name.
-    ] ifFalse:[
-	name := klass nameWithoutPrefix.
-    ].
-    ^name
-
-    "Created: / 20-04-2012 / 18:19:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!NewSystemBrowser::ClassCompletionEntry methodsFor:'printing & storing'!
-
-printOn:aStream
-    "append a printed representation if the receiver to the argument, aStream"
-
-
-    aStream nextPut:${.
-    klass printOn:aStream.
-    aStream nextPut:$}.
-
-    "Modified: / 06-04-2012 / 13:30:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !NewSystemBrowser::OwnershipGraph class methodsFor:'defaults'!
 
 dateFormat