Squeak Class Documentation category index | class index  
 
Utilities
  category: System-Support
  superclass: Object
  subclasses:

A repository for general and miscellaneous utilities; much of what is here are in effect global methods that don't naturally attach to anything else. 1/96 sw

instance methods
  look in class
  seeClassSide

class methods
  common requests
  appendToCommonRequests:
closeAllDebuggers
commonRequestStrings:
editCommonRequestStrings
eval:
evaluate:in:to:
initialize
initializeCommonRequestStrings
offerCommonRequests
offerCommonRequestsInMorphic

  debugging
  doesNotUnderstand:
inspectCollection:notifying:

  durable menus
  windowFromMenu:target:title:
windowFromMenu:target:title:colorPattern:
windowMenuWithLabels:colorPattern:targets:selections:title:
windowMenuWithLabels:colorPattern:targets:selections:wordingSelectors:title:

  fetching updates
  applyUpdatesFromDisk
applyUpdatesFromDiskToUpdateNumber:stopIfGap:
broadcastUpdatesFrom:to:except:
chooseUpdateList
extractThisVersion:
getUpdateDirectoryOrNil
lastUpdateNum:
newUpdatesOn:special:throughNumber:
objectStrmFromUpdates:
parseListContents:
position:atVersion:
readNextUpdateFromServer
readNextUpdatesFromDisk:
readServer:special:updatesThrough:saveLocally:updateImage:
readServerUpdatesSaveLocally:updateImage:
readServerUpdatesThrough:saveLocally:updateImage:
retrieveUrls:ontoQueue:withWaitSema:
saveUpdate:onFile:
serverUrls
setUpdateServer:
updateComment
updateFromServer
updateFromServerThroughUpdateNumber:
updateUrlLists
writeList:toStream:
zapUpdateDownloader

  fileout
  fileOutChangeSetsNamed:
fileOutChanges

  flaps
  globalFlapTabOrDummy:

  graphical support
  grabScreenAndSaveOnDisk
showFormsAcrossTopOfScreen:
showFormsDictAcrossTopOfScreen:

  identification
  authorInitials
authorInitialsPerSe
authorName
authorName:
authorNamePerSe
changeStamp
changeStampPerSe
copyrightNotice
dateStamp
dateTimeSuffix
fixStamp:
monthDayTime24StringFrom:
monthDayTimeStringFrom:
setAuthorInitials
setAuthorInitials:
setAuthorName

  investigations
  inspectGlobals
reportSenderCountsFor:

  miscellaneous
  addSampleWindowsTo:
awaitMouseUpIn:repeating:ifSucceed:
awaitMouseUpIn:whileMouseDownDo:whileMouseDownInsideDo:ifSucceed:
cleanseOtherworldlySteppers
convertCRtoLF:
createPageTestWorkspace
decommissionTheAllCategory
doesMethod:forClass:bearInitials:
emergencyCollapse
getterSelectorFor:
inherentSelectorForGetter:
instanceComparisonsBetween:and:
isObject:memberOfOneOf:
keyLike:satisfying:
keyLike:withTrailing:satisfying:
lookUpDefinition
methodDiffFor:class:selector:prettyDiffs:
nextClockwiseSideAfter:
openScratchWorkspaceLabeled:contents:
oppositeCornerFrom:
oppositeModeTo:
oppositeSideTo:
reconstructTextWindowsFromFileNamed:
setClassAndSelectorFrom:in:
setterSelectorFor:
simpleSetterFor:
steplistToolsWorkspace
storeTextWindowContentsToFileNamed:
timeStampForMethod:

  recent method submissions
  browseRecentSubmissions
dumpAnyOldStyleRecentSubmissions
mostRecentlySubmittedMessage
noteMethodSubmission:forClass:
numberOfRecentSubmissionsToStore
openRecentSubmissionsBrowser
purgeRecentSubmissionsOfMissingMethods
recentMethodSubmissions
recentSubmissionsWindow
revertLastMethodSubmission

  scraps
  addToTrash:
emptyScrapsBook
maybeEmptyTrash
scrapsBook
scrapsBook:
trashTitle

  summer97 additions
  actualTextStyles
browseVersionsForClass:selector:
chooseFileWithSuffix:
chooseFileWithSuffixFromList:withCaption:
classCategoriesStartingWith:
classFromPattern:withCaption:
fontSizesFor:
graphicsFileSuffixes
hierarchyOfClassesSurrounding:
hierarchyOfImplementorsOf:forClass:
inviolateInstanceVariableNames
isLegalInstVarName:
knownTextStyles
methodHierarchyBrowserForClass:selector:
removeMorphicClassesFromChanges
removeUserClassesFromChanges
spawnHierarchyForClass:selector:
wellFormedInstanceVariableNameFrom:

  support windows
  commandKeyMappings
openCommandKeyHelp
openStandardWorkspace
standardWorkspaceContents

  tailoring system
  stripMethods:messageCode:

  text styles and fonts
  fontArrayForStyle:
fontMenuForStyle:target:selector:
fontPointSizesFor:
fontSizeSummary
fontWidthsFor:
mvcPromptForFont:andSendTo:withSelector:
pointSizesFor:
promptForFont:andSendTo:withSelector:

  user interface
  informUser:during:
informUserDuring:

  vm statistics
  vmStatisticsReportString
vmStatisticsShortString

instance methods
  look in class top  
 

seeClassSide

All the code for Utilitites is on the class side


class methods
  common requests top  
 

appendToCommonRequests:


 

closeAllDebuggers

Utilities closeAllDebuggers


 

commonRequestStrings:

Initialize the common request strings from aString.


 

editCommonRequestStrings

Let the user edit the common request strings. 2/1/96 sw


 

eval:

Evaluate the string in a neutral context, and under certain circumstances print the result in the transcript


 

evaluate:in:to:

evaluate aString in the given context, and return the result. 2/2/96 sw


 

initialize

Initialize the class variables. 5/16/96 sw


 

initializeCommonRequestStrings

Initialize an array of common request strings. 2/1/96 sw


 

offerCommonRequests

Offer up the common-requests menu. If the user chooses one, then evaluate it, and -- provided the value is a number or string -- show it in the Transcript.


 

offerCommonRequestsInMorphic

Offer up the common-requests menu. If the user chooses one, then evaluate it, and -- provided the value is a number or string -- show it in the Transcript.


  debugging top  
 

doesNotUnderstand:

A temporary expedient for revectoring various messages formerly sent to Utilities that now are instead implemented by Flaps; this is only for the benefit of pre-existing buttons and menu items that were set up to call the old interface


 

inspectCollection:notifying:


  durable menus top  
 

windowFromMenu:target:title:

Supply a default list of colors


 

windowFromMenu:target:title:colorPattern:


 

windowMenuWithLabels:colorPattern:targets:selections:title:


 

windowMenuWithLabels:colorPattern:targets:selections:wordingSelectors:title:


  fetching updates top  
 

applyUpdatesFromDisk

Utilities applyUpdatesFromDisk


 

applyUpdatesFromDiskToUpdateNumber:stopIfGap:

To use this mechanism, be sure all updates you want to have considered
are in a folder named 'updates' which resides in the same directory as
your image. Having done that, simply evaluate:

Utilities applyUpdatesFromDiskToUpdateNumber: 1234 stopIfGap: false

and all numbered updates <= lastUpdateNumber not yet in the image will
be loaded in numerical order.


 

broadcastUpdatesFrom:to:except:


Note: This method takes its list of files from the directory named 'updates',
which will have been created and filled by, eg,
Utilities readServerUpdatesSaveLocally: true updateImage: true.
These can then be rebroadcast to any server using, eg,
Utilities broadcastUpdatesFrom: 1 to: 9999 except: #(223 224).
If the files are already on the server, and it is only a matter
of copying them to the index for a different version, then use...
(ServerDirectory serverInGroupNamed: 'SqC Internal Updates*')
exportUpdatesExcept: #().


 

chooseUpdateList

When there is more than one set of update servers, let the user choose which we will update from. Put it at the front of the list. Return false if the user aborted. If the preference #promptForUpdateServer is false, then suppress that prompt, in effect using the same server choice that was used the previous time (a convenience for those of us who always answer the same thing to the prompt.)


 

extractThisVersion:

Pull out the part of the list that applies to this version.


 

getUpdateDirectoryOrNil


 

lastUpdateNum:

Look in the Updates file and see what the last sequence number is. Warn the user if the version it is under is not this image's version.


 

newUpdatesOn:special:throughNumber:

Return a list of fully formed URLs of update files we do not yet have. Go to the listed servers and look at the file 'updates.list' for the names of the last N update files. We look backwards for the first one we have, and make the list from there. tk 9/10/97
No updates numbered higher than aNumber (if it is not nil) are returned


 

objectStrmFromUpdates:

Go to the known servers and look for this file in the updates folder. It is an auxillery file, like .morph or a .gif. Return a RWBinaryOrTextStream on it. Meant to be called from during the getting of updates from the server. That assures that (Utilities serverUrls) returns the right group of servers.


 

parseListContents:

Parse the contents of updates.list into {{vers. {fileNames*}}*}, and return it.


 

position:atVersion:

Set the stream to the end of the last line of updates names for this version. Usually the end of the file. We will add a new update name. Return the contents of the rest of the file.


 

readNextUpdateFromServer

Utilities readNextUpdateFromServer


 

readNextUpdatesFromDisk:

Read the updates up through the current highest-update-number plus n. Thus,
Utilities readNextUpdatesFromDisk: 7
will read the next seven updates from disk


 

readServer:special:updatesThrough:saveLocally:updateImage:

Scan the update server(s) for unassimilated updates. If maxNumber is not nil, it represents the highest-numbered update to load. This makes it possible to update only up to a particular point. If saveLocally is true, then save local copies of the update files on disc. If updateImage is true, then absorb the updates into the current image.


 

readServerUpdatesSaveLocally:updateImage:


 

readServerUpdatesThrough:saveLocally:updateImage:

Scan the update server(s) for unassimilated updates. If maxNumber is not nil, it represents the highest-numbered update to load. This makes it possible to update only up to a particular point. If saveLocally is true, then save local copies of the update files on disc. If updateImage is true, then absorb the updates into the current image.

A file on the server called updates.list has the names of the last N update files. We look backwards for the first one we do not have, and start there


 

retrieveUrls:ontoQueue:withWaitSema:

download the given list of URLs. The queue will be loaded alternately
with url's and with the retrieved contents. If a download fails, the
contents will be #failed. If all goes well, a special pair with an empty
URL and the contents #finished will be put on the queue. waitSema is
waited on every time before a new document is downloaded; this keeps
the downloader from getting too far ahead of the main process


 

saveUpdate:onFile:

Save the update on a local file. With or without the update number on the front, depending on the preference #updateRemoveSequenceNum


 

serverUrls

Return the current list of server URLs. For code updates. Format of UpdateUrlLists is
#( ('squeak updates' ('url1' 'url2'))
('some other updates' ('url3' 'url4')))


 

setUpdateServer:

Utilities setUpdateServer: 'Squeakland'


 

updateComment

The following used to be at the beginning of the update file.
Now it is here to simplify parsing the file...

* To add a new update: Name it starting with a new four-digit code.
* Do not use %, /, *, space, or more than one period in the name of an update file.
* The update name does not need to have any relation to the version name.
* Figure out which versions of the system the update makes sense for.
* Add the name of the file to each version's category below.
* Put this file and the update file on all of the servers.
*
* To make a new version of the system: Pick a name for it (no restrictions)
* Put # and exactly that name on a new line at the end of this file.
* During the release process, fill in exactly that name in the dialog box.
* Put a copy of updates.list on the server.
*
* Special file with a different name for Disney Internal Updates.
* No need to move or rename files to release them to external updates.


 

updateFromServer

Update the image by loading all pending updates from the server. Also save local copies of the update files if the #updateSavesFile preference is set to true


 

updateFromServerThroughUpdateNumber:

Update the image by loading all pending updates from the server. Also save local copies of the update files if the #updateSavesFile preference is set to true


 

updateUrlLists


 

writeList:toStream:

Write a parsed updates.list out as text.
This is the inverse of parseListContents:


 

zapUpdateDownloader


  fileout top  
 

fileOutChangeSetsNamed:

File out the list of change sets whose names are provided


 

fileOutChanges

File out the current change set to a file whose name is a function of the current date and time.


  flaps top  
 

globalFlapTabOrDummy:

Find a global flap tab by name. May be either 'flap: Tools' or 'Tools'. Retained in Utilities for possible benefit of existing image segments


  graphical support top  
 

grabScreenAndSaveOnDisk

Utilities grabScreenAndSaveOnDisk


 

showFormsAcrossTopOfScreen:

Display the given array of forms across the top of the screen, wrapping to subsequent lines if needed. Useful for example for looking at sets of rotations and animations. 6/10/96 sw


 

showFormsDictAcrossTopOfScreen:

Display the given Dictionary of forms across the top of the screen, wrapping to subsequent lines if needed. Beneath each, put the name of the associated key.


  identification top  
 

authorInitials

Answer the initials to be used to identify the current code author.


 

authorInitialsPerSe

Answer the currently-prevailing author initials, such as they, empty or not


 

authorName


 

authorName:


 

authorNamePerSe


 

changeStamp

Answer a string to be pasted into source code to mark who changed it and when.


 

changeStampPerSe

Answer a string to be pasted into source code to mark who changed it and when.


 

copyrightNotice


 

dateStamp

Utilities dateStamp


 

dateTimeSuffix

Answer a string which indicates the date and time, intended for use in building fileout filenames, etc.


 

fixStamp:


 

monthDayTime24StringFrom:

From the date/time represented by aSecondCount, produce a string which indicates the date and time in the compact form
ddMMMhhmm where dd is a two-digit day-of-month, MMM is the alpha month abbreviation and hhmm is the time on a 24-hr clock.

Utilities monthDayTime24StringFrom: Time primSecondsClock


 

monthDayTimeStringFrom:

From the date/time represented by aSecondCount, produce a string which indicates the date and time in the form:
ddMMMhhmmPP where:
dd is a two-digit day-of-month,
MMM is the alpha month abbreviation,
hhmm is the time,
PP is either am or pm

Utilities monthDayTimeStringFrom: Time primSecondsClock


 

setAuthorInitials

Put up a dialog allowing the user to specify the author's initials.


 

setAuthorInitials:


 

setAuthorName


  investigations top  
 

inspectGlobals

Utilities inspectGlobals


 

reportSenderCountsFor:

Produce a report on the number of senders of each of the selectors in the list. 1/27/96 sw


  miscellaneous top  
 

addSampleWindowsTo:

Add windows representing a browser, a workspace, etc., to aPage


 

awaitMouseUpIn:repeating:ifSucceed:

The mouse has gone down in box; track the mouse, inverting the box while it's within, and if, on mouse up, the cursor was still within the box, execute succBlock. While waiting for the mouse to come up, repeatedly execute doBlock. 5/11/96 sw
6/10/96 sw: call new method that adds extra feature


 

awaitMouseUpIn:whileMouseDownDo:whileMouseDownInsideDo:ifSucceed:

The mouse has gone down in box; track the mouse, inverting the box while it's within, and if, on mouse up, the cursor was still within the box, execute succBlock. While waiting for the mouse to come up, repeatedly execute doBlock1, and also, if the cursor is within the box, execute doBlock2. 6/10/96 sw
3/31/00 JMM added logic to stop multiple redraws


 

cleanseOtherworldlySteppers

If the current project is a morphic one, then remove from its steplist those morphs that are not really in the world


 

convertCRtoLF:

Convert the given file to LF line endings. Put the result in a file with the extention '.lf'


 

createPageTestWorkspace

Used to generate a workspace window for testing page up and page down stuff.


 

decommissionTheAllCategory

Utilities decommissionTheAllCategory


 

doesMethod:forClass:bearInitials:

Answer whether a method bears the given initials at the head of its time stamp


 

emergencyCollapse


 

getterSelectorFor:

Answer the corresponding getter. Two idiosyncratic vectorings herein...


 

inherentSelectorForGetter:

Given a selector of the form #getAbc, return the inherent slotname selector that corresponds, which is to say, getterSelector with the leading 'get' removed and with the next character forced to lower case; this is the inverse of #getterSelectorFor:


 

instanceComparisonsBetween:and:

For differential results, run printSpaceAnalysis twice with different fileNames,
then run this method...
Smalltalk printSpaceAnalysis: 0 on: 'STspace.text1'.
--- do something that uses space here ---
Smalltalk printSpaceAnalysis: 0 on: 'STspace.text2'.
Smalltalk instanceComparisonsBetween: 'STspace.text1' and 'STspace.text2'


 

isObject:memberOfOneOf:


 

keyLike:satisfying:

Return a key like aString that satisfies aBlock. The block should provide a test for acceptability -- typically the test is about whether the key is already in use. aBlock should return a boolean. 8/11/96 sw


 

keyLike:withTrailing:satisfying:

Return a key like (aString, trailerString) that satisfies aBlock. The block should provide a test for acceptability -- typically the test is about whether the key is already in use. aBlock should return a boolean. 8/11/96 sw


 

lookUpDefinition


 

methodDiffFor:class:selector:prettyDiffs:

Return a string comprising a source-code diff between an existing method and the source-code in aString. DO prettyDiff if prettyDiffBoolean is true.


 

nextClockwiseSideAfter:


 

openScratchWorkspaceLabeled:contents:

Open a scratch text view with the given label on the given string. A scratch text view won't warn you about unsaved changes when you close it.


 

oppositeCornerFrom:

Answer the corner diagonally opposite to aCorner. 6/27/96 sw


 

oppositeModeTo:


 

oppositeSideTo:


 

reconstructTextWindowsFromFileNamed:

Utilities reconstructTextWindowsFromFileNamed: 'TextWindows'


 

setClassAndSelectorFrom:in:

Decode strings of the form <className> [class] <selectorName>. If <className> does not exist as a class, use nil for the class in the block


 

setterSelectorFor:

Utilities setterSelectorFor: #elvis


 

simpleSetterFor:

Utilities simpleSetterFor: #right


 

steplistToolsWorkspace


 

storeTextWindowContentsToFileNamed:

Utilities storeTextWindowContentsToFileNamed: 'TextWindows'


 

timeStampForMethod:

Answer the authoring time-stamp for the given method, retrieved from the sources or changes file. Answer the empty string if no time stamp is available.


  recent method submissions top  
 

browseRecentSubmissions

Open up a browser on the most recent methods submitted in the image. 5/96 sw.


 

dumpAnyOldStyleRecentSubmissions

simplify conversion by purging those recent submissions which are still Strings


 

mostRecentlySubmittedMessage


 

noteMethodSubmission:forClass:


 

numberOfRecentSubmissionsToStore

Answer how many methods back the 'recent method submissions' history should store


 

openRecentSubmissionsBrowser

Open up a browser on the most recent methods submitted in the image; reuse any existing one found in the world.


 

purgeRecentSubmissionsOfMissingMethods

Utilities purgeRecentSubmissionsOfMissingMethods


 

recentMethodSubmissions

Answer the list of recent method submissions, in order. 5/16/96 sw


 

recentSubmissionsWindow

Answer a SystemWindow holding recent submissions


 

revertLastMethodSubmission

If the most recent method submission was a method change, revert
that change, and if it was a submission of a brand-new method,
remove that method.


  scraps top  
 

addToTrash:

Paste the object onto a page of the system Trash book, unless the preference is set to empty the trash immediately.


 

emptyScrapsBook

Utilities emptyScrapsBook


 

maybeEmptyTrash


 

scrapsBook


 

scrapsBook:

Utilities scrapsBook: nil


 

trashTitle


  summer97 additions top  
 

actualTextStyles

Utilities actualTextStyles


 

browseVersionsForClass:selector:


 

chooseFileWithSuffix:

Utilities chooseFileWithSuffix: '.gif'


 

chooseFileWithSuffixFromList:withCaption:

Pop up a list of all files in the default directory which have a suffix in the list. Return #none if there are none; return nil if the user backs out of the menu without making a choice.


 

classCategoriesStartingWith:

Answer a list of system class categories beginning with the given prefix


 

classFromPattern:withCaption:

If there is a class whose name exactly given by pattern, return it.
If there is only one class in the system whose name matches pattern, return it.
Otherwise, put up a menu offering the names of all classes that match pattern, and return the class chosen, else nil if nothing chosen.
This method ignores tab, space, & cr characters in the pattern


 

fontSizesFor:


 

graphicsFileSuffixes

Answer a list of filename suffixes which signal file content which we are able to internalize


 

hierarchyOfClassesSurrounding:

Answer a list of classes in the hierarchy both above and below the given class


 

hierarchyOfImplementorsOf:forClass:

Answer a list of classes in the hierarchy both above and below the given class which implement the given selector.


 

inviolateInstanceVariableNames

Answer a list of instance variable names not to be used. (Place holder for real list)


 

isLegalInstVarName:

Answer whether aString is a legal instance variable name.


 

knownTextStyles

Utilities knownTextStyles


 

methodHierarchyBrowserForClass:selector:

Create and schedule a message set browser on all implementors of the
currently selected message selector. Do nothing if no message is selected.


 

removeMorphicClassesFromChanges


 

removeUserClassesFromChanges

Remove from the current ChangeSet all user-spawned classes, which are recognized by the fact their names end in digits


 

spawnHierarchyForClass:selector:

Create and schedule a new class hierarchy browser on the requested class/selector.


 

wellFormedInstanceVariableNameFrom:

Answer a legal instance variable name, derived from aString


  support windows top  
 

commandKeyMappings


 

openCommandKeyHelp

Open a window giving command key help.


 

openStandardWorkspace

Open up a throwaway workspace with useful expressions in it. 1/22/96 sw


 

standardWorkspaceContents


  tailoring system top  
 

stripMethods:messageCode:

Used to 'cap' methods that need to be protected for proprietary reasons, etc.; call this with a list of triplets of symbols of the form (<class name> <#instance or #class> <selector name>), and with a string to be produced as part of the error msg if any of the methods affected is reached


  text styles and fonts top  
 

fontArrayForStyle:


 

fontMenuForStyle:target:selector:


 

fontPointSizesFor:


 

fontSizeSummary

Utilities fontSizeSummary


 

fontWidthsFor:


 

mvcPromptForFont:andSendTo:withSelector:

Utilities mvcPromptForFont: 'Choose system font style' andSendTo: Utilities withSelector: #setSystemFontTo:


 

pointSizesFor:


 

promptForFont:andSendTo:withSelector:

Utilities promptForFont: 'Choose system font:' andSendTo: Utilities withSelector: #setSystemFontTo:


  user interface top  
 

informUser:during:

Display a message above (or below if insufficient room) the cursor during execution of the given block.


 

informUserDuring:

Display a message above (or below if insufficient room) the cursor during execution of the given block.


  vm statistics top  
 

vmStatisticsReportString

StringHolderView open: (StringHolder new contents:
Utilities vmStatisticsReportString) label: 'VM Statistics'


 

vmStatisticsShortString

Convenience item for access to recent statistics only