FileOut/Recreate Workspaces?

Tim Olson tim at jumpnet.com
Mon Feb 9 19:26:05 UTC 1998


>I've taken to leaving bits of code, selected pieces of output, and other
>odds-and-ends in workspaces all over my Squeak desktop.  (Come to think of
>it, it really does look just as messy as my real desktop!  Now, if only I
>could spill coffee and lose pens on it...:-)
>
>Now I want to move to 1.31 from my various 1.23 and 1.30 images.  Is there
>anyway to capture/fileOut/recreate my workspaces for use in 1.31, other
>than copy/paste the contents of each one?

The following *seems* to work, although the intricacies of 
programmatically adding new entries to ScheduledControllers is still a 
bit hazy to me.  This code will restore the workspace's string contents 
(it loses any text attributes).

To save/restore all your Workspaces in a particular project, open up a 
new Workspace and enter the following:

----
fs _ FileStream newFileNamed: (Text fromUser string).
fs nextPutAll: '| shView topView |'; cr.
(Project current world scheduledControllers select: [:c | c model 
isKindOf: Workspace]) do:
	[:c |
	fs nextPutAll:
		'shView _ StringHolderView container: (StringHolder new contents:' ,
		c view subViews first displayContents asString printString , ').'; cr.
	fs nextPutAll:
		'topView _ StandardSystemView new.' ,
		'topView model: shView model.' ,
		'topView addSubView: shView.' ,
		'topView label: ' , c view label printString , '.' ,
		'topView resizeInitially.' , 
		'topView controller status: #open.' ,
		'ScheduledControllers scheduleOnBottom: topView controller.'.
	fs cr].
fs nextPutAll:
	'ScheduledControllers noteNewTop.',
	'ScheduledControllers screenController restoreDisplay.'.
fs close.
----

When you execute this, you will be asked for a filename, which will be 
where your Workspaces are written.  To read them into a new image, open 
up the file, select all of it and execute it.

Modifications/Corrections to this are welcome...



     -- tim





More information about the Squeak-dev mailing list