Tools__NewSystemBrowser.st
branchjv
changeset 12236 8ec3d6230b65
parent 12230 5568874ba4cf
child 12240 a2a5f4c906de
equal deleted inserted replaced
12235:32590d2e813d 12236:8ec3d6230b65
 47609                 ].
 47609                 ].
 47610             ].
 47610             ].
 47611         ].
 47611         ].
 47612     ].
 47612     ].
 47613 
 47613 
       
 47614     "Look for Java class..."
       
 47615     (JAVA notNil and:[aMatchString includes: $.]) ifTrue:[
       
 47616         | javaClass |
       
 47617 
       
 47618         javaClass := Java at: aMatchString.
       
 47619         javaClass notNil ifTrue:[ 
       
 47620             self switchToClass: javaClass.
       
 47621             ^self
       
 47622         ].
       
 47623     ].
       
 47624 
 47614     className := self askForClassNameMatching:aMatchString.
 47625     className := self askForClassNameMatching:aMatchString.
 47615     className notNil ifTrue:[
 47626     className notNil ifTrue:[
 47616         self switchToClassNamed:className.
 47627         self switchToClassNamed:className.
 47617     ]
 47628     ]
 47618 
 47629 
 47619     "Modified: / 04-07-2006 / 18:48:25 / fm"
 47630     "Modified: / 04-07-2006 / 18:48:25 / fm"
 47620     "Modified (comment): / 07-03-2012 / 12:05:07 / cg"
 47631     "Modified (comment): / 07-03-2012 / 12:05:07 / cg"
       
 47632     "Modified: / 20-04-2012 / 19:44:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 47621 !
 47633 !
 47622 
 47634 
 47623 switchToClassNamed:aString
 47635 switchToClassNamed:aString
 47624     |str theClass|
 47636     |str theClass|
 47625 
 47637 
 51980     "Created: / 04-12-2011 / 22:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 51992     "Created: / 04-12-2011 / 22:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 51981 !
 51993 !
 51982 
 51994 
 51983 searchCompletionNewForClass: patternString
 51995 searchCompletionNewForClass: patternString
 51984 
 51996 
 51985     | env pattern matcher matches relax withPrefix nmWihoutPrefix |
 51997     | env pattern matcher matches relax withPrefix |
 51986 
 51998 
 51987     patternString isEmptyOrNil ifTrue:[^#('' #())].
 51999     patternString isEmptyOrNil ifTrue:[^#('' #())].
 51988 
 52000 
 51989     env := self theSingleSelectedNamespace ? #Smalltalk.
 52001     env := self theSingleSelectedNamespace ? #Smalltalk.
 51990     env = NavigatorModel nameListEntryForALL ifTrue:[env := #Smalltalk].
 52002     env = NavigatorModel nameListEntryForALL ifTrue:[env := #Smalltalk].
 51995 
 52007 
 51996 
 52008 
 51997     withPrefix ifTrue:[
 52009     withPrefix ifTrue:[
 51998         matcher := [:cls|pattern match: cls name]
 52010         matcher := [:cls|pattern match: cls name]
 51999     ] ifFalse:[
 52011     ] ifFalse:[
 52000         matcher := [:cls|pattern match: (nmWihoutPrefix := cls nameWithoutPrefix)]
 52012         matcher := [:cls|pattern match: cls nameWithoutPrefix]
 52001     ].
 52013     ].
 52002 
 52014 
 52003     relax := 1.
 52015     relax := 1.
 52004     [ matches isEmptyOrNil and:[relax <= 3] ] whileTrue:[
 52016     [ matches isEmptyOrNil and:[relax <= 3] ] whileTrue:[
 52005         matches := OrderedCollection new.
 52017         matches := OrderedCollection new.
 52006         env keysDo:[:nm|
 52018         env keysDo:[:nm|
 52007             | cls |
 52019             | cls |
 52008 
 52020 
 52009             cls := env at: nm.
 52021             cls := env at: nm.
 52010             (cls notNil and:[cls isBehavior]) ifTrue:[
 52022             (cls notNil and:[cls isBehavior and:[(matches includesIdentical: cls)not]]) ifTrue:[
 52011                 (matcher value: cls) ifTrue:[
 52023                 (matcher value: cls) ifTrue:[
 52012                     matches add: (self searchCompletionEntryForClass: cls showPrefix: withPrefix)
 52024                     matches add: cls
 52013                 ].
 52025                 ].
 52014             ].
 52026             ].
 52015         ].
 52027         ].
 52016         relax := relax + 1.
 52028         relax := relax + 1.
 52017     ].
 52029     ].
 52018 
 52030 
 52019     matches isEmpty ifTrue:[
 52031     matches isEmpty ifTrue:[
 52020         ^ #(nil #())
 52032         ^ #(nil #())
 52021     ] ifFalse:[
 52033     ] ifFalse:[
       
 52034         matches := matches collect:[:cls|self searchCompletionEntryForClass: cls showPrefix: withPrefix].
 52022         ^ { matches first . matches }
 52035         ^ { matches first . matches }
 52023     ]
 52036     ]
 52024 
 52037 
 52025     "Created: / 06-04-2012 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 52038     "Created: / 06-04-2012 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 52026 ! !
 52039 ! !
 56516 ! !
 56529 ! !
 56517 
 56530 
 56518 !NewSystemBrowser::ClassCompletionEntry methodsFor:'converting'!
 56531 !NewSystemBrowser::ClassCompletionEntry methodsFor:'converting'!
 56519 
 56532 
 56520 asString
 56533 asString
 56521 
 56534     ^klass isJavaClass ifTrue:[
 56522     ^klass name
 56535         klass javaName
       
 56536     ] ifFalse:[
       
 56537         klass name
       
 56538     ].
 56523 
 56539 
 56524     "Created: / 04-04-2012 / 13:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 56540     "Created: / 04-04-2012 / 13:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 56525 ! !
 56541 ! !
 56526 
 56542 
 56527 !NewSystemBrowser::ClassCompletionEntry methodsFor:'displaying'!
 56543 !NewSystemBrowser::ClassCompletionEntry methodsFor:'displaying'!
 56533     showPrefix ifTrue:[
 56549     showPrefix ifTrue:[
 56534         name := klass name.
 56550         name := klass name.
 56535         namespace := nil
 56551         namespace := nil
 56536     ] ifFalse:[
 56552     ] ifFalse:[
 56537         name := klass nameWithoutPrefix.
 56553         name := klass nameWithoutPrefix.
 56538         namespace := klass  nameSpace name.
 56554         klass isJavaClass ifFalse:[
       
 56555             namespace := klass  nameSpace name.
       
 56556         ] ifTrue:[
       
 56557             namespace := klass javaPackage.
       
 56558         ]
 56539     ].
 56559     ].
 56540 
 56560 
 56541     name displayOn:aGC x:x y:y opaque:opaque.
 56561     name displayOn:aGC x:x y:y opaque:opaque.
 56542 
 56562 
 56543     (namespace notNil and:[namespace ~~ #Smalltalk]) ifTrue:[
 56563     (namespace notNil and:[namespace ~~ #Smalltalk]) ifTrue:[
 56552             aGC paint: fg.
 56572             aGC paint: fg.
 56553         ]
 56573         ]
 56554     ]
 56574     ]
 56555 
 56575 
 56556     "Created: / 04-04-2012 / 13:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 56576     "Created: / 04-04-2012 / 13:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
 56577 !
       
 56578 
       
 56579 displayString
       
 56580 
       
 56581     | name |
       
 56582 
       
 56583     showPrefix ifTrue:[
       
 56584         name := klass name.
       
 56585     ] ifFalse:[
       
 56586         name := klass nameWithoutPrefix.
       
 56587     ].
       
 56588     ^name
       
 56589 
       
 56590     "Created: / 20-04-2012 / 18:19:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 56557 ! !
 56591 ! !
 56558 
 56592 
 56559 !NewSystemBrowser::ClassCompletionEntry methodsFor:'printing & storing'!
 56593 !NewSystemBrowser::ClassCompletionEntry methodsFor:'printing & storing'!
 56560 
 56594 
 56561 printOn:aStream
 56595 printOn:aStream
 56570 ! !
 56604 ! !
 56571 
 56605 
 56572 !NewSystemBrowser class methodsFor:'documentation'!
 56606 !NewSystemBrowser class methodsFor:'documentation'!
 56573 
 56607 
 56574 version
 56608 version
 56575     ^ '$Id: Tools__NewSystemBrowser.st 7979 2012-04-13 18:16:04Z vranyj1 $'
 56609     ^ '$Id: Tools__NewSystemBrowser.st 7985 2012-04-21 08:36:31Z vranyj1 $'
 56576 !
 56610 !
 56577 
 56611 
 56578 version_CVS
 56612 version_CVS
 56579     ^ '§Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1738 2012/04/06 14:00:08 stefan Exp §'
 56613     ^ '§Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1738 2012/04/06 14:00:08 stefan Exp §'
 56580 !
 56614 !
 56581 
 56615 
 56582 version_SVN
 56616 version_SVN
 56583     ^ '$Id: Tools__NewSystemBrowser.st 7979 2012-04-13 18:16:04Z vranyj1 $'
 56617     ^ '$Id: Tools__NewSystemBrowser.st 7985 2012-04-21 08:36:31Z vranyj1 $'
 56584 ! !
 56618 ! !
 56585 
 56619 
 56586 NewSystemBrowser initialize!
 56620 NewSystemBrowser initialize!