Initial support for per-language edit support.
Some work on Smalltalk edit support, namely on electric blocks. Works fine,
but need more work to make it usable but not too intrusive.
"{ Package: 'jv:smallsense' }"
BrowserEnvironment subclass:#SmallSenseUnacceptedMethodEnvironment
instanceVariableNames:'class method'
classVariableNames:'UnacceptedSelector'
poolDictionaries:''
category:'SmallSense-Lint'
!
!SmallSenseUnacceptedMethodEnvironment class methodsFor:'initialization'!
initialize
"Invoked at system start or when the class is dynamically loaded."
"/ please change as required (and remove this comment)
UnacceptedSelector := #'* * UnacceptedSelector * *'
"Modified: / 27-01-2012 / 16:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment class methodsFor:'instance creation'!
onClass: realClass methodSource: source
^self new setupForClass: realClass source: source
"Created: / 27-01-2012 / 15:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment methodsFor:'accessing'!
methodsInto:arg
"raise an error: must be redefined in concrete subclass(es)"
^ self shouldImplement
!
selectorsForClass: aClass do: aBlock
self assert: aClass == class.
aBlock value: (method selector) ? UnacceptedSelector
"Created: / 27-01-2012 / 15:50:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment methodsFor:'accessing-classes'!
classesDo: aBlock
^aBlock value: class.
"Created: / 27-01-2012 / 15:48:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment methodsFor:'initialization'!
setupForClass: realClass source: source
| ns |
ns := RBNamespace onEnvironment: BrowserEnvironment new.
class := realClass isMetaclass
ifTrue:[RBMetaclass existingNamed: realClass theNonMetaclass name]
ifFalse:[RBClass existingNamed: realClass name].
class model: ns.
method := RBMethod for: class source: source selector: nil.
class addMethod: method.
"Created: / 27-01-2012 / 15:42:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment methodsFor:'testing'!
includesSelector: aSelector in: aClass
^aClass == method mclass
and:[aSelector == #' fake selector '].
"Created: / 27-01-2012 / 15:51:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmallSenseUnacceptedMethodEnvironment class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
!
version_SVN
^ '$Id: SmallSenseUnacceptedMethodEnvironment.st 7911 2012-02-22 09:55:48Z vranyj1 $'
! !
SmallSenseUnacceptedMethodEnvironment initialize!