Skip to content

Commit

Permalink
include Spec2 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Jul 20, 2020
1 parent 66e5c5d commit 09e14a9
Show file tree
Hide file tree
Showing 27 changed files with 114 additions and 1,207 deletions.
11 changes: 1 addition & 10 deletions src/Spec2-Adapters-Morphic/SpComponentListDataSource.class.st
Expand Up @@ -109,16 +109,7 @@ SpComponentListDataSource >> rowHeight: rowIndex [

{ #category : #accessing }
SpComponentListDataSource >> searchText: aString [
"| search text result |
aString isEmptyOrNil ifTrue: [ ^ #() ].
result := OrderedCollection new.
search := aString trimBoth asLowercase.
1 to: self numberOfRows do: [ :rowIndex |
text := (self model displayValueAt: rowIndex) contents trimBoth asLowercase.
(text beginsWith: search)
ifTrue: [ result add: rowIndex ] ].
^ result asArray"
"Do nothing for the moment"
"do nothing for the moment"
^ #()
]

Expand Down
44 changes: 0 additions & 44 deletions src/Spec2-Backend-Tests/SpDynamicMockPresenter.class.st

This file was deleted.

This file was deleted.

27 changes: 21 additions & 6 deletions src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st
Expand Up @@ -61,6 +61,7 @@ SpMorphicCodeAdapter >> classOrMetaClass: aClass [
self
setEditingModeFor: self widget textArea
withBehavior: aClass
forScripting: self isForScripting
]

{ #category : #private }
Expand Down Expand Up @@ -138,6 +139,12 @@ SpMorphicCodeAdapter >> interactionModel: anInteractionModel [
self setInteractionModel: anInteractionModel to: w ]
]

{ #category : #'widget API' }
SpMorphicCodeAdapter >> isForScripting [

^ self presenter isForScripting
]

{ #category : #private }
SpMorphicCodeAdapter >> newCompletionEngine: anInteractionModel [

Expand Down Expand Up @@ -180,17 +187,25 @@ SpMorphicCodeAdapter >> selectedClassOrMetaClass [
SpMorphicCodeAdapter >> setEditingModeFor: textArea [

self hasSyntaxHighlight
ifTrue: [ self setEditingModeFor: textArea withBehavior: self behavior ]
ifFalse: [ super setEditingModeFor: textArea ]
ifTrue: [
self
setEditingModeFor: textArea
withBehavior: self behavior
forScripting: self isForScripting ]
ifFalse: [
super setEditingModeFor: textArea ]
]

{ #category : #private }
SpMorphicCodeAdapter >> setEditingModeFor: textArea withBehavior: aBehavior [
SpMorphicCodeAdapter >> setEditingModeFor: textArea withBehavior: aBehavior forScripting: aBoolean [

textArea model: self.
aBehavior
ifNotNil: [ textArea beForSmalltalkCodeInClass: aBehavior ]
ifNil: [ textArea beForSmalltalkScripting ]
(aBoolean or: [ aBehavior isNil ])
ifTrue: [
textArea beForSmalltalkScripting.
textArea editingMode classOrMetaClass: aBehavior ]
ifFalse: [
textArea beForSmalltalkCodeInClass: aBehavior ]
]

{ #category : #'widget API' }
Expand Down
12 changes: 12 additions & 0 deletions src/Spec2-Code/SpCodeBehaviorInteractionModel.class.st
Expand Up @@ -24,6 +24,18 @@ SpCodeBehaviorInteractionModel >> behavior: anObject [
behavior := anObject
]

{ #category : #binding }
SpCodeBehaviorInteractionModel >> bindingOf: aString [

^ self behavior bindingOf: aString
]

{ #category : #testing }
SpCodeBehaviorInteractionModel >> hasBindingOf: aString [

^ self behavior hasBindingOf: aString
]

{ #category : #initialization }
SpCodeBehaviorInteractionModel >> initialize [

Expand Down
30 changes: 10 additions & 20 deletions src/Spec2-Code/SpCodeInteractionModel.class.st
Expand Up @@ -18,8 +18,7 @@ Class {
#name : #SpCodeInteractionModel,
#superclass : #Object,
#instVars : [
'owner',
'bindings'
'owner'
],
#category : #'Spec2-Code'
}
Expand All @@ -33,15 +32,7 @@ SpCodeInteractionModel >> behavior [
{ #category : #binding }
SpCodeInteractionModel >> bindingOf: aString [

^ self bindings
associationAt: aString
ifAbsent: [ nil ]
]

{ #category : #accessing }
SpCodeInteractionModel >> bindings [

^ bindings ifNil: [ bindings := Dictionary new ]
^ self subclassResponsibility
]

{ #category : #accessing }
Expand All @@ -59,7 +50,7 @@ SpCodeInteractionModel >> doItReceiver [
{ #category : #testing }
SpCodeInteractionModel >> hasBindingOf: aString [

^ self bindings includesKey: aString asSymbol
^ self subclassResponsibility
]

{ #category : #testing }
Expand Down Expand Up @@ -105,15 +96,14 @@ SpCodeInteractionModel >> selectedClassOrMetaClass [
^ self behavior
]

{ #category : #binding }
SpCodeInteractionModel >> setBindings: aDictionary [
"Sets the Workspace to use the specified dictionary as its namespace"

bindings := aDictionary
]

{ #category : #accessing }
SpCodeInteractionModel >> variableBindingNames [

^ self bindings keys
^ self variableBindings keys
]

{ #category : #accessing }
SpCodeInteractionModel >> variableBindings [

^ Dictionary new
]
15 changes: 13 additions & 2 deletions src/Spec2-Code/SpCodeMethodInteractionModel.class.st
Expand Up @@ -19,17 +19,28 @@ SpCodeMethodInteractionModel >> behavior [
^ self method ifNotNil: [ self method methodClass ]
]

{ #category : #accessing }
SpCodeMethodInteractionModel >> bindingOf: aString [

^ self behavior bindingOf: aString
]

{ #category : #accessing }
SpCodeMethodInteractionModel >> doItReceiver [

^ self behavior instanceSide
]

{ #category : #testing }
SpCodeMethodInteractionModel >> hasBindingOf: aString [

^ self behavior hasBindingOf: aString
]

{ #category : #initialization }
SpCodeMethodInteractionModel >> initialize [

super initialize.
self setBindings: Dictionary new
super initialize
]

{ #category : #accessing }
Expand Down
12 changes: 12 additions & 0 deletions src/Spec2-Code/SpCodeNullInteractionModel.class.st
Expand Up @@ -6,3 +6,15 @@ Class {
],
#category : #'Spec2-Code'
}

{ #category : #binding }
SpCodeNullInteractionModel >> bindingOf: aString [

^ nil
]

{ #category : #testing }
SpCodeNullInteractionModel >> hasBindingOf: aString [

^ false
]
33 changes: 12 additions & 21 deletions src/Spec2-Code/SpCodeObjectInteractionModel.class.st
Expand Up @@ -14,29 +14,15 @@ SpCodeObjectInteractionModel class >> on: anObject [
]

{ #category : #accessing }
SpCodeObjectInteractionModel >> bindings [
SpCodeObjectInteractionModel >> behavior [

^ bindings ifNil: [ bindings := self collectBindings ]

^ self object class
]

{ #category : #private }
SpCodeObjectInteractionModel >> collectBindings [
| newBindings |

newBindings := Dictionary new.
self behavior ifNotNil: [ :aClass |
self collectBindingsOf: aClass into: newBindings ].
self doItReceiver ifNotNil: [ :anObject |
self collectBindingsOf: anObject class into: newBindings ].

^ newBindings
]

{ #category : #private }
SpCodeObjectInteractionModel >> collectBindingsOf: aClass into: aDictionary [
{ #category : #binding }
SpCodeObjectInteractionModel >> bindingOf: aString [

aDictionary addAll: aClass slots
^ self doItReceiver bindingOf: aString
]

{ #category : #accessing }
Expand All @@ -45,6 +31,12 @@ SpCodeObjectInteractionModel >> doItReceiver [
^ self object
]

{ #category : #testing }
SpCodeObjectInteractionModel >> hasBindingOf: aString [

^ self doItReceiver hasBindingOf: aString
]

{ #category : #testing }
SpCodeObjectInteractionModel >> isForScripting [

Expand All @@ -60,6 +52,5 @@ SpCodeObjectInteractionModel >> object [
{ #category : #accessing }
SpCodeObjectInteractionModel >> object: anObject [

object := anObject.
bindings := nil
object := anObject
]
6 changes: 6 additions & 0 deletions src/Spec2-Code/SpCodePresenter.class.st
Expand Up @@ -332,6 +332,12 @@ SpCodePresenter >> interactionModel: anInteractionModel [
self basicInteractionModel: anInteractionModel
]

{ #category : #'private bindings' }
SpCodePresenter >> isForScripting [

^ self interactionModel isForScripting
]

{ #category : #accessing }
SpCodePresenter >> lineNumbers: aBoolean [

Expand Down
22 changes: 18 additions & 4 deletions src/Spec2-Code/SpCodeScriptingInteractionModel.class.st
@@ -1,6 +1,9 @@
Class {
#name : #SpCodeScriptingInteractionModel,
#superclass : #SpCodeInteractionModel,
#instVars : [
'bindings'
],
#category : #'Spec2-Code'
}

Expand All @@ -19,11 +22,16 @@ SpCodeScriptingInteractionModel >> bindingOf: aString [
^ self bindings associationAt: aString
]

{ #category : #initialization }
SpCodeScriptingInteractionModel >> initialize [
{ #category : #accessing }
SpCodeScriptingInteractionModel >> bindings [

^ bindings ifNil: [ bindings := Dictionary new ]
]

{ #category : #testing }
SpCodeScriptingInteractionModel >> hasBindingOf: aString [

self setBindings: Dictionary new.
super initialize
^ self bindings includesKey: aString asSymbol
]

{ #category : #testing }
Expand All @@ -37,3 +45,9 @@ SpCodeScriptingInteractionModel >> removeBinding: aBinding [

bindings removeKey: aBinding key
]

{ #category : #accessing }
SpCodeScriptingInteractionModel >> variableBindings [

^ self bindings
]

0 comments on commit 09e14a9

Please sign in to comment.