ProjectDefinition.st
changeset 12251 1ebf269379c7
parent 12218 a3662ecd1438
child 12262 24861bbf25fc
--- a/ProjectDefinition.st	Tue Oct 13 10:47:14 2009 +0200
+++ b/ProjectDefinition.st	Tue Oct 13 10:47:33 2009 +0200
@@ -1367,16 +1367,15 @@
 postLoadAction
     "invoked after loading a project"
 
-    "/ intentionally left blank
-
-    "Created: / 08-08-2006 / 11:07:40 / fm"
+    "/ intentionally left blank, to be redefined by subclasses (i.e. real projects)
+
     "Modified: / 17-08-2006 / 19:59:17 / cg"
 !
 
 preLoadAction
     "invoked before loading a project"
 
-    "/ intentionally left blank
+    "/ intentionally left blank, to be redefined by subclasses (i.e. real projects)
 !
 
 preRequisites
@@ -1407,9 +1406,8 @@
 preUnloadAction
     "invoked before unloading a project"
 
-    "/ intentionally left blank
-
-    "Created: / 08-08-2006 / 11:07:40 / fm"
+    "/ intentionally left blank, to be redefined by subclasses (i.e. real projects)
+
     "Modified: / 17-08-2006 / 19:59:26 / cg"
 !
 
@@ -2843,6 +2841,36 @@
     "Modified: / 21-11-2006 / 15:07:09 / cg"
     "Modified: / 30-10-2008 / 08:16:21 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 22-08-2009 / 12:02:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+unloadPackage
+    "unload the project.
+     Fails if there are still instances of any of my classes in the system"
+
+    self projectIsLoaded ifFalse:[^ false].
+    thisContext isRecursive ifTrue:[^ false].
+
+    (self infoPrinting and:[Smalltalk silentLoading not]) ifTrue:[
+        "/ thisContext fullPrintAll.
+        Transcript show:'unloading '; showCR:self name.
+    ].
+
+    self activityNotification:'Executing pre-unload action'.
+    self preUnloadAction.
+
+    self activityNotification:'Restoring original methods'.
+    self restoreOverwrittenExtensionMethods.
+
+    Class withoutUpdatingChangesDo:[
+        self activityNotification:'Unloading sunprojects'.
+        self unloadSubProjects.
+
+        self activityNotification:'Unloading classes'.
+        self unloadClassLibrary.
+        self unloadAllClasses.
+    ].
+    self projectIsLoaded:false.
+    ^ true
 ! !
 
 !ProjectDefinition class methodsFor:'mappings'!
@@ -4623,11 +4651,11 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.245 2009-10-12 18:11:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.246 2009-10-13 08:47:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.245 2009-10-12 18:11:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.246 2009-10-13 08:47:33 cg Exp $'
 ! !
 
 ProjectDefinition initialize!