ProjectBrowser.st
changeset 1239 a95243b3ab4a
parent 1238 af3b724392f4
child 1240 18fa01008a4f
--- a/ProjectBrowser.st	Fri Sep 24 19:10:24 1999 +0200
+++ b/ProjectBrowser.st	Fri Sep 24 19:26:36 1999 +0200
@@ -189,6 +189,24 @@
 
 !ProjectBrowser class methodsFor:'image specs'!
 
+bigProjectBrowserIcon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self bigProjectBrowserIcon inspect
+     ImageEditor openOnClass:self andSelector:#bigProjectBrowserIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser bigProjectBrowserIcon'
+        ifAbsentPut:[(Depth4Image new) width: 48; height: 48; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@L3@@@@@3L3L@@@@@@@@@@@@@@@@@@@@@L3@@@@@3L3L@@@@@@@@@@@@@@@@@@@L3L3L@@@L3L3L3@@@@@@@@@@@@@@@@@3L3@3L@@3L@@@L3@@@@@@@@@@@@@@@@@3L3@3L@@3L@@@L3@@@@@@@@@@@@@@@@L3@@@3L@@3L@@@L3@@@@@@@@@@@@@@@@L3@@@3L@@3L@@@L3@@@@@@@@@@@@@@@@L3@@@3L@@3L@@@L3@@@@@@@@@@@@@@@@L3@@@3L@@3L@L3L3@@@@@@@@@@@@@@@@@3L3P3MDP3L3L3QDQ@@@@@@@@@@@@@@@@3L3P3MDP3L3L3QDPD@@@@@@@@@@@@@@@3L3L3MDL3L3MDQDAD@@@@@@@@@@@@@@@3L3L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width: 48; height: 48; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8C<@@@@@8C<@@@@G<G?@@@@_\\G@@@@_\\G@@@@8\\G@@@@8\\G@@@@8\\G@@@@8???<@@@_???<@@@_???<@@@_???<@@@_???<@@@_???<@@@????<@@A????<@@C????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????<@@G????8@@G????0@@G???? @@G????@@@G????@@@G???<@@@G???8@@@G???0@@@G??? @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]!
+
 buildOptionsIcon
     "This resource specification was automatically generated
      by the ImageEditor of ST/X."
@@ -1711,8 +1729,9 @@
           #name: 'ProjectBrowser'
           #min: #(#Point 10 10)
           #max: #(#Point 1024 768)
-          #bounds: #(#Rectangle 30 377 633 928)
+          #bounds: #(#Rectangle 10 20 613 571)
           #menu: #mainMenu
+          #icon: #bigProjectBrowserIcon
         )
         #component: 
        #(#SpecCollection
@@ -1726,7 +1745,11 @@
            #(#VariableHorizontalPanelSpec
               #name: 'VariableHorizontalPanel1'
               #layout: #(#LayoutFrame 0 0.0 40 0.0 0 1.0 -24 1.0)
-              #handles: #(#Any 0.379433 1.0)
+              #handles: 
+             #(#OrderedCollection
+                #Any 0.379433
+                1.0
+              )
               #component: 
              #(#SpecCollection
                 #collection: #(
@@ -2289,15 +2312,7 @@
     browser := self new.
     browser allButOpen.
     project := browser loadFromProjectFile:aFilename.
-
-    theNode := browser projectTreeHolder 
-                    detectFirstItem:[:item | item contents == project].
-
-    [theNode notNil] whileTrue:[
-        browser projectTreeHolder expand:theNode.
-        theNode := theNode parent.
-    ].
-
+    browser expandPathToNodeFor:project.
     browser openWindow
 ! !
 
@@ -3433,6 +3448,21 @@
 
 !
 
+expandPathToNodeFor:someContents
+    |theNode|
+
+    theNode := self projectTreeHolder 
+                    detectFirstItem:[:item | item contents == someContents].
+
+    [theNode notNil] whileTrue:[
+        self projectTreeHolder expand:theNode.
+        theNode := theNode parent.
+    ].
+
+
+
+!
+
 hasClassNodeSelected
     |selectedNode|
 
@@ -4568,13 +4598,26 @@
 !
 
 loadFromProjectFile:aFilenameString
-    |newProject|
+    |oldNode newProject|
 
     self withReadCursorDo:[
         newProject := Project new loadFromProjectFile:aFilenameString.
+
+        oldNode := self projectTreeHolder 
+                        detectFirstItem:[:item | item contents class == Project
+                                                 and:[item contents package = newProject package]].
+        oldNode notNil ifTrue:[
+            (self confirm:'Overload packages definitions from file ?') ifFalse:[
+                ^ self
+            ].
+            self projectTreeHolder remove:oldNode.
+        ].
+
         newProject notNil ifTrue:[
             self newProject:newProject
-        ]
+        ].
+        self expandPathToNodeFor:newProject.
+
     ].
     ^ newProject
 !