diff --git a/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/instance/addModelItemsToWindowMenu..st b/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/instance/addModelItemsToWindowMenu..st index 82c5b8059..87ca9788a 100644 --- a/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/instance/addModelItemsToWindowMenu..st +++ b/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/instance/addModelItemsToWindowMenu..st @@ -1,11 +1,17 @@ *TruffleSqueak-Tools-Editor-Core addModelItemsToWindowMenu: aMenu + aMenu addLine. + aMenu + addUpdating: #toggleShowLanguageScopesLabel + target: self + action: #toggleShowLanguageScopes. + Smalltalk at: #PolyglotEditor ifPresent: [ :unused | + aMenu addLine. aMenu add: 'open in Polyglot Editor' target: self - selector: #openInPolyglotEditor. - aMenu addLine ]. + selector: #openInPolyglotEditor ]. super addModelItemsToWindowMenu: aMenu \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/methodProperties.json b/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/methodProperties.json index 123470bd0..aae2d5c3e 100644 --- a/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/methodProperties.json +++ b/src/TruffleSqueak-Tools-Editor-Core.package/PolyglotNotebook.extension/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "addModelItemsToWindowMenu:" : "fn 5/13/2020 16:26", + "addModelItemsToWindowMenu:" : "fn 6/28/2021 16:10", "openInPolyglotEditor" : "fn 5/13/2020 12:06" } } diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/instance/run.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/instance/run.st index 56cde98f2..8d9e930e4 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/instance/run.st +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/instance/run.st @@ -7,4 +7,5 @@ run result ifNotNil: [self output displayResult: result. self cellContainer changed: #submorphs]. self cellContainer notebook changed: #getList. - self cellContainer notebook changed: #expandRootsRequested. \ No newline at end of file + self cellContainer notebook showLanguageScopes ifFalse: [ + self cellContainer notebook changed: #expandRootsRequested ] \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/methodProperties.json b/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/methodProperties.json index 27b1080b7..8debda9c1 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/methodProperties.json +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PNBCodeCell.class/methodProperties.json @@ -19,5 +19,5 @@ "outputs:" : "fn 3/25/2019 18:49", "outputsAsJson" : "fn 3/25/2019 18:17", "remove" : "fn 3/27/2019 11:16", - "run" : "fn 6/20/2019 16:00", + "run" : "fn 6/28/2021 16:09", "up" : "fn 3/27/2019 11:16" } } diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildSidebar..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildSidebar..st index 99e59312c..c98bccdf5 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildSidebar..st +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildSidebar..st @@ -12,11 +12,11 @@ buildSidebar: builder model: self; nodeClass: PNBBindingsWrapper; roots: #getList; - "keyPress: #explorerKey:from:event:;" + keyPress: #explorerKey:from:event:; getSelected: #currentSelection; - "setSelected: #currentSelection:;" + setSelected: #currentSelection:; "setSelectedParent: #currentParent:;" - "menu: #genericMenu:;" + menu: #genericMenu:; "dragItem: #getDragItem:;" columns: (PNBBindingsWrapper showContentsInColumns ifTrue: [{ diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildWith..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildWith..st index 91dec9f8d..31cb499ec 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildWith..st +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/buildWith..st @@ -11,5 +11,5 @@ buildWith: builder window := builder build: windowSpec. (window allMorphs select: [:m | m isKindOf: PluggableButtonMorphPlus ]) do: [:b | b borderWidth: 0]. (window allMorphs detect: [:m | m isKindOf: PluggableTreeMorph ]) borderWidth: 0; color: (Color fromString: '#F5F5F5'). - self changed: #expandRootsRequested. + self showLanguageScopes ifFalse: [ self changed: #expandRootsRequested ]. ^ window. \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection..st new file mode 100644 index 000000000..16760caa6 --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection..st @@ -0,0 +1,8 @@ +model +currentSelection: anObject + + self currentSelection == anObject ifTrue: [^ self]. + + currentSelection := anObject. + + self changed: #currentSelection. \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection.st index b667d99c8..b5db60ab8 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection.st +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/currentSelection.st @@ -1,4 +1,4 @@ model currentSelection - ^ 1 \ No newline at end of file + ^ currentSelection \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/explorerKey.from.event..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/explorerKey.from.event..st new file mode 100644 index 000000000..cb980ce5b --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/explorerKey.from.event..st @@ -0,0 +1,10 @@ +actions +explorerKey: aChar from: view event: event + + event anyModifierKeyPressed ifFalse: [^ false]. + + self currentSelection ifNotNil: [ :obj | + aChar == $i ifTrue: [obj value inspect. ^ true]. + aChar == $I ifTrue: [obj value explore. ^ true] ]. + + ^ false \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/genericMenu..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/genericMenu..st new file mode 100644 index 000000000..3e126f3fd --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/genericMenu..st @@ -0,0 +1,9 @@ +actions +genericMenu: aMenu + ^ aMenu + add: 'inspect (i)' + target: self currentSelection value + selector: #inspect; + add: 'explore (I)' + target: self currentSelection value + selector: #explore \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getList.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getList.st index 8d39c02bb..668b56646 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getList.st +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getList.st @@ -1,3 +1,7 @@ model getList - ^ {'bindings' -> cellContainer bindings } \ No newline at end of file + ^ {'bindings' -> cellContainer bindings }, + (self showLanguageScopes + ifTrue: [ Polyglot availableLanguages collect: [ :ea | + ea getName asString -> (Polyglot primitiveGetScope: ea getId asSymbol) ] ] + ifFalse: [ #() ]) \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getMenu..st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getMenu..st new file mode 100644 index 000000000..f284dbb4c --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/getMenu..st @@ -0,0 +1,5 @@ +actions +getMenu: shiftKeyState + ^ (shiftKeyState not or: [Preferences noviceMode]) + ifTrue: [TextEditor yellowButtonMenu] + ifFalse: [TextEditor shiftedYellowButtonMenu] \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/showLanguageScopes.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/showLanguageScopes.st new file mode 100644 index 000000000..c382195e0 --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/showLanguageScopes.st @@ -0,0 +1,3 @@ +accessing +showLanguageScopes + ^ showLanguageScopes ifNil: [ showLanguageScopes := false ] \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopes.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopes.st new file mode 100644 index 000000000..0d72dd6a6 --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopes.st @@ -0,0 +1,4 @@ +actions +toggleShowLanguageScopes + showLanguageScopes := self showLanguageScopes not. + self changed: #getList \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopesLabel.st b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopesLabel.st new file mode 100644 index 000000000..ae90f5e92 --- /dev/null +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/instance/toggleShowLanguageScopesLabel.st @@ -0,0 +1,6 @@ +actions +toggleShowLanguageScopesLabel + + ^self showLanguageScopes + ifTrue: [ ' show language scopes' ] + ifFalse: [ ' show language scopes' ] \ No newline at end of file diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/methodProperties.json b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/methodProperties.json index 684d47ac5..d15c81df4 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/methodProperties.json +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/methodProperties.json @@ -12,16 +12,23 @@ "actionRunAll" : "fn 3/30/2019 00:29", "actionSave" : "fn 3/26/2019 11:55", "buildCodePaneWith:" : "fn 3/27/2019 10:07", - "buildSidebar:" : "fn 2/10/2020 16:44", + "buildSidebar:" : "fn 6/28/2021 16:22", "buildSwitchesWith:" : "fn 3/27/2019 10:38", - "buildWith:" : "fn 3/27/2019 10:36", + "buildWith:" : "fn 6/28/2021 16:09", "buttonHeight" : "fn 3/27/2019 10:39", "cellContainer" : "fn 4/13/2019 23:23", "cellContainer:" : "fn 3/26/2019 11:31", "contents" : "fn 4/13/2019 23:35", "contentsSelection" : "fn 3/26/2019 09:19", - "currentSelection" : "fn 3/26/2019 09:22", + "currentSelection" : "fn 6/28/2021 16:16", + "currentSelection:" : "fn 6/28/2021 16:16", "defaultWindowColor" : "fn 3/26/2019 12:06", - "getList" : "fn 6/27/2021 17:20", + "explorerKey:from:event:" : "fn 6/28/2021 16:17", + "genericMenu:" : "fn 6/28/2021 16:24", + "getList" : "fn 6/28/2021 16:07", + "getMenu:" : "fn 6/28/2021 16:21", + "showLanguageScopes" : "fn 6/28/2021 16:06", + "toggleShowLanguageScopes" : "fn 6/28/2021 16:12", + "toggleShowLanguageScopesLabel" : "fn 6/28/2021 16:12", "topConstantHeightFrame:fromLeft:width:" : "fn 3/26/2019 09:32", "uniformWindowColor" : "fn 3/26/2019 12:06" } } diff --git a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/properties.json b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/properties.json index e3785b4db..178c6782b 100644 --- a/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/properties.json +++ b/src/TruffleSqueak-Tools-Notebook-Core.package/PolyglotNotebook.class/properties.json @@ -6,7 +6,9 @@ ], "commentStamp" : "", "instvars" : [ - "cellContainer" ], + "cellContainer", + "currentSelection", + "showLanguageScopes" ], "name" : "PolyglotNotebook", "pools" : [ ],