-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
766 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
packages/DomainCode-Diff/DCCommandScriptGenerator.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Class { | ||
#name : #DCCommandScriptGenerator, | ||
#superclass : #DCChawatheScriptGenerator, | ||
#instVars : [ | ||
'editor' | ||
], | ||
#category : #'DomainCode-Diff' | ||
} | ||
|
||
{ #category : #actions } | ||
DCCommandScriptGenerator >> delete: aMorph [ | ||
|
||
self editor do: (SBDeleteCommand new | ||
target: aMorph; | ||
shouldMergeWithNext: true). | ||
self logChanges ifTrue: [Transcript showln: {#delete. aMorph}] | ||
] | ||
|
||
{ #category : #accessing } | ||
DCCommandScriptGenerator >> editor [ | ||
|
||
^ editor | ||
] | ||
|
||
{ #category : #accessing } | ||
DCCommandScriptGenerator >> editor: anEditor [ | ||
|
||
editor := anEditor | ||
] | ||
|
||
{ #category : #'initialize-release' } | ||
DCCommandScriptGenerator >> initialize [ | ||
|
||
super initialize. | ||
|
||
commands := OrderedCollection new | ||
] | ||
|
||
{ #category : #actions } | ||
DCCommandScriptGenerator >> insert: aMorph at: aNumber in: anOwnerMorph [ | ||
|
||
self editor do: (SBInsertCommand new | ||
shouldMergeWithNext: true; | ||
index: aNumber; | ||
container: anOwnerMorph; | ||
morph: aMorph). | ||
self logChanges ifTrue: [Transcript showln: {#insert. anOwnerMorph. aNumber. aMorph}] | ||
] | ||
|
||
{ #category : #testing } | ||
DCCommandScriptGenerator >> logChanges [ | ||
|
||
^ false | ||
] | ||
|
||
{ #category : #actions } | ||
DCCommandScriptGenerator >> move: aMorph to: anOwnerMorph at: aNumber [ | ||
|
||
self editor do: (SBMoveCommand new | ||
shouldMergeWithNext: true; | ||
container: anOwnerMorph; | ||
morph: aMorph; | ||
index: aNumber). | ||
self logChanges ifTrue: [Transcript showln: {#move. anOwnerMorph. aNumber. aMorph}] | ||
] | ||
|
||
{ #category : #actions } | ||
DCCommandScriptGenerator >> update: aMorph with: aString [ | ||
"check if we have an active input command for this morph" | ||
|
||
(editor currentInputCommand ifNotNil: #textMorph) = aMorph | ||
ifTrue: [aMorph contents: aString] | ||
ifFalse: [ | ||
self editor do: (SBMutatePropertyCommand new | ||
shouldMergeWithNext: true; | ||
target: aMorph; | ||
selector: #contents; | ||
value: aString)]. | ||
self logChanges ifTrue: [Transcript showln: {#update. aMorph. aString}] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.