extensions.st
changeset 51 a37e5df13fab
parent 50 8655feecd4db
child 60 0daf99c34c5e
equal deleted inserted replaced
50:8655feecd4db 51:a37e5df13fab
   155     ]
   155     ]
   156 
   156 
   157     "Created: / 01-02-2012 / 12:11:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   157     "Created: / 01-02-2012 / 12:11:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   158 ! !
   158 ! !
   159 
   159 
   160 !SmallSenseJavaEditSupport methodsFor:'event handling'!
       
   161 
       
   162 keyPress: key x:x y:y in: view
       
   163 
       
   164     "Handles an event in given view (a subview of codeView).
       
   165      If the method returns true, the event will not be processed
       
   166      by the view."
       
   167 
       
   168     view ~~ textView ifTrue:[ ^ false ].
       
   169 
       
   170     lastTypedKey3 := lastTypedKey2.
       
   171     lastTypedKey2 := lastTypedKey1.
       
   172     lastTypedKey1 := lastTypedKey0.
       
   173     lastTypedKey0 := key.
       
   174 
       
   175     key == ${ ifTrue:[
       
   176         ^ self keyPressOpenCurly
       
   177     ].
       
   178 
       
   179     ^ false.
       
   180 
       
   181     "Created: / 07-03-2010 / 09:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   182     "Modified: / 04-08-2013 / 01:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   183 ! !
       
   184 
       
   185 !SmallSenseJavaEditSupport methodsFor:'event handling'!
       
   186 
       
   187 keyPressOpenCurly
       
   188     | line token i |
       
   189 
       
   190     line := service codeView listAt: service codeView cursorLine.
       
   191     line notEmptyOrNil ifTrue:[
       
   192         i := line size.
       
   193         [ (line at: i) isSeparator and:[i > 0] ] whileTrue:[ i := i - 1 ].
       
   194         (i ~~ 0 and:[service codeView cursorCol < i]) ifTrue:[
       
   195             ^ false.
       
   196         ].
       
   197     ] ifFalse:[
       
   198         self insertElectricBlockOpenedBy: '{' closedBy: '}'. 
       
   199         ^ true
       
   200     ].
       
   201 
       
   202     token := self tokenAtCursorLine.
       
   203     (token isNil or:[token == #String]) ifTrue:[ ^ false ].
       
   204 
       
   205     self insertElectricBlockOpenedBy: '{' closedBy: '}'. 
       
   206     ^ true
       
   207 
       
   208     "Created: / 04-08-2013 / 01:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   209 ! !
       
   210 
       
   211 !StatementNode methodsFor:'enumeration'!
   160 !StatementNode methodsFor:'enumeration'!
   212 
   161 
   213 childNamesAndValuesDo:aBlock
   162 childNamesAndValuesDo:aBlock
   214     | stmt index |
   163     | stmt index |
   215     stmt := self.
   164     stmt := self.