checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 02 Sep 1999 23:14:43 +0200
changeset 4668 a4e061d91251
parent 4667 2b51bafd8243
child 4669 828addb1c376
checkin from browser
Project.st
--- a/Project.st	Thu Sep 02 18:46:11 1999 +0200
+++ b/Project.st	Thu Sep 02 23:14:43 1999 +0200
@@ -20,6 +20,13 @@
 	category:'System-Support'
 !
 
+Object subclass:#MethodInfo
+	instanceVariableNames:'methodName className fileName'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:Project
+!
+
 Object subclass:#ClassInfo
 	instanceVariableNames:'conditionForInclusion className classFileName'
 	classVariableNames:''
@@ -90,6 +97,83 @@
      once the ProjectBrowser is finished, this info is read from
      '.prj' files ..."
 
+    "/ collect project info while scanning all classes
+    "/ and methods ...
+
+    |packages|
+
+    packages := IdentitySet new.
+
+    AllProjects isNil ifTrue:[
+        AllProjects := OrderedCollection new.
+    ] ifFalse:[
+        AllProjects do:[:p | packages add:p packageName asSymbol].
+    ].
+    Smalltalk allClassesDo:[:aClass |
+        |packageID prj classFilename pkgInfo revInfo 
+         repositoryPath dir module lib|
+
+        aClass isMeta ifFalse:[
+            (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[
+                packageID := aClass package asSymbol.
+                (packages includes:packageID) ifFalse:[
+                    packages add:packageID.
+
+                    "/ a new one ...
+
+                    prj := self new.
+                    prj packageName:packageID.
+                    prj directory:'???'.
+                    prj repositoryModule:'unknown'.
+                    prj repositoryDirectory:'unknown'.
+
+                    pkgInfo := aClass packageSourceCodeInfo.
+                    pkgInfo notNil ifTrue:[
+                        dir := pkgInfo at:#directory ifAbsent:nil.
+                        dir notNil ifTrue:[
+                            prj directory:dir    
+                        ].
+                        module := pkgInfo at:#directory ifAbsent:nil.
+                        module notNil ifTrue:[
+                            prj repositoryModule:module    
+                        ].
+                        lib := pkgInfo at:#library ifAbsent:nil.
+                        lib notNil ifTrue:[
+                            prj type:#library.
+                        ].
+                        prj name:module.    
+                    ].
+                    AllProjects add:prj.
+                ].
+            ].
+        ].
+    ].
+    Method allSubInstancesDo:[:aMethod |
+        |packageID prj who mthdClass|
+
+        packageID := aMethod package asSymbol.
+        who := aMethod who.
+        who notNil ifTrue:[ "/ skip unbound methods ...
+            mthdClass := who methodClass.
+            mthdClass package ~= packageID ifTrue:[
+                (packages includes:packageID) ifFalse:[
+                    packages add:packageID.
+
+                    "/ a new one ...
+                    prj := self new.
+        "/            prj name:libName.
+                    prj package:packageID.
+                    prj type:#library.
+                    prj directory:'???'.
+                    prj repositoryModule:'stx'.
+                    prj repositoryDirectory:'???'.
+                    AllProjects add:prj.
+                ].
+            ]
+        ]
+    ].
+    self changed:#allProjects
+
 "/    |stx p|
 "/
 "/    stx := self new name:'stx'.
@@ -133,6 +217,7 @@
 "/    ].
 
     "
+     AllProjects := nil.
      self initKnownProjects
     "
 
@@ -490,6 +575,16 @@
     "Modified: 27.1.1997 / 12:09:14 / cg"
 !
 
+package
+    "return the projects package identifier.
+     This identifier marks all methods and new classes which were created
+     in this project."
+
+    ^ packageName
+
+    "Modified: 27.1.1997 / 12:10:00 / cg"
+!
+
 packageName
     "return the projects package identifier.
      This identifier marks all methods and new classes which were created
@@ -1526,6 +1621,18 @@
     ]
 !
 
+addMethod:methodOrSelector inClass:aClassOrClassName fileName:fileName
+    "add an individual method to the project"
+
+    |i|
+
+    i := MethodInfo new.
+    i methodName:methodOrSelector.
+    i className:aClassOrClassName.
+    i fileName:fileName.
+    self addMethodInfo:i
+!
+
 classInfo:aClassInfoCollection
     "set the class info of the project"
 
@@ -1841,6 +1948,38 @@
     "Modified: 14.2.1997 / 15:38:47 / cg"
 ! !
 
+!Project::MethodInfo methodsFor:'accessing'!
+
+className
+    "return the value of the instance variable 'className' (automatically generated)"
+
+    ^ className!
+
+className:something
+    "set the value of the instance variable 'className' (automatically generated)"
+
+    className := something.!
+
+fileName
+    "return the value of the instance variable 'fileName' (automatically generated)"
+
+    ^ fileName!
+
+fileName:something
+    "set the value of the instance variable 'fileName' (automatically generated)"
+
+    fileName := something.!
+
+methodName
+    "return the value of the instance variable 'methodName' (automatically generated)"
+
+    ^ methodName!
+
+methodName:something
+    "set the value of the instance variable 'methodName' (automatically generated)"
+
+    methodName := something.! !
+
 !Project::ClassInfo methodsFor:'accessing'!
 
 classFileName
@@ -1876,6 +2015,6 @@
 !Project class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.84 1999-08-04 14:09:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.85 1999-09-02 21:14:43 cg Exp $'
 ! !
 Project initialize!