ProjectBrowser.st
changeset 1095 660185e02224
parent 1094 b1214f3dc633
child 1096 7efff9ca044f
--- a/ProjectBrowser.st	Tue Mar 30 00:14:49 1999 +0200
+++ b/ProjectBrowser.st	Tue Mar 30 11:58:48 1999 +0200
@@ -1328,6 +1328,23 @@
       )
 ! !
 
+!ProjectBrowser class methodsFor:'startup'!
+
+openOnFile:aFilename
+    |browser nodes|
+
+    browser := self new.
+    browser allButOpen.
+    browser loadFromProjectFile:aFilename.
+    nodes := browser projectTreeHolder root children.
+    nodes size > 0 ifTrue:[
+"/        browser projectTreeHolder selectNode:nodes first.
+        browser projectTreeHolder expand:nodes first.
+    ].
+
+    browser openWindow
+! !
+
 !ProjectBrowser class methodsFor:'tableColumns specs'!
 
 classTableColumns
@@ -1445,10 +1462,6 @@
 classList
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#classList) isNil ifTrue:[
@@ -1468,10 +1481,6 @@
 currentCanvasHolder
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#currentCanvasHolder) isNil ifTrue:[
@@ -1483,10 +1492,6 @@
 currentProjectWasNotLoadedFromFile
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#currentProjectWasNotLoadedFromFile) isNil ifTrue:[
@@ -1500,10 +1505,6 @@
 deliverCompiledBinary
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#deliverCompiledBinary) isNil ifTrue:[
@@ -1518,10 +1519,6 @@
 deliverGZipArchive
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#deliverGZipArchive) isNil ifTrue:[
@@ -1536,10 +1533,6 @@
 deliverLoadAllFile
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#deliverLoadAllFile) isNil ifTrue:[
@@ -1554,10 +1547,6 @@
 deliverSources
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#deliverSources) isNil ifTrue:[
@@ -1572,10 +1561,6 @@
 deliverZipArchive
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#deliverZipArchive) isNil ifTrue:[
@@ -1602,10 +1587,6 @@
 htmlDocumentURLHolder
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#htmlDocumentURLHolder) isNil ifTrue:[
@@ -1617,10 +1598,6 @@
 installDirectory
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#installDirectory) isNil ifTrue:[
@@ -1635,10 +1612,6 @@
 listOfAllProjectsInPrerequisites
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder projects currentProject|
 
     (holder := builder bindingAt:#listOfAllProjectsInPrerequisites) isNil ifTrue:[
@@ -1664,10 +1637,6 @@
 listOfRequiredProjectsInPrerequisites
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#listOfRequiredProjectsInPrerequisites) isNil ifTrue:[
@@ -1681,10 +1650,6 @@
 modifiedChannel
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     modifiedChannel isNil ifTrue:[
         modifiedChannel := false asValue.
     ].
@@ -1695,10 +1660,6 @@
 patchesList
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#patchesList) isNil ifTrue:[
@@ -1710,10 +1671,6 @@
 projectDirectory
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#projectDirectory) isNil ifTrue:[
@@ -1728,10 +1685,6 @@
 projectNamespace
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#projectNamespace) isNil ifTrue:[
@@ -1746,10 +1699,6 @@
 projectTreeHolder
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#projectTree) isNil ifTrue:[
@@ -1762,10 +1711,6 @@
 projectType
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#projectType) isNil ifTrue:[
@@ -1780,10 +1725,6 @@
 repositoryDirectory
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#repositoryDirectory) isNil ifTrue:[
@@ -1798,10 +1739,6 @@
 repositoryModule
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#repositoryModule) isNil ifTrue:[
@@ -1816,10 +1753,6 @@
 rightCanvasTextHolder
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#rightCanvasTextHolder) isNil ifTrue:[
@@ -1831,10 +1764,6 @@
 selectedProjectInPrerequisites
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#selectedProjectInPrerequisites) isNil ifTrue:[
@@ -1848,10 +1777,6 @@
 selectedRequiredProjectInPrerequisites
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#selectedRequiredProjectInPrerequisites) isNil ifTrue:[
@@ -1865,10 +1790,6 @@
 selectedTreeNode
     "automatically generated by UIPainter ..."
 
-    "*** the code below creates a default model when invoked."
-    "*** (which may not be the one you wanted)"
-    "*** Please change as required and accept in the browser."
-
     |holder|
 
     (holder := builder bindingAt:#selectedTreeNode) isNil ifTrue:[
@@ -1903,7 +1824,7 @@
 postBuildWith:aBuiler
     self modifiedChannel value:false.
 
-    self setupCanvasForNoSelection.
+    self updateRightCanvas.
     ^ super postBuildWith:aBuiler
 !
 
@@ -2324,6 +2245,47 @@
     ].
 !
 
+loadClassesFromDirectory
+    "load all classes as contained in the project into the system"
+
+    |p ns cls|
+
+    p := self currentProject.
+    ns := p defaultNameSpace.
+    p classInfo do:[:clsInfo |
+        |clsName clsFileName|
+
+        clsName := clsInfo className.
+        clsFileName := clsInfo classFileName.
+        clsFileName isNil ifTrue:[clsFileName := clsName , '.st'].
+
+        clsName isSymbol ifTrue:[
+            cls := ns at:clsName.
+            cls isNil ifTrue:[
+                "/ ok - really not yet loaded.
+                Transcript showCR:'loading ' , (p directory asFilename construct:clsFileName) pathName , ' ...'.
+                Smalltalk fileIn:(p directory asFilename construct:clsFileName)
+            ] ifFalse:[
+                self halt
+            ].
+        ] ifFalse:[
+            self halt
+        ].
+    ].
+
+    self halt.
+
+!
+
+loadFromProjectFile:aFilenameString
+    |newProject|
+
+    newProject := Project new loadFromProjectFile:aFilenameString.
+    newProject notNil ifTrue:[
+        self newProject:newProject
+    ]
+!
+
 makeCurrentProject
     "make the selected Project the current project"
 
@@ -2348,7 +2310,8 @@
     newNode := self nodeFor:newProject.
     projectTree add:newNode.
     self projectTreeHolder root:projectTree.
-
+"/    self projectTreeHolder selectNode:newNode.
+"/    self projectTreeHolder expand:newNode.
 !
 
 newSubProject
@@ -2378,7 +2341,7 @@
 !
 
 openProject
-    |fn newProject|
+    |fn|
 
     fn := Dialog 
         requestFileName:'filename:' 
@@ -2388,10 +2351,7 @@
         fromDirectory:(FileSelectionBox lastFileSelectionDirectory).
 
     fn notNil ifTrue:[
-        newProject := Project new loadFromProjectFile:fn.
-        newProject notNil ifTrue:[
-            self newProject:newProject
-        ]
+        self loadFromProjectFile:fn.
     ]
 !