--- a/SmallSense__JavaEditSupport.st Wed Feb 11 22:38:49 2015 +0000
+++ b/SmallSense__JavaEditSupport.st Thu Feb 12 00:30:40 2015 +0000
@@ -100,7 +100,7 @@
lastToken0 = 'Error' ifTrue:[
^ false
].
- (tokens last > service textView cursorCol) ifTrue:[
+ (tokens last > textView cursorCol) ifTrue:[
^ false
].
@@ -121,10 +121,10 @@
(tokens size > 4 and:[ (tokens at:tokens size - 7) == $} ]) ifTrue:[
| cursorLine cursorCol |
- cursorLine := service textView cursorLine.
- cursorCol := service textView cursorCol.
+ cursorLine := textView cursorLine.
+ cursorCol := textView cursorCol.
self electricInsertBlockOpenedBy:' ( ) {' closedBy:'}'.
- service textView cursorLine:cursorLine col:cursorCol + 3.
+ textView cursorLine:cursorLine col:cursorCol + 3.
^ true.
].
].
@@ -144,10 +144,10 @@
(tokens size = 4) ifTrue:[
| cursorLine cursorCol |
- cursorLine := service textView cursorLine.
- cursorCol := service textView cursorCol.
+ cursorLine := textView cursorLine.
+ cursorCol := textView cursorCol.
self electricInsertBlockOpenedBy:' ( ) {' closedBy:'}'.
- service textView cursorLine:cursorLine col:cursorCol + 3.
+ textView cursorLine:cursorLine col:cursorCol + 3.
^ true.
].
].
@@ -158,16 +158,17 @@
(tokens size = 4) ifTrue:[
| cursorLine cursorCol |
- cursorLine := service textView cursorLine.
- cursorCol := service textView cursorCol.
+ cursorLine := textView cursorLine.
+ cursorCol := textView cursorCol.
self electricInsertBlockOpenedBy:' ( ; ; ) {' closedBy:'}'.
- service textView cursorLine:cursorLine col:cursorCol + 3.
+ textView cursorLine:cursorLine col:cursorCol + 3.
^ true.
].
].
^ false
"Created: / 22-10-2013 / 01:53:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2015 / 00:00:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaEditSupport methodsFor:'event handling'!
@@ -219,11 +220,11 @@
keyPressOpenCurly
| line tokens i |
- line := service codeView listAt: service codeView cursorLine.
+ line := textView listAt: textView cursorLine.
line notEmptyOrNil ifTrue:[
i := line size.
[ i > 0 and:[(line at: i) isSeparator] ] whileTrue:[ i := i - 1 ].
- (i ~~ 0 and:[service codeView cursorCol < i]) ifTrue:[
+ (i ~~ 0 and:[textView cursorCol < i]) ifTrue:[
^ false. ].
] ifFalse:[
self electricInsertBlockOpenedBy:'{' closedBy:'}'.
@@ -234,7 +235,7 @@
tokens notEmptyOrNil ifTrue:[
| column |
- column := service textView cursorCol.
+ column := textView cursorCol.
(tokens at: tokens size - 3) = 'Error' ifTrue:[ ^ false ].
1 to: tokens size - 3 by: 4 do:[:i |
(column between: (tokens at: i + 2) and: (tokens at: i + 3)) ifTrue:[
@@ -250,7 +251,7 @@
^ true
"Created: / 04-08-2013 / 01:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 25-10-2013 / 18:03:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2015 / 00:01:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
keyPressReturn
@@ -301,9 +302,10 @@
initializeForService: anEditService
super initializeForService: anEditService.
- service textView autoIndent:true.
+ textView autoIndent:true.
"Created: / 27-09-2013 / 13:55:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 12-02-2015 / 00:01:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaEditSupport methodsFor:'private'!
@@ -311,12 +313,12 @@
tokenAtCursorLine
| scanner token |
- scanner := (Smalltalk at:#JavaScanner) for: (service textView listAt: service textView cursorLine) string.
+ scanner := (Smalltalk at:#JavaScanner) for: (textView listAt: textView cursorLine) string.
[
[
token := scanner nextToken.
- (token ~~ #EOF and:[ scanner tokenEndPosition + 1 < service textView cursorCol ])
+ (token ~~ #EOF and:[ scanner tokenEndPosition + 1 < textView cursorCol ])
] whileTrue.
] on: Error do:[
token := nil.
@@ -324,13 +326,13 @@
^ token
"Created: / 04-08-2013 / 02:00:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 04-08-2013 / 03:10:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2015 / 00:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
tokensAtCursorLine
| scanner token |
- scanner := (Smalltalk at:#JavaScanner) for: (service textView listAt: service textView cursorLine) string.
+ scanner := (Smalltalk at:#JavaScanner) for: (textView listAt: textView cursorLine) string.
^ OrderedCollection streamContents:[:tokens |
[ token := scanner nextToken.token ~~ #EOF ] whileTrue:[
tokens nextPut: token.
@@ -338,6 +340,7 @@
].
"Created: / 04-08-2013 / 01:57:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2015 / 00:02:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaEditSupport class methodsFor:'documentation'!