Hi Marcel,<br>
<br>
> Adds new preference to file-out workspace contents on accept. Thanks to Jaromir for the idea! Preference is enabled by default since there was noe default accept-action in workspaces yet.<br>
<br>
We have already so many preferences in the image. Could we merge #fileOutOnAccept and #fileOutFilePath and say, only do a file-out if a path was specified? :-)<br>
<br>
Best,<br>
Christoph<br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font><br>
<br>
On 2021-05-18T11:58:28+00:00, commits@source.squeak.org wrote:<br>
<br>
> Marcel Taeumel uploaded a new version of Tools to project The Trunk:<br>
> http://source.squeak.org/trunk/Tools-mt.1056.mcz<br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: Tools-mt.1056<br>
> Author: mt<br>
> Time: 18 May 2021, 1:58:25.950287 pm<br>
> UUID: f32e4e04-6f83-d641-ba5a-0de0c535aa73<br>
> Ancestors: Tools-mt.1055<br>
> <br>
> Tweak #embedTranscript to only apply when opening a regular workspace via class-side #open. Note that the workspace model is re-used for other purposes such as string edit. See UIManager.<br>
> <br>
> Adds new preference to file-out workspace contents on accept. Thanks to Jaromir for the idea! Preference is enabled by default since there was noe default accept-action in workspaces yet.<br>
> <br>
> =============== Diff against Tools-mt.1055 ===============<br>
> <br>
> Item was changed:<br>
>   StringHolder subclass: #Workspace<br>
>       instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle environment'<br>
> +     classVariableNames: 'DeclareVariablesAutomatically EmbedTranscript FileOutFilePath FileOutOnAccept LookupPools ShouldStyle'<br>
> -     classVariableNames: 'DeclareVariablesAutomatically EmbedTranscript LookupPools ShouldStyle'<br>
>       poolDictionaries: ''<br>
>       category: 'Tools-Base'!<br>
>   <br>
>   !Workspace commentStamp: 'fbs 6/2/2012 20:46' prior: 0!<br>
>   A Workspace is a text area plus a lot of support for executable code.  It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.<br>
>   <br>
>   To open a new workspace, execute:<br>
>   <br>
>       Workspace open<br>
>   <br>
>   <br>
>   A workspace can have its own variables, called "workspace variables", to hold intermediate results.  For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.<br>
>   <br>
>   Additionally, in Morphic, a workspace can gain access to morphs that are on the screen.  If acceptDroppedMorphs is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph.  This functionality is toggled with the window-wide menu of a workspace.<br>
>   <br>
>   <br>
>   The instance variables of this class are:<br>
>   <br>
>       bindings  -  holds the workspace variables for this workspace<br>
>   <br>
>       acceptDroppedMorphs - whether dropped morphs should create new variables!<br>
> <br>
> Item was changed:<br>
>   ----- Method: Workspace class>>embedTranscript (in category 'preferences') -----<br>
>   embedTranscript<br>
>       <preference: 'Embed a Transcript in Workspace' <br>
> +         categoryList: #('browsing' 'tools')<br>
> -         category: 'browsing' <br>
>           description: 'If true, new workspaces will open with an embedded Transcript.' <br>
>           type: #Boolean><br>
>       ^ EmbedTranscript ifNil: [ false ]!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>fileOut: (in category 'support') -----<br>
> + fileOut: contents<br>
> +     "Write the given contents into the workspace file-out file path."<br>
> + <br>
> +     | filePath |<br>
> +     filePath := self fileOutFilePath.<br>
> +     (FileDirectory default on: filePath) containingDirectory assureExistence.<br>
> +     FileStream<br>
> +         fileNamed: filePath<br>
> +         do: [:stream |<br>
> +             stream<br>
> +                 setToEnd;<br>
> +                 nextPutAll: '"----ACCEPT----';<br>
> +                 nextPutAll: DateAndTime now asString;<br>
> +                 nextPutAll: '"';<br>
> +                 cr; nextPutAll: contents; cr].<br>
> +     Transcript showln: 'Workspace contents successfully appended to: ', filePath printString.!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>fileOutFilePath (in category 'preferences') -----<br>
> + fileOutFilePath<br>
> +     <preference: 'File-out file path for workspace' <br>
> +         categoryList: #('browsing' 'tools')<br>
> +         description: 'Set the file-out location for #fileOutOnAccept in workspaces.' <br>
> +         type: #String><br>
> +     ^ FileOutFilePath ifNil: [ 'workspace.st' ]!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>fileOutFilePath: (in category 'preferences') -----<br>
> + fileOutFilePath: aString<br>
> + <br>
> +     FileOutFilePath := aString.!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>fileOutOnAccept (in category 'preferences') -----<br>
> + fileOutOnAccept<br>
> +     <preference: 'File-out workspace contents on accept' <br>
> +         categoryList: #('browsing' 'tools')<br>
> +         description: 'If true, accepting contents in a workspace will append them to a known location in the file system. See #fileOutFilePath.' <br>
> +         type: #Boolean><br>
> +     ^ FileOutOnAccept ifNil: [ true ]!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>fileOutOnAccept: (in category 'preferences') -----<br>
> + fileOutOnAccept: aBoolean<br>
> + <br>
> +     FileOutOnAccept := aBoolean.!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace class>>open (in category 'instance creation') -----<br>
> + open<br>
> + <br>
> +     | workspace |<br>
> +     workspace := self new.<br>
> +     self fileOutOnAccept ifTrue: [<br>
> +         workspace acceptAction: [:string | self fileOut: string]].<br>
> +     ^ self embedTranscript<br>
> +         ifTrue: [workspace buildAndOpenWorkspaceTranscript]<br>
> +         ifFalse: [workspace buildAndOpen]!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace>>buildAndOpen (in category 'toolbuilder') -----<br>
> + buildAndOpen<br>
> + <br>
> +     ToolBuilder default open: self.<br>
> +     ^ self!<br>
> <br>
> Item was added:<br>
> + ----- Method: Workspace>>buildAndOpenWorkspaceTranscript (in category 'toolbuilder') -----<br>
> + buildAndOpenWorkspaceTranscript<br>
> + <br>
> +     | windowSpec builder |<br>
> +     builder := ToolBuilder default.<br>
> +     windowSpec := self buildWindowWith: builder specs: {<br>
> +         (0.0 @ 0.0 corner: 1.0 @ 0.6) -> [self buildCodePaneWith: builder].<br>
> +         (0.0 @ 0.6 corner: 1.0 @ 1.0) -> [self buildTranscriptWith: builder].<br>
> +     }.<br>
> +     builder open: windowSpec.<br>
> +     ^ self!<br>
> <br>
> Item was removed:<br>
> - ----- Method: Workspace>>buildWith: (in category 'toolbuilder') -----<br>
> - buildWith: builder<br>
> - <br>
> -     ^ self class embedTranscript<br>
> -         ifTrue: [self buildWorkspaceTranscriptWith: builder]<br>
> -         ifFalse: [super buildWith: builder]!<br>
> <br>
> Item was removed:<br>
> - ----- Method: Workspace>>buildWorkspaceTranscriptWith: (in category 'toolbuilder') -----<br>
> - buildWorkspaceTranscriptWith: builder<br>
> - <br>
> -     | windowSpec |<br>
> -     windowSpec := self buildWindowWith: builder specs: {<br>
> -         (0.0 @ 0.0 corner: 1.0 @ 0.6) -> [self buildCodePaneWith: builder].<br>
> -         (0.0 @ 0.6 corner: 1.0 @ 1.0) -> [self buildTranscriptWith: builder].<br>
> -     }.<br>
> -     ^builder build: windowSpec!<br>
> <br>