From 4da36b8b304abded54863012b28c54a89eaa0b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Papagna=20Maldonado?= Date: Thu, 3 Mar 2022 10:38:54 -0300 Subject: [PATCH] Displays the context status for watch expressions This commit displays the watch expression's context status in the watch expression editor. The status can be `Executing` if the context is still running (e.g. it is present in the call stack) or terminated (e.g. the method has returned). --- CHANGELOG.md | 1 + Tools-AdvancedDebugger.pck.st | 82 +++++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89fb059..3565871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ project does not follow [Semantic Versioning](https://semver.org/spec/v2.0.0.htm * Context menu item and shortcut (shift + double-click) for editing watches. * Support for evaluating expressions in the debugger's context. It is available via the temporary variable's inspector context menu > `Evaluate expression...`. * Support for live evaluating expressions from a selection in the debugger. +* Context status (either Executing or Terminated) to the watch expression editor. ## Changed * Uses the new `AdvancedDebuggerWindow` instead of the built-in `DebuggerWindow` for opening the debugger. diff --git a/Tools-AdvancedDebugger.pck.st b/Tools-AdvancedDebugger.pck.st index fc311a2..ee29653 100644 --- a/Tools-AdvancedDebugger.pck.st +++ b/Tools-AdvancedDebugger.pck.st @@ -1,6 +1,6 @@ -'From Cuis 5.0 [latest update: #4913] on 1 March 2022 at 1:31:36 pm'! +'From Cuis 5.0 [latest update: #4913] on 3 March 2022 at 10:35:11 am'! 'Description '! -!provides: 'Tools-AdvancedDebugger' 1 22! +!provides: 'Tools-AdvancedDebugger' 1 23! SystemOrganization addCategory: #'Tools-AdvancedDebugger'! SystemOrganization addCategory: #'Tools-AdvancedDebugger-UI'! SystemOrganization addCategory: 'Tools-AdvancedDebugger-UI-Core'! @@ -98,7 +98,7 @@ WatchExpressionEditorWindow class !classDefinition: #WatchExpressionEditorMorph category: #'Tools-AdvancedDebugger-UI'! WidgetMorph subclass: #WatchExpressionEditorMorph - instanceVariableNames: 'watchExpressionEditor layoutMorph resultLabel acceptAction cancelAction nameInput showNameAndActionButtons' + instanceVariableNames: 'watchExpressionEditor layoutMorph resultLabel acceptAction cancelAction nameInput showNameAndActionButtons contextStatusLabel' classVariableNames: '' poolDictionaries: '' category: 'Tools-AdvancedDebugger-UI'! @@ -938,6 +938,16 @@ buildCancelButton action: #cancelContents label: 'Cancel'! ! +!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 3/3/2022 10:15:54'! +buildContextStatusLabel + + contextStatusLabel _ LabelMorph contents: ''. + + layoutMorph + addMorphKeepMorphHeight: (self buildHeader: 'Context status'); + addMorph: contextStatusLabel fixedHeight: self defaultButtonPaneHeight + ! ! + !WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/22/2022 02:30:57'! buildExpressionInput @@ -994,16 +1004,19 @@ buildResultPanel ! ! -!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/22/2022 02:47:46'! +!WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 3/3/2022 10:34:40'! buildSubmorphs self buildLayout; buildNameInput; + buildContextStatusLabel; buildExpressionInput; buildResultPanel; buildActionButtons. - watchExpressionEditor whenExpressionIsAcceptedSend: #accept to: self. ! ! + + watchExpressionEditor + whenExpressionIsAcceptedSend: #accept to: self. ! ! !WatchExpressionEditorMorph methodsFor: 'GUI building' stamp: 'NPM 2/17/2022 01:52:36'! defaultButtonPaneHeight @@ -1042,18 +1055,13 @@ layoutSubmorphs layoutMorph morphPosition: 0@0 extent: self morphExtent! ! -!WatchExpressionEditorMorph methodsFor: 'stepping' stamp: 'NPM 2/22/2022 02:01:49'! +!WatchExpressionEditorMorph methodsFor: 'stepping' stamp: 'NPM 3/3/2022 10:25:37'! stepAt: millisecondSinceLast - | result | - result _ [ - [ watchExpressionEditor actualWatchExpression value displayStringOrText ] - valueWithin: 500 milliSeconds - onTimeout: [ 'evaluation timed out' ] ] - on: Error - do: [ 'evaluation failed' ]. - - resultLabel contents: result + self + updateContextStatus; + updateResult + ! ! @@ -1067,6 +1075,29 @@ wantsSteps ^ true! ! +!WatchExpressionEditorMorph methodsFor: 'updating' stamp: 'NPM 3/3/2022 10:25:11'! +updateContextStatus + + | contextStatus | + contextStatus _ watchExpressionEditor actualWatchExpression isContextExecuting + ifTrue: [ 'Executing' ] ifFalse: [ 'Terminated' ]. + + contextStatusLabel contents: contextStatus. + ! ! + +!WatchExpressionEditorMorph methodsFor: 'updating' stamp: 'NPM 3/3/2022 10:25:45'! +updateResult + + | result | + result _ [ + [ watchExpressionEditor actualWatchExpression value displayStringOrText ] + valueWithin: 500 milliSeconds + onTimeout: [ 'evaluation timed out' ] ] + on: Error + do: [ 'evaluation failed' ]. + + resultLabel contents: result! ! + !WatchExpressionEditorMorph class methodsFor: 'instance creation' stamp: 'NPM 2/22/2022 02:38:33'! model: aWatchExpressionEditor showNameAndActionButtons: aBoolean @@ -2101,6 +2132,14 @@ kind ^ 'Watch expression'! ! +!WatchExpression methodsFor: 'copying' stamp: 'NPM 2/16/2022 00:52:39'! +copy + + ^ self class + named: name + toEvaluate: expression + in: context! ! + !WatchExpression methodsFor: 'editing' stamp: 'NPM 1/7/2022 17:41:25'! changeExpressionTo: anExpression @@ -2194,6 +2233,11 @@ initializeNamed: aName toEvaluate: anExpressionBlock in: aContext self changeExpressionTo: anExpressionBlock ! ! +!WatchExpression methodsFor: 'testing' stamp: 'NPM 3/3/2022 10:25:11'! +isContextExecuting + + ^ context isDead not! ! + !WatchExpression methodsFor: 'testing' stamp: 'NPM 1/7/2022 17:51:18'! renameTo: newName @@ -2205,14 +2249,6 @@ renameTo: newName ! ! -!WatchExpression methodsFor: 'as yet unclassified' stamp: 'NPM 2/16/2022 00:52:39'! -copy - - ^ self class - named: name - toEvaluate: expression - in: context! ! - !WatchExpression class methodsFor: 'instance creation' stamp: 'NPM 1/5/2022 17:59:51'! named: aName toEvaluate: anExpressionBlock in: aContext