-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds ExamplesMorph and ExampleMorph UI
- Loading branch information
Showing
24 changed files
with
211 additions
and
3 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...eMining-Core.package/BPExampleMorph.extension/instance/addRecordAndMinimizeButtonMorph.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,14 @@ | ||
*Babylonian-ExampleMining-Core | ||
addRecordAndMinimizeButtonMorph | ||
|
||
| recordAndMinimizeButton | | ||
recordAndMinimizeButton := IconicButton new. | ||
recordAndMinimizeButton | ||
labelGraphic: (BPIcons wrenchIcon scaledToSize: self iconSize * 0.7); | ||
color: Color transparent; | ||
borderWidth: 0; | ||
extent: recordAndMinimizeButton extent * 0.7; | ||
actionSelector: #recordAndMinimizeButtonClicked; | ||
target: self; | ||
balloonText: 'Record this example and open a tool with the full and minimized recording'. | ||
self addMorphBack: recordAndMinimizeButton |
4 changes: 4 additions & 0 deletions
4
...leMining-Core.package/BPExampleMorph.extension/instance/recordAndMinimizeButtonClicked.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,4 @@ | ||
*Babylonian-ExampleMining-Core | ||
recordAndMinimizeButtonClicked | ||
|
||
BPMinimizePreview openFor: self example with: self containingBrowser |
15 changes: 15 additions & 0 deletions
15
Babylonian-ExampleMining-Core.package/BPExampleMorph.extension/instance/updateMorphs.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,15 @@ | ||
*Babylonian-ExampleMining-Core-override | ||
updateMorphs | ||
|
||
self removeAllMorphs. | ||
|
||
self | ||
addActivationButtonMorph; | ||
addCollapseButtonMorph; | ||
addAssertResultButtonMorph; | ||
addLoaderIconHolder; | ||
addExampleNameMorph; | ||
addMenuButtonMorph; | ||
addExampleSpecificMorphs; | ||
addRecordAndMinimizeButtonMorph; | ||
addDeleteButtonMorph. |
7 changes: 7 additions & 0 deletions
7
Babylonian-ExampleMining-Core.package/BPExampleMorph.extension/methodProperties.json
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,7 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"addRecordAndMinimizeButtonMorph" : "joabe 7/6/2023 22:32", | ||
"recordAndMinimizeButtonClicked" : "joabe 7/6/2023 22:32", | ||
"updateMorphs" : "joabe 7/6/2023 22:35" } } |
2 changes: 2 additions & 0 deletions
2
Babylonian-ExampleMining-Core.package/BPExampleMorph.extension/properties.json
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,2 @@ | ||
{ | ||
"name" : "BPExampleMorph" } |
11 changes: 11 additions & 0 deletions
11
...ian-ExampleMining-Core.package/BPExamplesMorph.extension/instance/addAsTestCaseExample.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,11 @@ | ||
*Babylonian-ExampleMining-Core | ||
addAsTestCaseExample | ||
|
||
| class example method | | ||
method := self containingBrowser compiledMethod. | ||
class := method methodClass. | ||
example := method bpNewExampleFrom: BPTestCaseExample. | ||
example | ||
testCaseClass: class; | ||
methodSelector: method selector. | ||
self containingBrowser saveMethodWithExamples |
4 changes: 4 additions & 0 deletions
4
...Mining-Core.package/BPExamplesMorph.extension/instance/addRecordedExampleButtonClicked.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,4 @@ | ||
*Babylonian-ExampleMining-Core | ||
addRecordedExampleButtonClicked | ||
|
||
self openRecordingTool |
6 changes: 6 additions & 0 deletions
6
...Mining-Core.package/BPExamplesMorph.extension/instance/addTestCaseExampleButtonClicked.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,6 @@ | ||
*Babylonian-ExampleMining-Core | ||
addTestCaseExampleButtonClicked | ||
|
||
self containsTestMethod | ||
ifTrue: [self addAsTestCaseExample] | ||
ifFalse: [self openSearchTool] |
7 changes: 7 additions & 0 deletions
7
...onian-ExampleMining-Core.package/BPExamplesMorph.extension/instance/containsTestMethod.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,7 @@ | ||
*Babylonian-ExampleMining-Core | ||
containsTestMethod | ||
|
||
| method | | ||
method := self containingBrowser compiledMethod. | ||
^ (method selector asString includesSubstring: 'test') | ||
and: (method methodClass inheritsFrom: TestCase) |
27 changes: 27 additions & 0 deletions
27
Babylonian-ExampleMining-Core.package/BPExamplesMorph.extension/instance/initialize.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,27 @@ | ||
*Babylonian-ExampleMining-Core-override | ||
initialize | ||
|
||
super initialize. | ||
|
||
self | ||
color: Color transparent; | ||
borderWidth: (PluggableButtonMorph basicNew userInterfaceTheme borderWidth); | ||
borderColor: self class textColor. | ||
|
||
self | ||
changeTableLayout; | ||
hResizing: #rigid; | ||
listDirection: #topToBottom; | ||
cellInset: 1. | ||
|
||
self addCollapsedExamplesMorph. | ||
|
||
self | ||
addButtonBar; | ||
addCreateExampleButtonLabeled: 'add example' selector: #addExampleButtonClicked; | ||
addCreateExampleButtonLabeled: '| add script example' selector: #addScriptExampleButtonClicked; | ||
addCreateExampleButtonLabeled: '| add referencing example' selector: #addReferencingExampleButtonClicked; | ||
addCreateExampleButtonLabeled: '| add TestCaseExample' selector: #addTestCaseExampleButtonClicked; | ||
addCreateExampleButtonLabeled: '| add recorded example' selector: #addRecordedExampleButtonClicked. | ||
|
||
BPExamples value addDependent: self. |
6 changes: 6 additions & 0 deletions
6
...lonian-ExampleMining-Core.package/BPExamplesMorph.extension/instance/openRecordingTool.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,6 @@ | ||
*Babylonian-ExampleMining-Core | ||
openRecordingTool | ||
|
||
BPExampleRecordingTool | ||
openFor: self containingBrowser compiledMethod | ||
with: self containingBrowser |
6 changes: 6 additions & 0 deletions
6
Babylonian-ExampleMining-Core.package/BPExamplesMorph.extension/instance/openSearchTool.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,6 @@ | ||
*Babylonian-ExampleMining-Core | ||
openSearchTool | ||
|
||
BPExampleSearchTool | ||
openFor: self containingBrowser compiledMethod | ||
with: self containingBrowser |
11 changes: 11 additions & 0 deletions
11
Babylonian-ExampleMining-Core.package/BPExamplesMorph.extension/methodProperties.json
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,11 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"addAsTestCaseExample" : "joabe 7/6/2023 22:45", | ||
"addRecordedExampleButtonClicked" : "joabe 7/6/2023 22:36", | ||
"addTestCaseExampleButtonClicked" : "joabe 7/6/2023 22:45", | ||
"containsTestMethod" : "joabe 7/6/2023 22:44", | ||
"initialize" : "joabe 7/6/2023 22:43", | ||
"openRecordingTool" : "joabe 7/6/2023 22:37", | ||
"openSearchTool" : "joabe 7/6/2023 22:37" } } |
2 changes: 2 additions & 0 deletions
2
Babylonian-ExampleMining-Core.package/BPExamplesMorph.extension/properties.json
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,2 @@ | ||
{ | ||
"name" : "BPExamplesMorph" } |
32 changes: 32 additions & 0 deletions
32
...pleMining-Core.package/BPMethodExampleMorph.extension/instance/addArgumentScriptMorphs.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,32 @@ | ||
*Babylonian-ExampleMining-Core-override | ||
addArgumentScriptMorphs | ||
|
||
| editField container | | ||
self example argumentNames withIndexDo: [:argumentName :index | | ||
container := self newLabelContainerMorph: (argumentName , ': '). | ||
|
||
editField := self | ||
editFieldStyledInitialContent: (self example argumentScriptStringAt: index) | ||
onChange: [:str | | ||
self example argumentScripts at: index put: str. | ||
self codeContentChanged] | ||
onAccept: [:str | | ||
self acceptChangesAtSource. | ||
false "Do not continue handling this morphs edit"]. | ||
editField | ||
balloonText: 'write code that instantiates the argument'; | ||
width: 240. | ||
container addMorphBack: editField. | ||
|
||
"Live specimen editing" | ||
((self example argumentScripts at: index) isLiveSpecimenReference) | ||
ifTrue: [container addMorphBack: (self newSpecimenEditingButtonFor: (self example argumentScripts at: index))]. | ||
|
||
"Live specimen selection" | ||
container addMorphBack: (self newSpecimenSelectionButtonOnClick: [ | ||
self selectLiveSpecimen: (self example liveSpecimenAt: index) then: [:specimen | | ||
self example argumentScripts at: index put: specimen. | ||
self codeContentChanged. | ||
editField setText: (self example argumentScriptStringAt: index)]]). | ||
|
||
exampleSpecificMorphs addMorphBack: container]. |
32 changes: 32 additions & 0 deletions
32
...ining-Core.package/BPMethodExampleMorph.extension/instance/addReceiverConstructorMorph.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,32 @@ | ||
*Babylonian-ExampleMining-Core-override | ||
addReceiverConstructorMorph | ||
|
||
| container editField | | ||
container := self newLabelContainerMorph: 'self: '. | ||
|
||
editField := (self | ||
editFieldStyledInitialContent: self example receiverConstructorString | ||
onChange: [:str | | ||
self example receiverConstructor: str. | ||
self codeContentChanged] | ||
onAccept: [:str | | ||
self acceptChangesAtSource]). | ||
editField | ||
balloonText: 'Write code that instantiates the receiver. | ||
You can also provide a selector that will be called on the | ||
class-side of this class to create a receiver object.'; | ||
width: 240. | ||
container addMorphBack: editField. | ||
|
||
"Live specimen editing" | ||
(self example receiverConstructor isLiveSpecimenReference) | ||
ifTrue: [container addMorphBack: (self newSpecimenEditingButtonFor: self example receiverConstructor)]. | ||
|
||
"Live specimen selection" | ||
container addMorphBack: (self newSpecimenSelectionButtonOnClick: [ | ||
self selectLiveSpecimen: self example receiverConstructorLiveSpecimen then: [:specimen |. | ||
self example receiverConstructor: specimen. | ||
self codeContentChanged. | ||
editField setText: self example receiverConstructorString]]). | ||
|
||
exampleSpecificMorphs addMorphBack: container. |
7 changes: 7 additions & 0 deletions
7
...ning-Core.package/BPMethodExampleMorph.extension/instance/newSpecimenEditingButtonFor..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,7 @@ | ||
*Babylonian-ExampleMining-Core | ||
newSpecimenEditingButtonFor: specimenConstructor | ||
|
||
^ self newSpecimenSelectionButtonOnClick: [(self example resolveLiveSpecimen: specimenConstructor) inspect]; | ||
labelGraphic: (BPIcons wrenchIcon scaledToSize: self iconSize * 0.7); | ||
balloonText: 'Click to open the specimen editing tool'; | ||
yourself |
7 changes: 7 additions & 0 deletions
7
Babylonian-ExampleMining-Core.package/BPMethodExampleMorph.extension/methodProperties.json
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,7 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"addArgumentScriptMorphs" : "joabe 7/6/2023 22:59", | ||
"addReceiverConstructorMorph" : "joabe 7/6/2023 22:51", | ||
"newSpecimenEditingButtonFor:" : "joabe 7/6/2023 23:01" } } |
2 changes: 2 additions & 0 deletions
2
Babylonian-ExampleMining-Core.package/BPMethodExampleMorph.extension/properties.json
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,2 @@ | ||
{ | ||
"name" : "BPMethodExampleMorph" } |
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
4 changes: 4 additions & 0 deletions
4
packages/Babylonian-Core.package/BPExampleRecorder.class/instance/recordedCalls.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,4 @@ | ||
accessing | ||
recordedCalls | ||
|
||
^ recordedCalls |
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