diff --git a/.smalltalk.all.ston b/.smalltalk.all.ston index b248a95b..f6cf7981 100644 --- a/.smalltalk.all.ston +++ b/.smalltalk.all.ston @@ -22,6 +22,7 @@ SmalltalkCISpec { 'Monticello.*', 'Metacello.*', 'System-Settings-Tests.*', + 'System-Dependencies-Tests', 'ReleaseTests.*' ], #classes : [ #OutOfMemoryTest, diff --git a/.smalltalk.release.ston b/.smalltalk.release.ston index 119928fc..7876109e 100644 --- a/.smalltalk.release.ston +++ b/.smalltalk.release.ston @@ -12,6 +12,7 @@ SmalltalkCISpec { #testing : { #packages : [ 'System-Settings-Tests.*', + 'System-Dependencies-Tests', 'ReleaseTests.*' ] } } diff --git a/src/BaselineOfNewTools/BaselineOfNewTools.class.st b/src/BaselineOfNewTools/BaselineOfNewTools.class.st index 49bcb8cf..8353bf3a 100644 --- a/src/BaselineOfNewTools/BaselineOfNewTools.class.st +++ b/src/BaselineOfNewTools/BaselineOfNewTools.class.st @@ -53,12 +53,14 @@ BaselineOfNewTools >> baseline: spec [ package: 'NewTools-Spotter-Processors-Tests' with: [ spec requires: #( 'NewTools-Spotter-Processors' ) ]; package: 'NewTools-Spotter-Tests' with: [ spec requires: #( 'NewTools-Spotter' ) ]; package: 'NewTools-Morphic-Spotter' with: [ spec requires: #( 'NewTools-Morphic' ) ]; + "file browser" + package: 'NewTools-FileBrowser' with: [ spec requires: #( 'NewTools-Core' ) ]; + package: 'NewTools-FileBrowser-Morphic' with: [ spec requires: #( 'NewTools-FileBrowser' ) ]; + package: 'NewTools-FileBrowser-Tests' with: [ spec requires: #( 'NewTools-FileBrowser' ) ]; "extras" package: 'HelpCenter' with: [ spec requires: #( 'NewTools-Core' ) ]; package: 'NewTools-FlagBrowser' with: [ spec requires: #( 'NewTools-Core' ) ]; - package: 'NewTools-FlagBrowser-Tests' with: [ spec requires: #( 'NewTools-FlagBrowser' ) ]; - package: 'NewTools-FileBrowser' with: [ spec requires: #( 'NewTools-Core' ) ]; - package: 'NewTools-FileBrowser-Tests' with: [ spec requires: #( 'NewTools-FileBrowser' ) ]; + package: 'NewTools-FlagBrowser-Tests' with: [ spec requires: #( 'NewTools-FlagBrowser' ) ]; package: 'NewTools-FontChooser' with: [ spec requires: #( 'NewTools-Core' ) ]; package: 'NewTools-FontChooser-Tests' with: [ spec requires: #( 'NewTools-FontChooser' ) ]; package: 'NewTools-SpTextPresenterDecorators'; diff --git a/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st b/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st index a36b4fe5..9d2e4c04 100644 --- a/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st +++ b/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st @@ -182,19 +182,16 @@ StCritiqueBrowserPresenter >> browseRule [ ] { #category : 'private' } -StCritiqueBrowserPresenter >> buildRuleMenu [ - - ^ SpMenuPresenter new - addGroup: [ :group | - group addItem: [ :item | - item - name: 'Browse rule' translated; - action: [ self browseRule ] ]. - group addItem: [ :item | - item - name: 'Reapply this rule' translated; - action: [ self reapplyThisRule ] ] ]; - yourself +StCritiqueBrowserPresenter >> buildRuleMenuActions [ + + ^ SpActionGroup new + addActionWith: [ :item | item + name: 'Browse rule' translated; + action: [ self browseRule ] ]; + addActionWith: [ :item | item + name: 'Reapply this rule' translated; + action: [ self reapplyThisRule ] ]; + yourself ] { #category : 'system annoucements' } @@ -579,14 +576,15 @@ StCritiqueBrowserPresenter >> setResetButton [ { #category : 'system annoucements' } StCritiqueBrowserPresenter >> setRulesModel [ -rulesModel children: [ :rule | + + rulesModel children: [ :rule | rule isComposite ifTrue: [ rule rules asArray ] - ifFalse: [ #( ) ] ]. + ifFalse: [ #() ] ]. rulesModel addColumn: ((SpStringTableColumn evaluated: [ :rule | self stringMorphForRule: rule ]) title: 'Rules Group'). - rulesModel contextMenu: self buildRuleMenu. + rulesModel actions: self buildRuleMenuActions ] { #category : 'api' } diff --git a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st index cc11edda..6413e53b 100644 --- a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st +++ b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st @@ -156,47 +156,38 @@ StSingleCritiqueResultListPresenter >> browseCritique [ { #category : 'accessing' } StSingleCritiqueResultListPresenter >> buildMenuCritique [ - ^ SpMenuPresenter new - addGroup: [ :group | - group addItem: [ :item | - item - name: 'Browse' translated; - action: [ self browseCritique ] ] ]; - addGroup: [ :group | - group addItem: [ :item | - item - name: 'Mark as wrong' translated; - visibleIf: [ self isCritiqueFalsePositive not ]; - action: [ self addCritiqueToFalsePositive ] ]. - group addItem: [ :item | - item - name: 'Unmark as wrong' translated; - visibleIf: [ self isCritiqueFalsePositive ]; - action: [ self removeCritiqueToFalsePositive ] ]. - group addItem: [ :item | - item - name: 'Unmark as To Do' translated; - visibleIf: [ self isCritiqueToDo ]; - action: [ self removeCritiqueToDo ] ]. - group addItem: [ :item | - item - name: 'Mark as To Do' translated; - visibleIf: [ self isCritiqueToDo not ]; - action: [ self addCritiqueToDo ] ] ]; - addGroup: [ :group | - group addItem: [ :item | - item - name: 'View rationale behind the rule' translated; - action: [ self rationaleOfRule ] ]. - group addItem: [ :item | - item - name: 'Automatically resolve the issue' translated; - visibleIf: [ critiquesModel selectedItem providesChange ]; - action: [ self applyTransformation ] ]. - group addItem: [ :item | - item - name: 'Ban this rule' translated; - action: [ self banRule ] ] ]; + ^ SpActionGroup new + addActionWith: [ :item | item + name: 'Browse' translated; + action: [ self browseCritique ] ]; + addGroupWith: [ :group | group + addActionWith: [ :item | item + name: 'Mark as wrong' translated; + actionEnabled: [ self isCritiqueFalsePositive not ]; + action: [ self addCritiqueToFalsePositive ] ]; + addActionWith: [ :item | item + name: 'Unmark as wrong' translated; + actionEnabled: [ self isCritiqueFalsePositive ]; + action: [ self removeCritiqueToFalsePositive ] ]; + addActionWith: [ :item | item + name: 'Unmark as To Do' translated; + actionEnabled: [ self isCritiqueToDo ]; + action: [ self removeCritiqueToDo ] ]; + addActionWith: [ :item | item + name: 'Mark as To Do' translated; + actionEnabled: [ self isCritiqueToDo not ]; + action: [ self addCritiqueToDo ] ] ]; + addGroupWith: [ :group | group + addActionWith: [ :item | item + name: 'View rationale behind the rule' translated; + action: [ self rationaleOfRule ] ]; + addActionWith: [ :item | item + name: 'Automatically resolve the issue' translated; + actionEnabled: [ critiquesModel selectedItem providesChange ]; + action: [ self applyTransformation ] ]; + addActionWith: [ :item | item + name: 'Ban this rule' translated; + action: [ self banRule ] ] ]; yourself ] @@ -308,7 +299,7 @@ StSingleCritiqueResultListPresenter >> initializePresenters [ critiquesModel beMultipleSelection. critiquesModel display: [ :selec | self initializeDisplayCritique: selec forRule: rule ]. - critiquesModel contextMenu: self buildMenuCritique. + critiquesModel actions: self buildMenuCritique. critiquesModel displayIcon: [ :item | self iconFor: item ]. self focusOrder add: critiquesModel; @@ -320,8 +311,9 @@ StSingleCritiqueResultListPresenter >> initializePresenters [ StSingleCritiqueResultListPresenter >> initializeShortcuts [ critiquesModel - bindKeyCombination: PharoShortcuts current browseShortcut - toAction: [ self browseCritique ] + addShortcutWith: [ :action | action + shortcutKey: PharoShortcuts current browseShortcut; + action: [ self browseCritique ] ] ] { #category : 'private' } diff --git a/src/NewTools-Core/StHeaderPanel.class.st b/src/NewTools-Core/StHeaderPanel.class.st index cd852356..a8702fa3 100644 --- a/src/NewTools-Core/StHeaderPanel.class.st +++ b/src/NewTools-Core/StHeaderPanel.class.st @@ -25,8 +25,9 @@ StHeaderPanel >> addWindowShortcutsTo: aWindowPresenter [ shortcut ifNil: [ ^ self ]. aWindowPresenter - bindKeyCombination: shortcut - toAction: [ presenter takeKeyboardFocus ] + addShortcutWith: [ :action | action + shortcutKey: shortcut; + action: [ presenter takeKeyboardFocus ] ] ] { #category : 'initialization' } diff --git a/src/NewTools-DebugPointsBrowser/DebugPointBrowserPresenter.class.st b/src/NewTools-DebugPointsBrowser/DebugPointBrowserPresenter.class.st index 7e0e3db1..9ab3c8e0 100644 --- a/src/NewTools-DebugPointsBrowser/DebugPointBrowserPresenter.class.st +++ b/src/NewTools-DebugPointsBrowser/DebugPointBrowserPresenter.class.st @@ -127,7 +127,7 @@ DebugPointBrowserPresenter >> initializePresenters [ { #category : 'presenter building' } DebugPointBrowserPresenter >> initializeTable [ - dpTable := DebugPointTablePresenter new. + dpTable := self instantiate: DebugPointTablePresenter. dpTable whenSelectionChangedDo: [ :sel | dpEditor debugPoint: dpTable selectedItem. diff --git a/src/NewTools-DebugPointsBrowser/DebugPointSelectDialogPresenter.class.st b/src/NewTools-DebugPointsBrowser/DebugPointSelectDialogPresenter.class.st index a95bb5e4..d664fd88 100644 --- a/src/NewTools-DebugPointsBrowser/DebugPointSelectDialogPresenter.class.st +++ b/src/NewTools-DebugPointsBrowser/DebugPointSelectDialogPresenter.class.st @@ -32,10 +32,10 @@ DebugPointSelectDialogPresenter >> initializePresenters [ label := self newLabel. - list := DebugPointTablePresenter new. + list := self instantiate: DebugPointTablePresenter. code := DebugPointCodePresenter new - beForScripting; - editable: false. + beForScripting; + editable: false. self initializeVariableTargetPresenter. diff --git a/src/NewTools-DebugPointsBrowser/DebugPointTablePresenter.class.st b/src/NewTools-DebugPointsBrowser/DebugPointTablePresenter.class.st index 13435795..44aea404 100644 --- a/src/NewTools-DebugPointsBrowser/DebugPointTablePresenter.class.st +++ b/src/NewTools-DebugPointsBrowser/DebugPointTablePresenter.class.st @@ -9,60 +9,44 @@ Class { } { #category : 'context menu' } -DebugPointTablePresenter >> debugPointContextMenu [ +DebugPointTablePresenter >> debugPointActions [ - ^ self newMenu - addGroup: [ :aGroup | - aGroup - addItem: [ :anItem | - anItem - name: 'Inspect'; - description: 'inspect this debug point'; - enabled: [ self selectedItem isNotNil ]; - action: [ self selectedItem inspect ] ]; - addItem: [ :anItem | - anItem - name: 'Browse Target'; - description: 'browse target of the selected debug point'; - enabled: [ self selectedItem isNotNil ]; - action: [ self selectedItem browse ] ]; - addItem: [ :anItem | - anItem - name: 'Inspect Current Scope'; - description: - 'inspect the current scope of the selected debug point'; - enabled: [ self selectedItem isNotNil ]; - action: [ self selectedItem scope inspect ] ]; - addItem: [ :anItem | - anItem - name: 'Reset Current Scope'; - description: - 'resetting the current scope of the selected debug point'; - enabled: [ self selectedItem isNotNil ]; - action: [ self selectedItem resetObjectScope ] ]; - addItem: [ :anItem | - anItem - name: 'Remove'; - description: 'removes the selected debug point'; - enabled: [ self selectedItem isNotNil ]; - action: [ - self selectedItem remove. - self refresh ] ] ]; - addGroup: [ :aGroup | - aGroup addItem: [ :anItem | - anItem - name: 'Refresh'; - description: 'refresh this window'; - action: [ self refresh ] ] ] + ^ SpActionGroup new + addActionWith: [ :anItem | anItem + name: 'Inspect'; + description: 'inspect this debug point'; + actionEnabled: [ self selectedItem isNotNil ]; + action: [ self selectedItem inspect ] ]; + addActionWith: [ :anItem | anItem + name: 'Browse Target'; + description: 'browse target of the selected debug point'; + actionEnabled: [ self selectedItem isNotNil ]; + action: [ self selectedItem browse ] ]; + addActionWith: [ :anItem | anItem + name: 'Inspect Current Scope'; + description: 'inspect the current scope of the selected debug point'; + actionEnabled: [ self selectedItem isNotNil ]; + action: [ self selectedItem scope inspect ] ]; + addActionWith: [ :anItem | anItem + name: 'Reset Current Scope'; + description: 'resetting the current scope of the selected debug point'; + actionEnabled: [ self selectedItem isNotNil ]; + action: [ self selectedItem resetObjectScope ] ]; + addActionWith: [ :anItem | anItem + name: 'Remove'; + description: 'removes the selected debug point'; + actionEnabled: [ self selectedItem isNotNil ]; + action: [ + self selectedItem remove. + self refresh ] ]; + addGroupWith: [ :aGroup | aGroup + addActionWith: [ :anItem | anItem + name: 'Refresh'; + description: 'refresh this window'; + action: [ self refresh ] ] ] ] { #category : 'initialization' } -DebugPointTablePresenter >> initialize [ - super initialize. - self initializeDebugPointTable -] - -{ #category : 'presenter building' } DebugPointTablePresenter >> initializeDebugPointTable [ self beResizable. @@ -95,10 +79,9 @@ DebugPointTablePresenter >> initializeDebugPointTable [ addColumn: (SpStringTableColumn title: 'Scope' evaluated: [ :item | item scopeString ]); - contextMenu: self debugPointContextMenu. + actions: self debugPointActions. self items: DebugPoint all asOrderedCollection. - self dropEnabled: true. self dragEnabled: true. self wantsDrop: [ :item | @@ -109,3 +92,9 @@ DebugPointTablePresenter >> initializeDebugPointTable [ ((self itemAt: item row) getBehavior: ChainBehavior) putChild: item passenger first ] ] + +{ #category : 'initialization' } +DebugPointTablePresenter >> initializePresenters [ + + self initializeDebugPointTable +] diff --git a/src/NewTools-Debugger-Breakpoints-Tools/StObjectBreakpointInspection.class.st b/src/NewTools-Debugger-Breakpoints-Tools/StObjectBreakpointInspection.class.st index 4f1f39e4..5cfe6938 100644 --- a/src/NewTools-Debugger-Breakpoints-Tools/StObjectBreakpointInspection.class.st +++ b/src/NewTools-Debugger-Breakpoints-Tools/StObjectBreakpointInspection.class.st @@ -75,15 +75,15 @@ StObjectBreakpointInspection >> buildHaltAndBreakpointTable [ addColumn: ((SpStringTableColumn title: 'Scope' - evaluated: [ :item | item printScope]) + evaluated: [ :item | item printScope ]) width: 120; yourself); addColumn: (SpStringTableColumn title: 'Target' - evaluated: [ :item | item printEntity]). + evaluated: [ :item | item printEntity ]). methodsWithBreakpoints - contextMenu: self rootCommandsGroup asMenuPresenter + actions: self rootCommandsGroup ] { #category : 'private' } diff --git a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st index aeb09fcf..68253a45 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st @@ -227,7 +227,6 @@ StDebuggerTest >> testClose [ debugger := self debuggerOn: session. actionModel := debugger debuggerActionModel. windowPresenter presenter: debugger. - debugger initializeWindow: windowPresenter. "We trigger the closing from the presenter instead of the debugger itself, because the window is not really open so the debugger will not close through debugger close." diff --git a/src/NewTools-Debugger/SpCodePresenter.extension.st b/src/NewTools-Debugger/SpCodePresenter.extension.st index 7268c4f2..582a5e06 100644 --- a/src/NewTools-Debugger/SpCodePresenter.extension.st +++ b/src/NewTools-Debugger/SpCodePresenter.extension.st @@ -2,5 +2,6 @@ Extension { #name : 'SpCodePresenter' } { #category : '*NewTools-Debugger' } SpCodePresenter >> beForContext: aContext [ + self interactionModel: (StDebuggerContextInteractionModel on: aContext) ] diff --git a/src/NewTools-Debugger/StDebugger.class.st b/src/NewTools-Debugger/StDebugger.class.st index 4e154e47..43ea5f85 100644 --- a/src/NewTools-Debugger/StDebugger.class.st +++ b/src/NewTools-Debugger/StDebugger.class.st @@ -329,8 +329,7 @@ StDebugger >> buildContextMenus [ debuggerCommandGroup := self rootCommandsGroup. "Stack" stackGroup := debuggerCommandGroup / StDebuggerStackCommandTreeBuilder groupName. - stackTable contextMenu: stackGroup beRoot asMenuPresenter. - stackTable contextKeyBindings: (self keybindsForFromContextMenu: stackGroup). + stackTable actions: stackGroup. "Toolbar" toolbarCommandGroup := debuggerCommandGroup / StDebuggerToolbarCommandTreeBuilder groupName. @@ -340,10 +339,10 @@ StDebugger >> buildContextMenus [ "Code" codeCommands := debuggerCommandGroup / StDebuggerCodeCommandTreeBuilder groupName. - code contextMenu: codeCommands beRoot asMenuPresenter. + code actions: codeCommands. "Configuration" - stackHeader toolbarActions: (debuggerCommandGroup / StDebuggerConfigurationCommandTreeBuilder groupName). + stackHeader toolbarActions: (debuggerCommandGroup / StDebuggerConfigurationCommandTreeBuilder groupName) ] { #category : 'commands - support' } @@ -794,21 +793,23 @@ StDebugger >> initializeShortcuts: aWindowPresenter [ "This is only because of a problem in presenters, where shortcuts only work in the scope of their presenter. Consequently, debug shortcuts from the debugger toolbar only work if the mouse is over the toolbar button. This should be removed once the spec bug is fixed" - aWindowPresenter - bindKeyCombination: StProceedCommand defaultShortcut - toAction: [ self proceedDebugSession ]. - aWindowPresenter - bindKeyCombination: StStepIntoCommand defaultShortcut - toAction: [ self stepInto ]. - aWindowPresenter - bindKeyCombination: StStepOverCommand defaultShortcut - toAction: [ self stepOver ]. - aWindowPresenter - bindKeyCombination: StStepThroughCommand defaultShortcut - toAction: [ self stepThrough ]. - aWindowPresenter - bindKeyCombination: StRestartCommand defaultShortcut - toAction: [ self restartCurrentContext ] + + aWindowPresenter + addShortcutWith: [ :action | action + shortcutKey: StProceedCommand defaultShortcut; + action: [ self proceedDebugSession ] ]; + addShortcutWith: [ :action | action + shortcutKey: StStepIntoCommand defaultShortcut; + action: [ self stepInto ] ]; + addShortcutWith: [ :action | action + shortcutKey: StStepOverCommand defaultShortcut; + action: [ self stepOver ] ]; + addShortcutWith: [ :action | action + shortcutKey: StStepThroughCommand defaultShortcut; + action: [ self stepThrough ] ]; + addShortcutWith: [ :action | action + shortcutKey: StRestartCommand defaultShortcut; + action: [ self restartCurrentContext ] ] ] { #category : 'stack' } diff --git a/src/NewTools-Debugger/StDebuggerMethodImplementorExtension.class.st b/src/NewTools-Debugger/StDebuggerMethodImplementorExtension.class.st index 77383290..504a91d9 100644 --- a/src/NewTools-Debugger/StDebuggerMethodImplementorExtension.class.st +++ b/src/NewTools-Debugger/StDebuggerMethodImplementorExtension.class.st @@ -36,19 +36,27 @@ StDebuggerMethodImplementorExtension class >> showInDebugger [ { #category : 'presenters' } StDebuggerMethodImplementorExtension >> addProtocols: protocols [ - |sortedProtocols| - sortedProtocols := SortedCollection sortBlock: [ :p1 :p2|p1 name <= p2 name]. + | sortedProtocols | + + sortedProtocols := SortedCollection sortBlock: [ :p1 :p2 | p1 name <= p2 name ]. sortedProtocols addAll: protocols. - selectedProtocol emptyList. - sortedProtocols do: [ :p | - selectedProtocol - addItemLabeled: p - do: [ ] - icon: (p isExtensionProtocol - ifTrue: [ self iconNamed: #protocolExtension ] - ifFalse: [ self iconNamed: #protocolPublic ]) ]. + + selectedProtocol items: sortedProtocols. - customProtocolCheckBox state ifTrue:[self selectMatchingProtocol] + customProtocolCheckBox state + ifTrue:[ self selectMatchingProtocol ] +] + +{ #category : 'private - actions' } +StDebuggerMethodImplementorExtension >> addProtocolsFrom: aClassOrTrait [ + + aClassOrTrait ifNil: [ ^ self ]. + + self addProtocols: (aClassOrTrait isTrait + ifTrue: [ aClassOrTrait protocols ] + ifFalse: [ + ((aClassOrTrait withAllSuperclasses copyWithoutAll: {Object. ProtoObject}) + flatCollect: #protocols) asSet]) ] { #category : 'debugger extension' } @@ -87,8 +95,8 @@ StDebuggerMethodImplementorExtension >> defaultLayout [ { #category : 'actions' } StDebuggerMethodImplementorExtension >> implementMethod [ - | classOrTrait methodImplementor | + classOrTrait := classesAndTraits selectedItem. methodImplementor := (StDebuggerMethodImplementor forSession: self debugger session). @@ -101,54 +109,42 @@ StDebuggerMethodImplementorExtension >> implementMethod [ { #category : 'initialization' } StDebuggerMethodImplementorExtension >> initializePresenters [ - - | receiverClass traits | + description := self newLabel. description label: exception description. selectedProtocol := self newDropList. - selectedProtocol display: [ :p| p name ]. + selectedProtocol + display: [ :item | item name ]; + displayIcon: [ :aProtocol | (aProtocol isExtensionProtocol + ifTrue: [ self iconNamed: #protocolExtension ] + ifFalse: [ self iconNamed: #protocolPublic ]) ]. customProtocolTextInput := self newTextInput. customProtocolTextInput removeEntryCompletion. customProtocolTextInput placeholder: 'Add your protocol here'. customProtocolTextInput beNotEditable. - customProtocolTextInput whenTextChangedDo: [self selectMatchingProtocol]. + customProtocolTextInput whenTextChangedDo: [ self selectMatchingProtocol ]. customProtocolCheckBox := self newCheckBox. customProtocolCheckBox label: 'New protocol'. - customProtocolCheckBox whenActivatedDo: - [ customProtocolTextInput beEditable. - selectedProtocol enabled: false]. - customProtocolCheckBox whenDeactivatedDo: - [ customProtocolTextInput beNotEditable. + customProtocolCheckBox whenActivatedDo: [ + customProtocolTextInput beEditable. + selectedProtocol enabled: false ]. + customProtocolCheckBox whenDeactivatedDo: [ + customProtocolTextInput beNotEditable. selectedProtocol enabled: true ]. - - traits := OrderedCollection new. - receiverClass := exception receiver class. + classesAndTraits := self newDropList. - receiverClass withAllSuperclassesDo: [ :c | - traits addAll: c allTraits. - classesAndTraits - addItemLabeled: c - do: [ self addProtocols: (((c withAllSuperclasses copyWithoutAll: {Object. ProtoObject})) flatCollect: #protocols) asSet ] - icon: (self iconNamed: #class) ]. - traits do: [ :t | - classesAndTraits - addItemLabeled: t - do: [ self addProtocols: (t protocols) ] - icon: (self iconNamed: #trait) ]. + classesAndTraits + display: [ :item | item name ]; + displayIcon: [ :item | self iconNamed: item systemIconName ]; + whenSelectedItemChangedDo: [ :item | self addProtocolsFrom: item ]. createMethodButton := self newButton icon: (self iconNamed: #add); label: 'Add method'; action: [ self implementMethod ] - - - - - - ] { #category : 'actions' } @@ -178,3 +174,18 @@ StDebuggerMethodImplementorExtension >> setModelBeforeInitialization: aStDebugge debugger := aStDebugger. exception := debugger exception ] + +{ #category : 'initialization' } +StDebuggerMethodImplementorExtension >> updatePresenter [ + | traits receiverClass items | + + items := OrderedCollection new. + traits := OrderedCollection new. + receiverClass := exception receiver class. + + receiverClass withAllSuperclassesDo: [ :aClass | + traits addAll: aClass allTraits. + items add: aClass ]. + + classesAndTraits items: items +] diff --git a/src/NewTools-Debugger/StDebuggerStackCommandTreeBuilder.class.st b/src/NewTools-Debugger/StDebuggerStackCommandTreeBuilder.class.st index ec58d84a..4d44c106 100644 --- a/src/NewTools-Debugger/StDebuggerStackCommandTreeBuilder.class.st +++ b/src/NewTools-Debugger/StDebuggerStackCommandTreeBuilder.class.st @@ -42,7 +42,8 @@ StDebuggerStackCommandTreeBuilder >> browseGroupName [ { #category : 'building' } StDebuggerStackCommandTreeBuilder >> buildDebuggerCommandGroup [ - |stackGroup| + | stackGroup | + stackGroup := self group. stackGroup decoratedGroup register: self stackContextMenuBrowseCommands. stackGroup decoratedGroup register: self stackContextMenuExplorationCommands. @@ -71,15 +72,17 @@ StDebuggerStackCommandTreeBuilder >> stackActionsCommandsClasses [ { #category : 'commands' } StDebuggerStackCommandTreeBuilder >> stackContextMenuActionsCommands [ | group | + group := (CmCommandGroup named: self stackContextMenuActionsGroupName) asSpecGroup. group beDisplayedAsGroup. group description: self stackContextMenuActionsDescription. group iconName: #smallDoIt. - self stackActionsCommandsClasses - do: [ :cmdClass | - group - register: (self buildSpecCommand: cmdClass forContext: stDebuggerInstance) ]. + self stackActionsCommandsClasses do: [ :cmdClass | + group register: (self + buildSpecCommand: cmdClass + forContext: stDebuggerInstance) ]. + ^ group ] diff --git a/src/NewTools-Debugger/StRawInspectionPresenter.extension.st b/src/NewTools-Debugger/StRawInspectionPresenter.extension.st index 43008ae4..7c505f97 100644 --- a/src/NewTools-Debugger/StRawInspectionPresenter.extension.st +++ b/src/NewTools-Debugger/StRawInspectionPresenter.extension.st @@ -22,7 +22,7 @@ StRawInspectionPresenter >> beForDebugger [ attributeTable := (self instantiate: StDebuggerTreeTablePresenter) beResizable; - contextMenu: [ self rootCommandsGroup asMenuPresenter ]; + actions: self rootCommandsGroup; yourself. StInspectorPresenter inspectorDiveOnSingleClick diff --git a/src/NewTools-FileBrowser-Morphic/SpMorphicBackend.extension.st b/src/NewTools-FileBrowser-Morphic/SpMorphicBackend.extension.st new file mode 100644 index 00000000..6df58feb --- /dev/null +++ b/src/NewTools-FileBrowser-Morphic/SpMorphicBackend.extension.st @@ -0,0 +1,56 @@ +Extension { #name : 'SpMorphicBackend' } + +{ #category : '*NewTools-FileBrowser-Morphic' } +SpMorphicBackend >> executeOpenDirectoryDialog: aFileDialog [ + + ^ StOpenDirectoryPresenter new + defaultFolder: (aFileDialog path ifNil: [ StFileSystemModel defaultDirectory ]); + title: (aFileDialog title ifNil: [ 'Choose Directory' translated ]); + openModal; + selectedEntry +] + +{ #category : '*NewTools-FileBrowser-Morphic' } +SpMorphicBackend >> executeOpenFileDialog: aFileDialog [ + | dialog | + + dialog := self newFileDialogFor: aFileDialog. + ^ dialog openModal answer + ifNotNil: [ :aString | aString asFileReference ] +] + +{ #category : '*NewTools-FileBrowser-Morphic' } +SpMorphicBackend >> executeSaveFileDialog: aFileDialog [ + | dialog | + + dialog := self newFileDialogFor: aFileDialog. + dialog answerSaveFile. + ^ dialog openModal answer + ifNotNil: [ :aString | aString asFileReference ] +] + +{ #category : '*NewTools-FileBrowser-Morphic' } +SpMorphicBackend >> newFileDialogFor: aFileDialog [ + | dialog dialogClass | + + dialogClass := aFileDialog isOpenFile + ifTrue: [ StOpenFilePresenter ] + ifFalse: [ StOpenDirectoryPresenter ]. + dialog := dialogClass for: aFileDialog. + + aFileDialog path ifNotNil: [ :folder | dialog openFolder: folder ]. + aFileDialog filters ifNotEmpty: [ :filters | + dialog fileNavigationSystem + filter: (StCustomExtensionsFilter extensions: { filters }) ]. + + ^ dialog +] + +{ #category : '*NewTools-FileBrowser-Morphic' } +SpMorphicBackend >> openFileDialog: aFileDialog [ + + aFileDialog isOpenFile ifTrue: [ ^ self executeOpenFileDialog: aFileDialog ]. + aFileDialog isOpenDirectory ifTrue: [ ^ self executeOpenDirectoryDialog: aFileDialog ]. + + ^ self executeSaveFileDialog: aFileDialog +] diff --git a/src/NewTools-FileBrowser-Morphic/package.st b/src/NewTools-FileBrowser-Morphic/package.st new file mode 100644 index 00000000..a9a4b568 --- /dev/null +++ b/src/NewTools-FileBrowser-Morphic/package.st @@ -0,0 +1 @@ +Package { #name : 'NewTools-FileBrowser-Morphic' } diff --git a/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st b/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st index caf3999c..2977cff0 100644 --- a/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st +++ b/src/NewTools-FileBrowser/StDirectoryTreePresenter.class.st @@ -96,7 +96,7 @@ StDirectoryTreePresenter >> initializePresenters [ roots: StFileSystemItemWrapper roots; children: [ :aClass | aClass subdirectories ]; beResizable; - contextMenu: [ (self rootCommandsGroup / 'StFileBrowserDirectoryContextualMenu') beRoot asMenuPresenter ]. + actions: self rootCommandsGroup / 'StFileBrowserDirectoryContextualMenu' ] { #category : 'utilities' } diff --git a/src/NewTools-FileBrowser/StFileNavigationSystemPresenter.class.st b/src/NewTools-FileBrowser/StFileNavigationSystemPresenter.class.st index b2b5241a..03ed8242 100644 --- a/src/NewTools-FileBrowser/StFileNavigationSystemPresenter.class.st +++ b/src/NewTools-FileBrowser/StFileNavigationSystemPresenter.class.st @@ -102,8 +102,7 @@ StFileNavigationSystemPresenter class >> example [ StFileNavigationSystemPresenter >> beMultipleSelection [ self fileReferenceTable - beMultipleSelection; - comparisonStrategy: [ :a :b | a = b ] + beMultipleSelection ] { #category : 'api - customization' } diff --git a/src/NewTools-FileBrowser/StMorphicUIManager.class.st b/src/NewTools-FileBrowser/StMorphicUIManager.class.st index f589ca99..57ea4d13 100644 --- a/src/NewTools-FileBrowser/StMorphicUIManager.class.st +++ b/src/NewTools-FileBrowser/StMorphicUIManager.class.st @@ -34,6 +34,7 @@ StMorphicUIManager class >> isValidForCurrentSystemConfiguration [ { #category : 'ui requests' } StMorphicUIManager >> chooseDirectory: label from: dir [ + self flag: #ToDoWhenIntegration. self flag: 'use chooseDirectory:path: instead of this'. ^ StOpenDirectoryPresenter new diff --git a/src/NewTools-Finder/StFinderPresenter.class.st b/src/NewTools-Finder/StFinderPresenter.class.st index 5b13652e..3bbeca98 100644 --- a/src/NewTools-Finder/StFinderPresenter.class.st +++ b/src/NewTools-Finder/StFinderPresenter.class.st @@ -407,9 +407,14 @@ StFinderPresenter >> initializeResultTree [ beMultipleSelection; display: [ :result | result displayString ]; displayIcon: [ :result | result displayIcon ]; - bindKeyCombination: $b meta toAction: [ self resultTree selectedItem browseAction ]; - bindKeyCombination: $r meta toAction: [ self resultTree selectedItem referencesAction ]; - contextMenu: [ (self rootCommandsGroup / 'StFinderSelContextualMenu') beRoot asMenuPresenter ]. + addShortcutWith: [ :action | action + shortcutKey: $b actionModifier; + action: [ self resultTree selectedItem browseAction ] ]; + addShortcutWith: [ :action | action + shortcutKey: $r actionModifier; + action: [ self resultTree selectedItem referencesAction ] ]; + actions: self rootCommandsGroup / 'StFinderSelContextualMenu'; + yourself ] { #category : 'initialization' } diff --git a/src/NewTools-Inspector-Extensions/CompiledMethod.extension.st b/src/NewTools-Inspector-Extensions/CompiledMethod.extension.st index 46cc07d8..7fdcea73 100644 --- a/src/NewTools-Inspector-Extensions/CompiledMethod.extension.st +++ b/src/NewTools-Inspector-Extensions/CompiledMethod.extension.st @@ -23,13 +23,13 @@ CompiledMethod >> inspectionSource [ ^ SpCodePresenter new beForMethod: self method; text: self sourceCode; - contextMenu: (SpMenuPresenter new addGroup: [ :group | group - addItem: [ :item | item + actionsWith: [ :group | group + addActionWith: [ :action | action name: 'Browse method class'; - action: [ self methodClass browse ] ] ]); + action: [ self methodClass browse ] ] ]; whenSubmitDo: [ :text | self isInstalled ifFalse: [ self inform: 'can not edit methods that are not installed' ] - ifTrue: [ self methodClass compile: text ]]; + ifTrue: [ self methodClass compile: text ] ]; yourself ] diff --git a/src/NewTools-Inspector-Extensions/SubscriptionRegistry.extension.st b/src/NewTools-Inspector-Extensions/SubscriptionRegistry.extension.st index c34cfc8e..ed2eb1c3 100644 --- a/src/NewTools-Inspector-Extensions/SubscriptionRegistry.extension.st +++ b/src/NewTools-Inspector-Extensions/SubscriptionRegistry.extension.st @@ -17,13 +17,10 @@ SubscriptionRegistry >> inspectionSubscriptions [ addColumn: (SpStringTableColumn title: 'Kind' evaluated: [ :each | each className ]); - contextMenu: (SpMenuPresenter new - addItem: [ :item | - item - name: 'Remove selected subscription(s)'; - action: [ - table selectedItems do: [ :each | self remove: each ]. - table items: self subscriptions asOrderedCollection ] ]; - yourself); + addActionWith: [ :item | item + name: 'Remove selected subscription(s)'; + action: [ + table selectedItems do: [ :each | self remove: each ]. + table items: self subscriptions asOrderedCollection ] ]; yourself ] diff --git a/src/NewTools-Inspector/StEvaluateCommand.class.st b/src/NewTools-Inspector/StEvaluateCommand.class.st index 5fdb345a..c05ebbbe 100644 --- a/src/NewTools-Inspector/StEvaluateCommand.class.st +++ b/src/NewTools-Inspector/StEvaluateCommand.class.st @@ -31,9 +31,7 @@ StEvaluateCommand class >> defaultName [ { #category : 'default' } StEvaluateCommand class >> defaultShortcutKey [ - ^ $g command mac - | $g control win - | $g control unix + ^ $g actionModifier ] { #category : 'documentation' } diff --git a/src/NewTools-Inspector/StInspectionContext.class.st b/src/NewTools-Inspector/StInspectionContext.class.st index f7b6b58c..656f0c60 100644 --- a/src/NewTools-Inspector/StInspectionContext.class.st +++ b/src/NewTools-Inspector/StInspectionContext.class.st @@ -191,6 +191,8 @@ StInspectionContext >> newInspectionView [ StInspectionContext >> newPresenterBuilder [ ^ SpPresenterBuilder new + application: StPharoApplication current; + yourself ] { #category : 'accessing' } diff --git a/src/NewTools-Inspector/StMetaBrowserPresenter.class.st b/src/NewTools-Inspector/StMetaBrowserPresenter.class.st index 38e0d4c1..79349a63 100644 --- a/src/NewTools-Inspector/StMetaBrowserPresenter.class.st +++ b/src/NewTools-Inspector/StMetaBrowserPresenter.class.st @@ -45,9 +45,9 @@ StMetaBrowserPresenter class >> defaultLayout [ ] { #category : 'initialization' } -StMetaBrowserPresenter >> classListMenu [ +StMetaBrowserPresenter >> classListActions [ - ^ (self rootCommandsGroup / 'classes') asMenuPresenter + ^ self rootCommandsGroup / 'classes' ] { #category : 'private - actions' } @@ -100,11 +100,11 @@ StMetaBrowserPresenter >> initializePresenters [ children: [ :aClass | classHierarchy select: [ :subclass | subclass superclass == aClass ] ]; - contextMenu: [ self classListMenu ]; + actions: self classListActions; yourself. methods := (self instantiate: SpFilteringListPresenter) display: [ :each | each selector ]; - contextMenu: [ self methodListMenu ]; + actions: self methodListActions; yourself. source := self newCode @@ -120,9 +120,9 @@ StMetaBrowserPresenter >> initializePresenters [ ] { #category : 'initialization' } -StMetaBrowserPresenter >> methodListMenu [ +StMetaBrowserPresenter >> methodListActions [ - ^ (self rootCommandsGroup / 'methods') asMenuPresenter + ^ self rootCommandsGroup / 'methods' ] { #category : 'private' } diff --git a/src/NewTools-Inspector/StObjectContextPresenter.class.st b/src/NewTools-Inspector/StObjectContextPresenter.class.st index 4c03ebac..af5ec582 100644 --- a/src/NewTools-Inspector/StObjectContextPresenter.class.st +++ b/src/NewTools-Inspector/StObjectContextPresenter.class.st @@ -94,8 +94,7 @@ StObjectContextPresenter >> intializePresentersWithEvaluator [ beForObject: self model inspectedObject; text: self evaluatorInitialText; overridingContextMenu; - contextMenu: [ (self menuActionsFor: evaluator) asMenuPresenter ]; - contextKeyBindings: (self menuActionsFor: evaluator) asKMCategory; + actions: (self menuActionsFor: evaluator); whenTextChangedDo: [ :aString | self model codeSnippet: aString ]. self layout: (SpPanedLayout newTopToBottom diff --git a/src/NewTools-Inspector/StRawInspectionPresenter.class.st b/src/NewTools-Inspector/StRawInspectionPresenter.class.st index c6965a78..548f5adf 100644 --- a/src/NewTools-Inspector/StRawInspectionPresenter.class.st +++ b/src/NewTools-Inspector/StRawInspectionPresenter.class.st @@ -83,7 +83,7 @@ StRawInspectionPresenter >> initializePresenters [ attributeTable := self newTreeTable beResizable; - contextMenu: [ self rootCommandsGroup asMenuPresenter ]; + actions: self rootCommandsGroup; yourself. self addVariablesColumn. self addValuesColumn. diff --git a/src/NewTools-MethodBrowsers-Calypso/StClyMessageListPresenter.class.st b/src/NewTools-MethodBrowsers-Calypso/StClyMessageListPresenter.class.st index 9509074a..22b971fe 100644 --- a/src/NewTools-MethodBrowsers-Calypso/StClyMessageListPresenter.class.st +++ b/src/NewTools-MethodBrowsers-Calypso/StClyMessageListPresenter.class.st @@ -1,6 +1,6 @@ Class { #name : 'StClyMessageListPresenter', - #superclass : 'StMessageListPresenter', + #superclass : 'StComposedMessageListPresenter', #instVars : [ 'scopes', 'query', @@ -51,7 +51,7 @@ StClyMessageListPresenter >> extraScopesOfSelectedItems [ self packageScopeOfSelectedItems. classScope asFullHierarchyScope. classScope - }, RefactoringSettings availableScopes + }, ScopesManager availableScopes ] { #category : 'accessing' } diff --git a/src/NewTools-MethodBrowsers-Calypso/StClyQueryBrowser.class.st b/src/NewTools-MethodBrowsers-Calypso/StClyQueryBrowser.class.st index 0e25f847..de7d10b1 100644 --- a/src/NewTools-MethodBrowsers-Calypso/StClyQueryBrowser.class.st +++ b/src/NewTools-MethodBrowsers-Calypso/StClyQueryBrowser.class.st @@ -24,7 +24,7 @@ For example selected method will bring extra class and package scopes of this me " Class { #name : 'StClyQueryBrowser', - #superclass : 'StMessageBrowser', + #superclass : 'StComposedMessageBrowser', #instVars : [ 'navigationHistory', 'navigationEnvironment', diff --git a/src/NewTools-MethodBrowsers/StComposedMessageBrowser.class.st b/src/NewTools-MethodBrowsers/StComposedMessageBrowser.class.st new file mode 100644 index 00000000..a32ab0da --- /dev/null +++ b/src/NewTools-MethodBrowsers/StComposedMessageBrowser.class.st @@ -0,0 +1,13 @@ +Class { + #name : 'StComposedMessageBrowser', + #superclass : 'StMessageBrowser', + #category : 'NewTools-MethodBrowsers-Senders', + #package : 'NewTools-MethodBrowsers', + #tag : 'Senders' +} + +{ #category : 'initialization' } +StComposedMessageBrowser >> newMessageList [ + + ^ self instantiate: StComposedMessageListPresenter +] diff --git a/src/NewTools-MethodBrowsers/StComposedMessageElementPresenter.class.st b/src/NewTools-MethodBrowsers/StComposedMessageElementPresenter.class.st new file mode 100644 index 00000000..61fe641d --- /dev/null +++ b/src/NewTools-MethodBrowsers/StComposedMessageElementPresenter.class.st @@ -0,0 +1,55 @@ +Class { + #name : 'StComposedMessageElementPresenter', + #superclass : 'SpPresenter', + #traits : 'SpTModel', + #classTraits : 'SpTModel classTrait', + #instVars : [ + 'locationLabel', + 'selectorLabel', + 'packageLabel', + 'messageList' + ], + #category : 'NewTools-MethodBrowsers-Senders', + #package : 'NewTools-MethodBrowsers', + #tag : 'Senders' +} + +{ #category : 'nil' } +StComposedMessageElementPresenter >> defaultLayout [ + + ^ SpBoxLayout newTopToBottom + add: (SpBoxLayout newLeftToRight + add: locationLabel; + add: packageLabel expand: false; + yourself); + add: selectorLabel; + yourself +] + +{ #category : 'initialization' } +StComposedMessageElementPresenter >> initializePresenters [ + + locationLabel := self newLabel + addStyle: 'dim'; + yourself. + selectorLabel := self newLabel. + packageLabel := self newLabel + addStyle: 'dim'; + yourself +] + +{ #category : 'accessing' } +StComposedMessageElementPresenter >> messageList: aPresenter [ + + messageList := aPresenter +] + +{ #category : 'initialization' } +StComposedMessageElementPresenter >> updatePresenter [ + + self model ifNil: [ ^ self ]. + + selectorLabel label: (messageList selectorOf: self model) trimmed. + packageLabel label: (messageList packageOf: self model) trimmed. + locationLabel label: (messageList locationOf: self model) trimmed +] diff --git a/src/NewTools-MethodBrowsers/StComposedMessageListPresenter.class.st b/src/NewTools-MethodBrowsers/StComposedMessageListPresenter.class.st new file mode 100644 index 00000000..9590c58c --- /dev/null +++ b/src/NewTools-MethodBrowsers/StComposedMessageListPresenter.class.st @@ -0,0 +1,23 @@ +Class { + #name : 'StComposedMessageListPresenter', + #superclass : 'StMessageListPresenter', + #category : 'NewTools-MethodBrowsers-Senders', + #package : 'NewTools-MethodBrowsers', + #tag : 'Senders' +} + +{ #category : 'initialization' } +StComposedMessageListPresenter >> initializePresenters [ + + listPresenter := self newListView. + listPresenter + "sortingBlock: [ :a :b | self sortClassesInCachedHierarchy: a b: b ];" + setup: [ :aPresenter | + (aPresenter instantiate: StComposedMessageElementPresenter) + messageList: self; + yourself ]; + bind: [ :aPresenter :anElement | aPresenter model: anElement ]. + + listPresenter outputActivationPort transmitDo: [ :aMethod | self doBrowseMethod ]. + listPresenter actions: self messageListActions +] diff --git a/src/NewTools-MethodBrowsers/StMessageBrowser.class.st b/src/NewTools-MethodBrowsers/StMessageBrowser.class.st index d1be9ae9..e46216d5 100644 --- a/src/NewTools-MethodBrowsers/StMessageBrowser.class.st +++ b/src/NewTools-MethodBrowsers/StMessageBrowser.class.st @@ -20,6 +20,9 @@ Class { #classVars : [ 'UsingLayout' ], + #classInstVars : [ + 'preferredExtent' + ], #category : 'NewTools-MethodBrowsers-Senders', #package : 'NewTools-MethodBrowsers', #tag : 'Senders' @@ -98,6 +101,12 @@ StMessageBrowser class >> browseSendersOf: aSymbol [ ^ self browse: aSymbol senders asSendersOf: aSymbol ] +{ #category : 'accessing' } +StMessageBrowser class >> defaultPreferredExtent [ + + ^ 900@600 +] + { #category : 'instance creation - old' } StMessageBrowser class >> openMessageList: messageList name: aString autoSelect: aSelector refreshingBlockSelector: aRefreshingBlockSelector [ @@ -115,6 +124,18 @@ StMessageBrowser class >> openMessageList: messageList name: aString autoSelect: ] +{ #category : 'accessing' } +StMessageBrowser class >> preferredExtent [ + + ^ preferredExtent ifNil: [ preferredExtent := self defaultPreferredExtent ] +] + +{ #category : 'accessing' } +StMessageBrowser class >> preferredExtent: aPoint [ + + preferredExtent := aPoint +] + { #category : 'tool registration' } StMessageBrowser class >> registerToolsOn: registry [ @@ -377,7 +398,9 @@ StMessageBrowser >> initializeWindow: aWindowPresenter [ super initializeWindow: aWindowPresenter. aWindowPresenter title: self title; - windowIcon: (self iconNamed: self class taskbarIconName) + initialExtent: self class preferredExtent; + windowIcon: (self iconNamed: self class taskbarIconName); + whenResizingDo: [ :ann | self class preferredExtent: ann newSize ] ] { #category : 'private' } diff --git a/src/NewTools-MethodBrowsers/StMessageListPresenter.class.st b/src/NewTools-MethodBrowsers/StMessageListPresenter.class.st index 8054b144..d85c1255 100644 --- a/src/NewTools-MethodBrowsers/StMessageListPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StMessageListPresenter.class.st @@ -232,10 +232,7 @@ StMessageListPresenter >> initializePresenters [ beResizable. listPresenter outputActivationPort transmitDo: [ :aMethod | self doBrowseMethod ]. - - listPresenter - contextMenu: self messageListActions asMenuPresenter; - contextKeyBindings: self messageListActions asKMCategory + listPresenter actions: self messageListActions ] { #category : 'accessing' } diff --git a/src/NewTools-MethodBrowsers/StMethodToolbarPresenter.class.st b/src/NewTools-MethodBrowsers/StMethodToolbarPresenter.class.st index 5b350fb3..32eaf561 100644 --- a/src/NewTools-MethodBrowsers/StMethodToolbarPresenter.class.st +++ b/src/NewTools-MethodBrowsers/StMethodToolbarPresenter.class.st @@ -45,10 +45,11 @@ StMethodToolbarPresenter class >> title [ { #category : 'accessing' } StMethodToolbarPresenter >> addItemLabeled: aString do: aBlock [ + | item | - dropList - addItemLabeled: aString - do: aBlock + item := SpDropListItem on: aString do: aBlock. + item display: [ :itemLabel | itemLabel ]. + dropList items: (dropList items copyWith: item) ] { #category : 'layout' } @@ -141,6 +142,9 @@ StMethodToolbarPresenter >> initializePresenters [ yourself. dropList := self newDropList + display: [ :item | item label ]; + whenSelectedItemChangedDo: [ :item | item value ]; + yourself ] { #category : 'accessing' } diff --git a/src/NewTools-Playground/StPlaygroundBindingsPresenter.class.st b/src/NewTools-Playground/StPlaygroundBindingsPresenter.class.st index 3a050382..bf49af69 100644 --- a/src/NewTools-Playground/StPlaygroundBindingsPresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundBindingsPresenter.class.st @@ -48,12 +48,6 @@ StPlaygroundBindingsPresenter >> bindings [ ^ parent interactionModel bindings ] -{ #category : 'private' } -StPlaygroundBindingsPresenter >> contextMenu [ - - ^ self contextMenuActions asMenuPresenter -] - { #category : 'private' } StPlaygroundBindingsPresenter >> contextMenuActions [ @@ -68,12 +62,6 @@ StPlaygroundBindingsPresenter >> contextMenuActions [ yourself ] -{ #category : 'private' } -StPlaygroundBindingsPresenter >> contextMenuKeyBindings [ - - ^ self contextMenuActions asKMCategory -] - { #category : 'layout' } StPlaygroundBindingsPresenter >> defaultLayout [ @@ -143,8 +131,7 @@ StPlaygroundBindingsPresenter >> initializeListPanel [ evaluated: [ :each | self scopeNameFor: each ]; beSortable; yourself); - contextMenu: [ self contextMenu ]; - contextKeyBindings: self contextMenuKeyBindings; + actions: self contextMenuActions; yourself. bindingPanel presenter: bindingList diff --git a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st index 21c94fea..0aeef401 100644 --- a/src/NewTools-Playground/StPlaygroundPagePresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPagePresenter.class.st @@ -213,8 +213,7 @@ StPlaygroundPagePresenter >> initializePresenters [ lineNumbers: self showLineNumbers; overridingContextMenu; withEditionContextMenu; - contextMenu: [ (self menuActionsFor: text) asMenuPresenter ]; - contextKeyBindings: (self menuActionsFor: text) asKMCategory; + actions: (self menuActionsFor: text); whenTextChangedDo: [ :aString | self updateContents: aString ]. text announcer diff --git a/src/NewTools-Playground/StPlaygroundPageVersionsPresenter.class.st b/src/NewTools-Playground/StPlaygroundPageVersionsPresenter.class.st index e4eda7b0..14f5423e 100644 --- a/src/NewTools-Playground/StPlaygroundPageVersionsPresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPageVersionsPresenter.class.st @@ -83,7 +83,8 @@ StPlaygroundPageVersionsPresenter >> initializePresenters [ versionList display: [ :anEntry | self displayValueFor: (anEntry tagAt: #timestamp) ]; - contextMenu: [ self versionsActions asMenuPresenter ]. + actions: self versionsActions. + sourceCode beForScripting; beNotEditable. diff --git a/src/NewTools-Playground/StPlaygroundPagesPresenter.class.st b/src/NewTools-Playground/StPlaygroundPagesPresenter.class.st index 5f7f982b..553df498 100644 --- a/src/NewTools-Playground/StPlaygroundPagesPresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPagesPresenter.class.st @@ -98,9 +98,11 @@ StPlaygroundPagesPresenter >> initializePresenters [ label: 'Pages'; presenter: (pageList := self newComponentList presenters: self pagesAsPresenters; - contextMenu: [ self pagesActions asMenuPresenter ]; + actions: self pagesActions; whenActivatedDo: [ self loadSelectedPage ]; - bindKeyCombination: Character cr asKeyCombination toAction: [ self loadSelectedPage ]; + addShortcutWith: [ :action | action + shortcutKey: Character cr asKeyCombination; + action: [ self loadSelectedPage ] ]; yourself). (pagePreviewPanel := self instantiate: StHeaderPanel) @@ -165,8 +167,7 @@ StPlaygroundPagesPresenter >> pages [ { #category : 'private' } StPlaygroundPagesPresenter >> pagesActions [ - ^ CmCommandGroup forSpec - beRoot; + ^ SpActionGroup new register: (StPlaygroundLoadPageCommand forSpecContext: self); register: (StPlaygroundLoadPageOnNewPlaygroundCommand forSpecContext: self); yourself diff --git a/src/NewTools-Playground/StPlaygroundPresenter.class.st b/src/NewTools-Playground/StPlaygroundPresenter.class.st index c8993e29..8093d2e7 100644 --- a/src/NewTools-Playground/StPlaygroundPresenter.class.st +++ b/src/NewTools-Playground/StPlaygroundPresenter.class.st @@ -175,7 +175,7 @@ StPlaygroundPresenter >> newDefaultPlaygroundPage [ { #category : 'private - factory' } StPlaygroundPresenter >> newInspectorFor: aModel [ - | isPlayground inspector | + | isPlayground inspector | isPlayground := millerList pages isEmpty and: [ aModel isNil ]. diff --git a/src/NewTools-Scopes-Editor/ScopeNodesPresenter.class.st b/src/NewTools-Scopes-Editor/ScopeNodesPresenter.class.st index 9c024f02..f37c8617 100644 --- a/src/NewTools-Scopes-Editor/ScopeNodesPresenter.class.st +++ b/src/NewTools-Scopes-Editor/ScopeNodesPresenter.class.st @@ -110,40 +110,37 @@ ScopeNodesPresenter >> announceScopeEdited [ ] { #category : 'private - presenters' } -ScopeNodesPresenter >> argumentsListMenu [ - - ^ self newMenu addGroup: [ :aGroup | - aGroup - addItem: [ :anItem | - anItem - name: 'Check all Cmd-a'; - iconName: #accept; - action: [ self checkAll ] ]; - addItem: [ :anItem | - anItem - name: 'Unheck all Cmd-u'; - iconName: #accept; - action: [ self uncheckAll ] ]; - - addItem: [ :anItem | - anItem - name: 'Add class hierarchy (flattened)'; - visibleIf: [ scopeNodesTree selectedItem isClassNode ]; - iconName: #hierarchy; - action: [ self addSelectedItemClassHierarchy ] ]; - addItem: [ :anItem | - anItem - name: 'Browse'; - visibleIf: [ scopeNodesTree selectedItem isNotNil ]; - iconName: #browse; - action: [ self browseSelectedItem ] ]; - addItem: [ :anItem | - anItem - name: 'Class references'; - visibleIf: [ scopeNodesTree selectedItem isClassNode ]; - iconName: #browse; - action: [ - self showReferencesToClass: scopeNodesTree selectedItem value ] ] ] +ScopeNodesPresenter >> argumentsListActions [ + + ^ SpActionGroup new + addActionWith: [ :anItem | anItem + name: 'Check all Cmd-a'; + iconName: #glamorousAccept; + action: [ self checkAll ] ]; + addActionWith: [ :anItem | anItem + name: 'Unheck all'; + shortcutKey: $u actionModifier; + iconName: #glamorousAccept; + action: [ self uncheckAll ] ]; + addActionWith: [ :anItem | anItem + name: 'Add class hierarchy (flattened)'; + actionEnabled: [ scopeNodesTree selectedItem isClassNode ]; + iconName: #hierarchy; + action: [ self addSelectedItemClassHierarchy ] ]; + addActionWith: [ :anItem | anItem + name: 'Browse'; + actionEnabled: [ scopeNodesTree selectedItem isNotNil ]; + iconName: #glamorousBrowse; + action: [ self browseSelectedItem ] ]; + addActionWith: [ :anItem | anItem + name: 'Class references'; + actionEnabled: [ scopeNodesTree selectedItem isClassNode ]; + iconName: #glamorousBrowse; + action: [ self showReferencesToClass: scopeNodesTree selectedItem value ] ]; + addShortcutWith: [ :action | action + shortcutKey: $a actionModifier; + action: [ self checkAll ] ]; + yourself ] { #category : 'private - presenters' } @@ -285,13 +282,7 @@ ScopeNodesPresenter >> initializeScopeNodesTree [ beResizable; activateOnDoubleClick; whenActivatedDo: [ :selection | scopeNodesTree toggleSelectedItems ]; - contextMenu: self argumentsListMenu. - - scopeNodesTree bindKeyCombination: $a command toAction: [ - self checkAll ]. - - scopeNodesTree bindKeyCombination: $u command toAction: [ - self uncheckAll]. + actions: self argumentsListActions. ^ scopeNodesTree ] diff --git a/src/NewTools-Scopes-Editor/ScopesPresenter.class.st b/src/NewTools-Scopes-Editor/ScopesPresenter.class.st index 267b6a8d..08680fdf 100644 --- a/src/NewTools-Scopes-Editor/ScopesPresenter.class.st +++ b/src/NewTools-Scopes-Editor/ScopesPresenter.class.st @@ -87,6 +87,52 @@ ScopesPresenter >> andWithScope: anItem [ self performOperation: #& with: anItem ] +{ #category : 'menu commands' } +ScopesPresenter >> argumentsListActions [ + + ^ SpActionGroup new + addActionWith: [ :anItem | anItem + name: 'Delete'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + iconName: #glamorousTrash; + action: [ self deleteSelectedScope ] ]; + addActionWith: [ :anItem | anItem + name: 'Edit'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + iconName: #glamorousEdit; + action: [ self editSelectedScope ] ]; + addActionWith: [ :anItem | anItem + name: 'Rename'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + action: [ self renameSelectedScope ] ]; + addActionWith: [ :anItem | anItem + name: 'Inspect'; + iconName: #glamorousSearch; + action: [ scopesTree selectedItem inspect ] ]; + addActionWith: [ :anItem | anItem + name: 'Open in browser'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + action: [ self openOnCalypso: scopesTree selectedItem value ] ]; + addActionWith: [ :anItem | anItem + name: 'Browse'; + actionEnabled: [ scopesTree selectedItem isScopeNode not ]; + iconName: #glamorousBrowse; + action: [ self browseSelectedItem ] ]; + addActionWith: [ :anItem | anItem + name: 'Class references'; + actionEnabled: [ scopesTree selectedItem isClassNode ]; + action: [ self showReferencesToClass: scopesTree selectedItem value ] ]; + addActionWith: [ :anItem | anItem + name: 'OR'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + action: [ self orWithScope: scopesTree selectedItem ] ]; + addActionWith: [ :anItem | anItem + name: 'AND'; + actionEnabled: [ scopesTree selectedItem isScopeNode ]; + action: [ self andWithScope: scopesTree selectedItem ] ]; + yourself +] + { #category : 'menu commands' } ScopesPresenter >> argumentsListMenu [ diff --git a/src/NewTools-Sindarin-Commands/SpCodePresenter.extension.st b/src/NewTools-Sindarin-Commands/SpCodePresenter.extension.st index c68d2e99..9bbb8ebb 100644 --- a/src/NewTools-Sindarin-Commands/SpCodePresenter.extension.st +++ b/src/NewTools-Sindarin-Commands/SpCodePresenter.extension.st @@ -3,8 +3,10 @@ Extension { #name : 'SpCodePresenter' } { #category : '*NewTools-Sindarin-Commands' } SpCodePresenter >> nonEmptySelectionInterval [ | selectionInterval | + selectionInterval := self selectionInterval. selectionInterval isEmpty - ifTrue: [ ^self selectLine ]. + ifTrue: [ ^ self selectLine ]. + ^ selectionInterval ] diff --git a/src/NewTools-Spotter-Processors/StSendersProcessor.class.st b/src/NewTools-Spotter-Processors/StSendersProcessor.class.st index ce2ec7e5..077c8c41 100644 --- a/src/NewTools-Spotter-Processors/StSendersProcessor.class.st +++ b/src/NewTools-Spotter-Processors/StSendersProcessor.class.st @@ -50,11 +50,11 @@ StSendersProcessor >> executeQuery [ { #category : 'key-bindings' } StSendersProcessor >> installKeymappingsOn: aPresenter onExecution: aBlock [ - aPresenter - bindKeyCombination: self keyBinding - toAction: [ + aPresenter addShortcutWith: [ :action | action + shortcutKey: self keyBinding; + action: [ self query toggleFilter: self sendersTag. - aBlock cull: self ] + aBlock cull: self ] ] ] { #category : 'spotter-api' } diff --git a/src/NewTools-Spotter-Processors/StUnifiedProcessor.class.st b/src/NewTools-Spotter-Processors/StUnifiedProcessor.class.st index 9586dcd0..33bbf384 100644 --- a/src/NewTools-Spotter-Processors/StUnifiedProcessor.class.st +++ b/src/NewTools-Spotter-Processors/StUnifiedProcessor.class.st @@ -173,22 +173,21 @@ StUnifiedProcessor >> implementorsTag [ StUnifiedProcessor >> installKeymappingsOn: aPresenter onExecution: aBlock [ aPresenter - bindKeyCombination: $b meta - toAction: [ - self query toggleFilter: self classesTag. - aBlock cull: self ]. - - aPresenter - bindKeyCombination: $m meta - toAction: [ - self query toggleFilter: self implementorsTag. - aBlock cull: self ]. - - aPresenter - bindKeyCombination: $p meta - toAction: [ - self query toggleFilter: self packagesTag. - aBlock cull: self ] + addShortcutWith: [ :action | action + shortcutKey: $b actionModifier; + action: [ + self query toggleFilter: self classesTag. + aBlock cull: self ] ]; + addShortcutWith: [ :action | action + shortcutKey: $m actionModifier; + action: [ + self query toggleFilter: self implementorsTag. + aBlock cull: self ] ]; + addShortcutWith: [ :action | action + shortcutKey: $p actionModifier; + action: [ + self query toggleFilter: self packagesTag. + aBlock cull: self ] ] ] { #category : 'spotter-api' } diff --git a/src/NewTools-Spotter/StSpotter.class.st b/src/NewTools-Spotter/StSpotter.class.st index 40608be4..902254f3 100644 --- a/src/NewTools-Spotter/StSpotter.class.st +++ b/src/NewTools-Spotter/StSpotter.class.st @@ -518,18 +518,18 @@ StSpotter >> initializePresenters [ resultList addStyle: 'stSpotterList'; - bindKeyCombination: Character arrowUp asKeyCombination - toAction: [ :target :widget :event | - self transferFocusToSearchTextArrowUp. - event wasHandled: false ]; - bindKeyCombination: Character arrowDown asKeyCombination - toAction: [ :target :widget :event | - self transferFocusToSearchTextArrowDown. - event wasHandled: false ]; - bindKeyCombination: Character arrowRight asKeyCombination - toAction: [ self tryDiveIn ]; - bindKeyCombination: Character arrowLeft asKeyCombination - toAction: [ self tryDiveOut ]; + addShortcutWith: [ :action | action + shortcutKey: Character arrowUp asKeyCombination; + action: [ self transferFocusToSearchTextArrowUp ] ]; + addShortcutWith: [ :action | action + shortcutKey: Character arrowDown asKeyCombination; + action: [ self transferFocusToSearchTextArrowDown ] ]; + addShortcutWith: [ :action | action + shortcutKey: Character arrowRight asKeyCombination; + action: [ self tryDiveIn ] ]; + addShortcutWith: [ :action | action + shortcutKey: Character arrowLeft asKeyCombination; + action: [ self tryDiveOut ] ]; whenActivatedDo: [ :selection | self activate: selection selectedItem ]. resultList eventHandler @@ -539,12 +539,15 @@ StSpotter >> initializePresenters [ placeholder: 'Search...'; addStyle: 'stSpotterSearch'; whenTextChangedDo: [ :aString | self updateSearch: aString ]; - bindKeyCombination: Character arrowDown asKeyCombination - toAction: [ self transferFocusToResultList ]; - bindKeyCombination: Character arrowUp asKeyCombination - toAction: [ self transferFocusToResultListAtLast ]; - bindKeyCombination: Character cr asKeyCombination - toAction: [ self maybeActivateFirstElementOfResultList ] + addShortcutWith: [ :action | action + shortcutKey: Character arrowDown asKeyCombination; + action: [ self transferFocusToResultList ] ]; + addShortcutWith: [ :action | action + shortcutKey: Character arrowUp asKeyCombination; + action: [ self transferFocusToResultListAtLast ] ]; + addShortcutWith: [ :action | action + shortcutKey: Character cr asKeyCombination; + action: [ self maybeActivateFirstElementOfResultList ] ] ] { #category : 'initialization' } @@ -834,18 +837,26 @@ StSpotter >> transferFocusToResultListAtLast [ { #category : 'private' } StSpotter >> transferFocusToSearchTextArrowDown [ + | index | + + resultList items ifEmpty: [ ^ self ]. - (resultList items notEmpty - and: [ resultList selection selectedIndex = resultList items size ]) + index := resultList selection selectedIndex. + index = resultList items size ifTrue: [ searchText takeKeyboardFocus ] + ifFalse: [ resultList selectIndex: index + 1 scrollToSelection: true ] ] { #category : 'private' } StSpotter >> transferFocusToSearchTextArrowUp [ + | index | + + resultList items ifEmpty: [ ^ self ]. - (resultList items notEmpty - and: [ resultList selection selectedIndex = 1 ]) + index := resultList selection selectedIndex. + index = 1 ifTrue: [ searchText takeKeyboardFocus ] + ifFalse: [ resultList selectIndex: index - 1 scrollToSelection: true ] ] { #category : 'private - actions' }