From b24e44d22c1f5352c67733842cbe3363ea98ad09 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Thu, 9 Mar 2023 14:46:20 +0100 Subject: [PATCH 1/3] fixed an inconsistence in the model that made that playground activations were incompatible with inspector activations. --- .../StObjectInspectorPresenter.class.st | 2 +- .../StPlaygroundPagePresenter.class.st | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/NewTools-Inspector/StObjectInspectorPresenter.class.st b/src/NewTools-Inspector/StObjectInspectorPresenter.class.st index 4fc909391..92dbca344 100644 --- a/src/NewTools-Inspector/StObjectInspectorPresenter.class.st +++ b/src/NewTools-Inspector/StObjectInspectorPresenter.class.st @@ -71,7 +71,7 @@ StObjectInspectorPresenter class >> openOn: anObject [ StObjectInspectorPresenter >> activate: aSelection [ activationBlock ifNil: [ ^ self ]. - activationBlock cull: aSelection + activationBlock cull: (SpActivatedSelection newValue: aSelection) ] { #category : #accessing } diff --git a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st index cf25043b4..50c2acc60 100644 --- a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st @@ -169,15 +169,15 @@ StPlaygroundPagePresenter >> doEvaluateAllAndGo [ { #category : #commands } StPlaygroundPagePresenter >> doEvaluateAndGo [ | value | - + activationBlock ifNil: [ ^ self ]. - value := text + value := text evaluate: text selectedTextOrLine onCompileError: [ ^ self ] onError: [ :e | e pass ]. - - activationBlock value: value + + activationBlock value: (SpActivatedSelection newValue: value) ] { #category : #accessing } @@ -207,18 +207,16 @@ StPlaygroundPagePresenter >> initializePresenters [ contextKeyBindings: (self menuActionsFor: text) asKMCategory; whenTextChangedDo: [ :aString | page contents: aString ]. - text announcer - when: SpCodeWillBeEvaluatedAnnouncement + text announcer + when: SpCodeWillBeEvaluatedAnnouncement send: #ensureContentsFlushed to: self. - - text eventHandler + + text eventHandler whenKeyUpDo: [ :event | self updateLineNumber ]; whenMouseUpDo: [ :event | self updateLineNumber ]; "before taking focus position will be nil, ensure I have the correct one" - whenFocusReceivedDo: [ self updateLineNumber ]. - - self updatePresenter + whenFocusReceivedDo: [ self updateLineNumber ] ] { #category : #initialization } @@ -396,6 +394,8 @@ StPlaygroundPagePresenter >> updateLineNumber [ { #category : #initialization } StPlaygroundPagePresenter >> updatePresenter [ + page ifNotNil: [ + text text: page contents ]. self updateLineNumber ] From f89c70fc35e7bbc1b13db85722d79a3293a2e265 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Thu, 9 Mar 2023 15:08:56 +0100 Subject: [PATCH 2/3] an extension load a playground page with an existing script instead a playground content. --- .../StPlaygroundScriptPage.class.st | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/NewTools-Playground/StPlaygroundScriptPage.class.st diff --git a/src/NewTools-Playground/StPlaygroundScriptPage.class.st b/src/NewTools-Playground/StPlaygroundScriptPage.class.st new file mode 100644 index 000000000..f1f7b4981 --- /dev/null +++ b/src/NewTools-Playground/StPlaygroundScriptPage.class.st @@ -0,0 +1,31 @@ +" +This is a special kind of page to point to any script file. +This can be used to extend open a `StPlaygroundPagePresenter`to be used with any script referenced by a `FileReference`. + +Example: +``` +reference := 'script.st' asFileReference. +(StPlaygroundPagePresenter on: (StPlaygroundScriptPage fromReference: reference)) open +``` +" +Class { + #name : #StPlaygroundScriptPage, + #superclass : #StPlaygroundPage, + #instVars : [ + 'fileReference' + ], + #category : #'NewTools-Playground-Model' +} + +{ #category : #accessing } +StPlaygroundScriptPage >> fileReference [ + + ^ fileReference +] + +{ #category : #initialization } +StPlaygroundScriptPage >> fromReference: aFileReference [ + + super fromReference: aFileReference. + fileReference := aFileReference +] From 52cb6e56492dddd5a25713d706a40040d8381743 Mon Sep 17 00:00:00 2001 From: Esteban Lorenzano Date: Sat, 29 Apr 2023 00:31:04 +0200 Subject: [PATCH 3/3] fixed (I think) a problem with selections and transmissions. --- src/NewTools-Inspector/StObjectContextPresenter.class.st | 2 +- src/NewTools-Inspector/StObjectInspectorPresenter.class.st | 2 +- src/NewTools-Playground/StPlaygroundPagePresenter.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NewTools-Inspector/StObjectContextPresenter.class.st b/src/NewTools-Inspector/StObjectContextPresenter.class.st index a156036ac..2eddb1ffc 100644 --- a/src/NewTools-Inspector/StObjectContextPresenter.class.st +++ b/src/NewTools-Inspector/StObjectContextPresenter.class.st @@ -39,7 +39,7 @@ StObjectContextPresenter >> doEvaluateAndGo [ onCompileError: [ ^ self ] onError: [ :e | e pass ]. - activationBlock value: (StEvaluatedSelectionModel newValue: value) + activationBlock value: value ] { #category : #private } diff --git a/src/NewTools-Inspector/StObjectInspectorPresenter.class.st b/src/NewTools-Inspector/StObjectInspectorPresenter.class.st index 92dbca344..4fc909391 100644 --- a/src/NewTools-Inspector/StObjectInspectorPresenter.class.st +++ b/src/NewTools-Inspector/StObjectInspectorPresenter.class.st @@ -71,7 +71,7 @@ StObjectInspectorPresenter class >> openOn: anObject [ StObjectInspectorPresenter >> activate: aSelection [ activationBlock ifNil: [ ^ self ]. - activationBlock cull: (SpActivatedSelection newValue: aSelection) + activationBlock cull: aSelection ] { #category : #accessing } diff --git a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st index 50c2acc60..12bb87f57 100644 --- a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st @@ -177,7 +177,7 @@ StPlaygroundPagePresenter >> doEvaluateAndGo [ onCompileError: [ ^ self ] onError: [ :e | e pass ]. - activationBlock value: (SpActivatedSelection newValue: value) + activationBlock value: value ] { #category : #accessing }