SyntaxHighlightingService renamed to CodeHighlightingService to match those in tools.
"{ Package: 'jv:smallsense' }"
"{ NameSpace: SmallSense }"
Tools::CodeNavigationService subclass:#CodeNavigationService
instanceVariableNames:'currentNodeHolder'
classVariableNames:''
poolDictionaries:''
category:'SmallSense-Core-Services'
!
!CodeNavigationService class methodsFor:'accessing'!
label
"Answers a short label - for UI"
^'SmallSense - Code Navigation'
"Created: / 27-07-2013 / 22:46:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 23-09-2013 / 10:27:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeNavigationService methodsFor:'event handling'!
button1Press
| node |
node := codeView currentParseNode.
node isNil ifTrue:[
^ self
].
node isSelector ifTrue:[
self button1PressForMessageNode: node.
^self.
].
node isVariable ifTrue:[
self button1PressForVariableNode: node.
^self.
].
^self.
"Created: / 14-02-2010 / 18:43:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 18-11-2011 / 14:58:02 / cg"
"Modified: / 21-02-2012 / 14:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
button1PressForMessageNode: node
^self button1PressForSelector: node parent selector.
"Created: / 21-02-2012 / 14:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
button1PressForVariableNode: node
| value |
node isGlobalVariable ifTrue:[
value := Smalltalk at: node name.
value notNil ifTrue:[
value isBehavior ifTrue:[
self browseClass: value.
] ifFalse:[
value inspect.
]
]
]
"Created: / 21-02-2012 / 14:30:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
button2Press
| sel |
sel := codeView syntaxElementSelection.
(sel notNil and:[sel node isMessage]) ifTrue:[^self button2PressForSelector: sel node selector].
"Created: / 14-02-2010 / 18:43:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-03-2012 / 16:49:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeNavigationService methodsFor:'initialization'!
initialize
"Invoked when a new instance is created."
"/ please change as required (and remove this comment)
"/
super initialize.
currentNodeHolder := ValueHolder new.
"Modified: / 23-09-2013 / 03:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CodeNavigationService methodsFor:'private'!
highlightElement:element
super highlightElement:element.
element notNil ifTrue:[
currentNodeHolder value: element node.
] ifFalse:[
currentNodeHolder value: nil.
].
"Created: / 23-09-2013 / 03:52:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !