On 7 January 2013 14:15, Frank Church <vfclists@gmail.com> wrote:
On 7 January 2013 13:01, Sean P. DeNigris <sean@clipperadams.com> wrote:
Frank Church wrote
I want to create a collection of Workspace contents...What kind of array would best suited to the task?
I usually just start with an OrderedCollection until I feel the need for something more complicated. It's like an Array, but will grow dynamically.
Two things to check out that already exist in the system: * you can save workspace contents to a file by clicking the little arrow in the top right of the workspace window and select "Save As..." * check out ScriptManager, which is a GUI for organizing and saving workspaces. It was included in Pharo by default in 1.3 (I think) and has a repo on sqs... search the list to see how/if it can be loaded into later Pharos.
I tried ScriptManager but it appears to save the files in a binary format. It wouldn't open in a text editor .
I am interested in something which persists in Smalltalk, so I can just browse them without saving to disk, 'The Smalltalk Way'. Saving to disk is an option though.
Is there a way of selecting a workspace and extracting the text it contains. Something like a small script to enumerate all open Workspaces and printing out their text contents in a Transcript?
I saw your blog article about using Smalltalk to view the contents of your mailbox and the other about parsing a feeds contents and I want to try something similar as a start.
My thoughts are along these lines.
1. Define a class consisting of workspace and a method which returns their text content. 2. Define collection 3. List workspaces and add to collection. I am not sure if this will replicate the workspaces perhaps they should be 'pointers' to the workspaces 4. inspect/explore the results like you did in your blog.
Thanks
HTH,
Sean
After further investigation this is what I found. When I shift click a Workspace window the item selected is usually a PluggableTextMorph or a TextMorphForEditView. When it is a PluggableTextMorph it owns a TextMorphforEditView which was not picked by the click. Inspecting or exploring the hierarchy shows that is owned by a SystemWindow of a Model Workspace further up the hierachy. What code do I need to first list all TextMorphforEditView(s) in the system and lookup the ownership hierarchy to determine whether the model of the SystemWindow is a Workspace or a Transcript?
--
Frank Church
======================= http://devblog.brahmancreations.com
-- Frank Church ======================= http://devblog.brahmancreations.com