--- a/SmallSense__AbstractJavaCompletionEngine.st Thu Aug 07 10:30:23 2014 +0100
+++ b/SmallSense__AbstractJavaCompletionEngine.st Mon Aug 11 18:41:37 2014 +0100
@@ -63,42 +63,68 @@
!AbstractJavaCompletionEngine methodsFor:'completion-individual'!
addClassesStartingWith: prefix
- ^ self addClassesStartingWith: prefix fullName: false
+ ^ self addClassesStartingWith:prefix matchFullName:false
"Created: / 03-10-2013 / 11:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-05-2014 / 07:25:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-addClassesStartingWith: prefixArg fullName: matchFullName
+addClassesStartingWith:prefixArg filter: filter
+ ^ self addClassesStartingWith:prefixArg matchFullName:false filter: filter
+
+ "Created: / 07-08-2014 / 15:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addClassesStartingWith:prefixArg matchFullName:matchFullName
+ ^ self addClassesStartingWith:prefixArg matchFullName:matchFullName filter: nil
+
+ "Created: / 15-05-2014 / 07:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2014 / 15:03:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addClassesStartingWith:prefixArg matchFullName:matchFullName filter: filter
| prefix |
prefix := prefixArg.
matchFullName ifTrue:[
- prefix := prefix copyReplaceAll: $. with: $/.
+ prefix := prefix copyReplaceAll:$. with:$/.
].
- context environment allClassesDo: [:cls |
- cls isJavaClass ifTrue:[
- | name i |
+ context environment
+ allClassesDo:[:cls |
+ (cls isJavaClass and:[ cls isAnonymous not and:[filter isNil or:[filter value: cls]]]) ifTrue:[
+ | name i |
- matchFullName ifTrue:[
- (cls binaryName startsWith: prefix) ifTrue:[
- result add: ((PO forClas: cls) showPrefix: true; yourself).
+ matchFullName ifTrue:[
+ (prefix isEmpty or:[cls binaryName startsWith:prefix]) ifTrue:[
+ result add:((PO forClass:cls)
+ showPrefix:true;
+ yourself).
+ ].
+ ] ifFalse:[
+ name := cls lastName.
+ i := name lastIndexOf:$/.
+ prefix isEmptyOrNil ifTrue:[
+ result add:(PO forClass:cls).
+ ] ifFalse:[
+ ((name size >= (i + prefix size))
+ and:[
+ (name at:i + 1) == prefix first
+ and:[
+ (name at:i + prefix size) == prefix last
+ and:[
+ (2 to:prefix size - 1)
+ allSatisfy:[:o | (name at:i + o) == (prefix at:o) ]
+ ]
+ ]
+ ])
+ ifTrue:[ result add:(PO forClass:cls). ].
+ ]
].
- ] ifFalse:[
- name := cls lastName.
- i := name lastIndexOf: $/.
- ((name size >= (i + prefix size))
- and:[(name at: i + 1) == prefix first
- and:[(name at: i + prefix size) == prefix last
- and:[(2 to: prefix size - 1) allSatisfy:[:o| (name at: i + o) == (prefix at: o)]]]])
- ifTrue:[
- result add: (PO forClass: cls).
- ].
].
].
- ].
- "Created: / 15-05-2014 / 07:24:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 07-08-2014 / 15:03:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-08-2014 / 16:05:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
addConstructorsForClass: aJavaClass fullName: showFullName
@@ -111,6 +137,20 @@
"Created: / 15-05-2014 / 12:05:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+addExceptionsStartingWith: prefix
+ "raise an error: this method should be implemented (TODO)"
+
+ ^ self addExceptionsStartingWith: prefix matchFullName: false
+
+ "Created: / 07-08-2014 / 14:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addExceptionsStartingWith: prefix matchFullName: matchFullName
+ ^ self addClassesStartingWith: prefix matchFullName: matchFullName filter: [ :cls | cls isThrowable ].
+
+ "Created: / 07-08-2014 / 15:04:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
addFieldsForType: type
| seen |