Skip to content

Commit

Permalink
Merge pull request #1459 from MarcusDenker/fix-deprecated-isWorkSpace
Browse files Browse the repository at this point in the history
fix a isForWorkspace: send
  • Loading branch information
Ducasse authored Oct 3, 2023
2 parents 898acf0 + e29057d commit 13b84fb
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 66 deletions.
80 changes: 40 additions & 40 deletions src/Spec2-Code-Morphic/SpMorphicCodeAdapter.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #SpMorphicCodeAdapter,
#superclass : #SpMorphicTextAdapter,
#category : #'Spec2-Code-Morphic'
#name : 'SpMorphicCodeAdapter',
#superclass : 'SpMorphicTextAdapter',
#category : 'Spec2-Code-Morphic',
#package : 'Spec2-Code-Morphic'
}

{ #category : #initialization }
{ #category : 'initialization' }
SpMorphicCodeAdapter >> addKeyBindingsTo: aMorph [

super addKeyBindingsTo: aMorph.
Expand All @@ -15,19 +16,19 @@ SpMorphicCodeAdapter >> addKeyBindingsTo: aMorph [
toAction: each action ] ]
]

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

^ self presenter behavior
]

{ #category : #'private - shout' }
{ #category : 'private - shout' }
SpMorphicCodeAdapter >> bindingOf: aString [

^ self presenter bindingOf: aString
]

{ #category : #factory }
{ #category : 'factory' }
SpMorphicCodeAdapter >> buildWidget [
| newWidget |

Expand All @@ -52,15 +53,15 @@ SpMorphicCodeAdapter >> buildWidget [
^ newWidget
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> changeLineNumbers: hasLineNumbers to: aMorph [

hasLineNumbers
ifTrue: [ aMorph withLineNumbers ]
ifFalse: [ aMorph withoutLineNumbers ]
]

{ #category : #'private - shout' }
{ #category : 'private - shout' }
SpMorphicCodeAdapter >> classOrMetaClass: aClass [

self suspendObservedPropertiesWhile: [
Expand All @@ -70,7 +71,7 @@ SpMorphicCodeAdapter >> classOrMetaClass: aClass [
forScripting: self isScripting ]
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> computeOriginFor: aMorph [
| desiredTop desiredLeft |

Expand All @@ -82,50 +83,50 @@ SpMorphicCodeAdapter >> computeOriginFor: aMorph [
^ desiredLeft @ desiredTop
]

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

^ self presenter doItContext
]

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

^ self presenter doItReceiver
]

{ #category : #NOCompletion }
{ #category : 'NOCompletion' }
SpMorphicCodeAdapter >> guessTypeForName: aString [

^nil
]

{ #category : #'private - shout' }
{ #category : 'private - shout' }
SpMorphicCodeAdapter >> hasBindingOf: aString [

^ self presenter hasBindingOf: aString
]

{ #category : #testing }
{ #category : 'testing' }
SpMorphicCodeAdapter >> hasSmartCharacters [

^ self presenter hasSmartCharacters
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> hasSyntaxHighlight [

^ self presenter hasSyntaxHighlight
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> hasSyntaxHighlightEnabled [
"this is used just for testing"

^ self presenter hasSyntaxHighlight
]

{ #category : #'widget API' }
{ #category : 'widget API' }
SpMorphicCodeAdapter >> insertPopoverAfterCurrentSelection: aPresenter style: styleName [

| popover pos |
Expand All @@ -147,21 +148,21 @@ SpMorphicCodeAdapter >> insertPopoverAfterCurrentSelection: aPresenter style: st
popover takeKeyboardFocus ]
]

{ #category : #'widget API' }
{ #category : 'widget API' }
SpMorphicCodeAdapter >> interactionModel: anInteractionModel [

self classOrMetaClass: anInteractionModel behavior.
self widgetDo: [ :w |
self setInteractionModel: anInteractionModel to: w ]
]

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

^ self presenter isScripting
]

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

^ SpMorphicCodeCompletionEngine new
Expand All @@ -173,7 +174,7 @@ SpMorphicCodeAdapter >> newCompletionEngine: anInteractionModel [
yourself
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> originMorphFor: aMorph [

(aMorph textArea hasSelection not and: [
Expand All @@ -182,32 +183,32 @@ SpMorphicCodeAdapter >> originMorphFor: aMorph [
^ aMorph textArea cursor
]

{ #category : #NOCompletion }
{ #category : 'NOCompletion' }
SpMorphicCodeAdapter >> receiverClass [

^ self behavior
]

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

self presenter hasSyntaxHighlight ifFalse: [ ^ self ].
self widgetDo: [ :w | w textArea shoutStyler refreshStyling ]
]

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

^ self presenter selectedBehavior
]

{ #category : #NOCompletion }
{ #category : 'NOCompletion' }
SpMorphicCodeAdapter >> selectedClassOrMetaClass [

^ self behavior
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> setEditingModeFor: textArea [

self hasSyntaxHighlight
Expand All @@ -221,38 +222,37 @@ SpMorphicCodeAdapter >> setEditingModeFor: textArea [
super setEditingModeFor: textArea ]
]

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

textArea model: self.
(aBoolean or: [ aBehavior isNil ])
ifTrue: [
(aBoolean or: [ aBehavior isNil ])
ifTrue: [
textArea beForSmalltalkScripting.
textArea editingMode classOrMetaClass: aBehavior ]
ifFalse: [
textArea beForSmalltalkCodeInClass: aBehavior ].
ifFalse: [ textArea beForSmalltalkCodeInClass: aBehavior ].
"Following code should bring correct requestor (a code presenter) with a proper code interaction model into styler to enable a visibility of external variables (like workspace variables)"
textArea shoutStyler styler
isForWorkspace: aBoolean;
textArea shoutStyler styler
isScripting: aBoolean;
workspace: self presenter.
textArea shoutStyler refreshStyling
]

{ #category : #'widget API' }
{ #category : 'widget API' }
SpMorphicCodeAdapter >> setInteractionModel: anInteractionModel to: w [

w textArea editor isSmalltalkEditor ifFalse: [ ^ self ].
w completionEngine: (self newCompletionEngine: anInteractionModel)
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> setSmartCharactersFor: aWidget [

self suspendObservedPropertiesWhile: [
aWidget textArea editor completionEngine smartCharacters: self hasSmartCharacters ]
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> setSyntaxHighlightThemeFor: textArea [
| theme |

Expand All @@ -264,7 +264,7 @@ SpMorphicCodeAdapter >> setSyntaxHighlightThemeFor: textArea [
refreshStyling
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> suspendObservedPropertiesWhile: aBlock [
| textHolder textSubscriptions |

Expand All @@ -275,15 +275,15 @@ SpMorphicCodeAdapter >> suspendObservedPropertiesWhile: aBlock [
textHolder subscriptions: textSubscriptions ]
]

{ #category : #private }
{ #category : 'private' }
SpMorphicCodeAdapter >> textWithStyle [
"This method is to be used for testing.
DO NOT USE IT!"

^ self widget getText
]

{ #category : #'widget API' }
{ #category : 'widget API' }
SpMorphicCodeAdapter >> userActionDuring: aBlock [

aBlock value
Expand Down
35 changes: 18 additions & 17 deletions src/Spec2-Code-Morphic/SpMorphicCodeCompletionEngine.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ I can have several configurations:
"
Class {
#name : #SpMorphicCodeCompletionEngine,
#superclass : #CompletionEngine,
#name : 'SpMorphicCodeCompletionEngine',
#superclass : 'CompletionEngine',
#instVars : [
'scripting',
'completionClass',
Expand All @@ -19,89 +19,90 @@ Class {
'completionBuilder',
'smartCharacters'
],
#category : #'Spec2-Code-Morphic'
#category : 'Spec2-Code-Morphic',
#package : 'Spec2-Code-Morphic'
}

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> completionBuilder [

^ completionBuilder ifNil: [ CoASTHeuristicsResultSetBuilder new ]
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> completionBuilder: anObject [

completionBuilder := anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> completionClass [

^ completionClass
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> completionClass: anObject [

completionClass := anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> doItContext [

^ doItContext
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> doItContext: aContext [

doItContext := aContext
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> doItRequestor [

^ doItRequestor
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> doItRequestor: aRequestor [

doItRequestor := aRequestor
]

{ #category : #initialization }
{ #category : 'initialization' }
SpMorphicCodeCompletionEngine >> initialize [

super initialize.
contextClass := CoCompletionContext
]

{ #category : #testing }
{ #category : 'testing' }
SpMorphicCodeCompletionEngine >> isScripting [

^ scripting
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> scripting: aBoolean [

scripting := aBoolean
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> smartCharacters [

^ smartCharacters ifNil: [ super smartCharacters ]
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> smartCharacters: aBoolean [

smartCharacters := aBoolean
]

{ #category : #accessing }
{ #category : 'accessing' }
SpMorphicCodeCompletionEngine >> variableBindingNames [

^ self doItRequestor variableBindingNames
Expand Down
Loading

0 comments on commit 13b84fb

Please sign in to comment.