Orphan Projects

Tony Garnock-Jones tonyg at lshift.net
Mon Mar 7 16:17:43 UTC 2005


Hi list,

In 3.7, closing the "Worlds of Squeak" window left a number of orphan 
projects around. I only noticed them once I had been working on a few of 
my own things for a while, so to clean them up I had to be a bit careful:

[
  | visibleProjects orphans |
	
  "First collect all the windows containing a ProjectViewMorph - these 
are my projects, that I want to keep. Note that I don't have any 
projects with subprojects in turn."

  visibleProjects _ World submorphs
   select: [:p |
	p isSystemWindow and:
	[(p paneMorphs select: [:m | m isKindOf: ProjectViewMorph]) isEmpty not]]
   thenCollect: [:w | (w paneMorphs detect: [:m | m isKindOf: 
ProjectViewMorph]) project].

  "Now find all projects neither visible nor current, that are direct 
children of this project."

  orphans _ (Project allSubInstances difference: visibleProjects)
   reject: [:p | p == Project current or: [p parent ~~ Project current]].
	
  "Build toplevel windows for such orphans. Closing these windows 
correctly and cleanly removes the projects."

  orphans do: [:p | (ProjectViewMorph newProjectViewInAWindowFor: p) 
openInWorld].
]

Tony
-- 
  [][][] Tony Garnock-Jones  | Mob: +44 (0)7905 974 211
    [][] LShift Ltd          | Tel: +44 (0)20 7729 7060
  []  [] www.lshift.net      | Email: tonyg at lshift.net



More information about the Squeak-dev mailing list