Add coder

This commit is contained in:
2022-06-14 00:05:36 +02:00
parent 8da76b5a3f
commit 22d00d0360
31 changed files with 406 additions and 96 deletions

View File

@@ -0,0 +1,37 @@
Class {
#name : #GtCarpNewFunctionCoderModel,
#superclass : #GtCarpCoderModel,
#instVars : [
'module',
'onSave'
],
#category : #'Carp-Coder'
}
{ #category : #accessing }
GtCarpNewFunctionCoderModel >> initializeAddOns: addOns [
super initializeAddOns: addOns.
addOns
addMainAction: 'Save' translated
icon: BrGlamorousVectorIcons accept
action: [ :aCoderUIModel :anElement |
self save ]
id: GtMethodCoderSaveActionId.
]
{ #category : #coders }
GtCarpNewFunctionCoderModel >> module: aModule [
module := aModule
]
{ #category : #accessing }
GtCarpNewFunctionCoderModel >> onSave: aBlock [
onSave := aBlock
]
{ #category : #accessing }
GtCarpNewFunctionCoderModel >> save [
module addExpression: (CarpParser parse: sourceCode currentSourceText value text) intoModel.
onSave ifNotNil: [ onSave value ]
]