Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest changes #514

Merged
merged 4 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/NewTools-Inspector/StObjectContextPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ StObjectContextPresenter >> doEvaluateAndGo [
onCompileError: [ ^ self ]
onError: [ :e | e pass ].

activationBlock value: (StEvaluatedSelectionModel newValue: value)
activationBlock value: value
]

{ #category : #private }
Expand Down
20 changes: 10 additions & 10 deletions src/NewTools-Playground/StPlaygroundPagePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ 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
]

Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -396,6 +394,8 @@ StPlaygroundPagePresenter >> updateLineNumber [
{ #category : #initialization }
StPlaygroundPagePresenter >> updatePresenter [

page ifNotNil: [
text text: page contents ].
self updateLineNumber
]

Expand Down
31 changes: 31 additions & 0 deletions src/NewTools-Playground/StPlaygroundScriptPage.class.st
Original file line number Diff line number Diff line change
@@ -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
]