ProjectBrowser.st
changeset 1079 deda6cdfe287
parent 1052 2b65eda2938e
child 1080 98b04ef482dc
--- a/ProjectBrowser.st	Tue Mar 23 11:34:49 1999 +0100
+++ b/ProjectBrowser.st	Tue Mar 23 12:09:45 1999 +0100
@@ -5,8 +5,8 @@
 	category:'Interface-Smalltalk'
 !
 
-TreeItem subclass:#ProjectTreeItem
-	instanceVariableNames:'action'
+TreeItemWithImage subclass:#ProjectTreeItem
+	instanceVariableNames:'action spec'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:ProjectBrowser
@@ -20,6 +20,101 @@
 !
 
 
+!ProjectBrowser class methodsFor:'image specs'!
+
+classesIcon
+    "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 classesIcon inspect
+     ImageEditor openOnClass:self andSelector:#classesIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser classesIcon'
+        ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@ADA@AD"H"DPDPD@@@@@@@@@@P@QDQDQDA@A@AH"H"HPD@@@DQDQDQ@PD@@@@@@@@A@P@ADQDQDPDA@@DRH"HQ@PD@@QDQDQDA@P@ADQDQDPDA@@@@@@@@@PD@DPDQDQDQ@P@Q@@@@@@@A@ADQ@QDQDQD@DQD@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 132 130 132]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>C?8O?8??#??/?>??;??/?>??;??/?>O?8?? ?>C?8b') ; yourself); yourself]!
+
+commentIcon
+    "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 commentIcon inspect
+     ImageEditor openOnClass:self andSelector:#commentIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser commentIcon'
+        ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(8 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDAA@PD@PDA@PDA@PDA@PDA@PPDA@DA@PDA@PDA@PDA@PDDA@PA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PDA@PPDA@DA@PDA@PDA@PDA@P@DA@P@@PDA@PDA@PDA@PD@A@PD@@DA@PDA@PDA@PDA@@PDA@@A@PDA@PDA@PDA@P@DA@P@@PDA@PDA@PDA@PD@A@PD@@DA@PDA@PDA@PDA@@PDA@@A@PDA@PDA@PDA@PD@@@@A@PDA@PDA@PDA@PDA@PD@@PDA@PDA@P@a') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0 0 0 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@8@C @N@@@@C @N@@8@C @N@@8@C @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself]!
+
+deploymentIcon
+    "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 deploymentIcon inspect
+     ImageEditor openOnClass:self andSelector:#deploymentIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser deploymentIcon'
+        ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@CL0@3L0@@@CL3@3@3@@@CL@LC@CL@@@L0@0LCL0@@@CMCP3MD@@@@L3L3L3M@@@ADP3QD@4@@@@@3@@ACP@@DQCMDPDM@@@QDL4Q@P4@@ADP3QDACP@@DQCMDPDM@@@QDL4Q@P0@@ADP3QDAC@@@DQCMDP@@@@@@@L0@@@@@b') ; colorMapFromArray:#[0 0 0 0 0 132 132 0 0 132 0 132 255 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A30O[A%LF?<O?0??G?<??3??O?<??3??O?8??C?8O?@b') ; yourself); yourself]!
+
+filesIcon
+    "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 filesIcon inspect
+     ImageEditor openOnClass:self andSelector:#filesIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser filesIcon'
+        ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@DQDQ@P@@@@@P@@@@@@@@@A@QDQDA@@@@DA@@@@@@@@@PDADQDPD@@A@PDQDQ@Q@@DA@QDQD@@@@PDADQDQDQ@A@PDQDQDQD@@A@QDQDQDP@@DADQDQDQ@@@@DQDQDQD@@@@QDQDQDP@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@C? O?@?>C?<O?8??3??/??????????O?<??0??C?<b') ; yourself); yourself]!
+
+methodsIcon
+    "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 multipleUnlockedMagentaIcon inspect
+     ImageEditor openOnClass:self andSelector:#multipleUnlockedMagentaIcon
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:#'ProjectBrowser methodsIcon'
+        ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@DH@@@@@@@@4QA@@@@@@@TQDPP@@@@@@MDQDH@@@@@@PQDQA@@@@@@LTQA@@@@@@M@I@L@@@@@EDPQD@@@@@@CQDIB@@@@@@DDQDPP@@@@@CEDPP@@@@@@@BPC@@@@@@@@DQ@@@@@@@@@B@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 0 0 132 132 0 0 132 0 132 255 0 255]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'B@@\@C8@_0A? C?@G<@? G<@_8@?0A?@C8@G@@H@@@@b') ; yourself); yourself]
+
+
+! !
+
 !ProjectBrowser class methodsFor:'interface specs'!
 
 emptyRightCanvasSpec
@@ -250,6 +345,126 @@
       )
 !
 
+rightCanvasSpecForProperties
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:ProjectBrowser andSelector:#rightCanvasSpecForProperties
+     ProjectBrowser new openInterface:#rightCanvasSpecForProperties
+    "
+
+    <resource: #canvas>
+
+    ^
+     
+       #(#FullSpec
+          #name: #rightCanvasSpecForProperties
+          #window: 
+           #(#WindowSpec
+              #name: 'NewApplication'
+              #layout: #(#LayoutFrame 170 0 122 0 469 0 421 0)
+              #level: 0
+              #label: 'NewApplication'
+              #min: #(#Point 10 10)
+              #max: #(#Point 1280 1024)
+              #bounds: #(#Rectangle 170 122 470 422)
+              #usePreferredExtent: false
+              #returnIsOKInDialog: true
+              #escapeIsCancelInDialog: true
+          )
+          #component: 
+           #(#SpecCollection
+              #collection: 
+               #(
+                 #(#HorizontalPanelViewSpec
+                    #name: 'HorizontalPanel1'
+                    #layout: #(#LayoutFrame 0 0 -30 1 0 1 0 1)
+                    #component: 
+                     #(#SpecCollection
+                        #collection: 
+                         #(
+                           #(#ActionButtonSpec
+                              #name: 'Button1'
+                              #label: 'Cancel'
+                              #translateLabel: true
+                              #model: #cancel
+                              #extent: #(#Point 145 22)
+                          )
+                           #(#ActionButtonSpec
+                              #name: 'Button2'
+                              #label: 'OK'
+                              #translateLabel: true
+                              #model: #accept
+                              #extent: #(#Point 146 22)
+                          )
+                        )
+                    )
+                    #horizontalLayout: #fitSpace
+                    #verticalLayout: #center
+                    #horizontalSpace: 3
+                    #verticalSpace: 3
+                )
+                 #(#FramedBoxSpec
+                    #name: 'FramedBox1'
+                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 93 0)
+                    #component: 
+                     #(#SpecCollection
+                        #collection: 
+                         #(
+                           #(#RadioButtonSpec
+                              #name: 'RadioButton1'
+                              #layout: #(#LayoutFrame -1 0.0 10 0 135 0 32 0)
+                              #label: 'Application'
+                              #translateLabel: true
+                              #model: #projectType
+                              #isTriggerOnDown: true
+                              #lampColor: #(#Color 100.0 100.0 0.0)
+                              #select: #application
+                          )
+                           #(#RadioButtonSpec
+                              #name: 'RadioButton2'
+                              #layout: #(#LayoutFrame -1 0.0 38 0 135 0 60 0)
+                              #label: 'Class Library'
+                              #translateLabel: true
+                              #model: #projectType
+                              #isTriggerOnDown: true
+                              #lampColor: #(#Color 100.0 100.0 0.0)
+                              #select: #classLibrary
+                          )
+                        )
+                    )
+                    #label: 'Project Type'
+                    #labelPosition: #topLeft
+                    #translateLabel: true
+                )
+                 #(#FramedBoxSpec
+                    #name: 'FramedBox2'
+                    #layout: #(#LayoutFrame 0 0.0 94 0.0 0 1.0 159 0)
+                    #component: 
+                     #(#SpecCollection
+                        #collection: 
+                         #(
+                           #(#InputFieldSpec
+                              #name: 'EntryField1'
+                              #layout: #(#LayoutFrame 0 0.0 4 0 0 1.0 26 0)
+                              #model: #projectDirectory
+                              #isReadOnly: true
+                          )
+                        )
+                    )
+                    #label: 'Directory'
+                    #labelPosition: #topLeft
+                    #translateLabel: true
+                )
+              )
+          )
+      )
+!
+
 rightCanvasSpecForReadOnlyText
     "This resource specification was automatically generated
      by the UIPainter of ST/X."
@@ -446,15 +661,7 @@
                     
                      #(
                        #(#MenuItem
-                          #label: 'New'
-                          #translateLabel: true
-                          #value: #newProject
-                      )
-                       #(#MenuItem
-                          #label: '-'
-                      )
-                       #(#MenuItem
-                          #label: 'Open...'
+                          #label: 'Load From...'
                           #translateLabel: true
                           #value: #openProject
                       )
@@ -565,6 +772,35 @@
       )
 !
 
+noItemMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:ProjectBrowser andSelector:#projectItemMenu
+     (Menu new fromLiteralArrayEncoding:(ProjectBrowser projectItemMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^
+     
+       #(#Menu
+          
+           #(
+             #(#MenuItem
+                #label: 'New Project'
+                #translateLabel: true
+                #value: #newProject
+            )
+          ) nil
+          nil
+      )
+!
+
 projectItemMenu
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
@@ -585,15 +821,20 @@
           
            #(
              #(#MenuItem
-                #label: 'Rename...'
+                #label: 'Make Current'
                 #translateLabel: true
-                #value: #renameProject
+                #value: #makeCurrentProject
                 #enabled: #hasProjectSelectedHolder
             )
              #(#MenuItem
                 #label: '-'
             )
              #(#MenuItem
+                #label: 'New Project'
+                #translateLabel: true
+                #value: #newProject
+            )
+             #(#MenuItem
                 #label: 'New SubProject'
                 #translateLabel: true
                 #value: #newSubProject
@@ -603,6 +844,15 @@
                 #label: '-'
             )
              #(#MenuItem
+                #label: 'Rename...'
+                #translateLabel: true
+                #value: #renameProject
+                #enabled: #hasProjectSelectedHolder
+            )
+             #(#MenuItem
+                #label: '-'
+            )
+             #(#MenuItem
                 #label: 'Remove...'
                 #translateLabel: true
                 #value: #removeProject
@@ -849,7 +1099,9 @@
 !
 
 setupCanvasForNoSelection
-    self showReadOnlyText:'Please select an existing,
+    self 
+        showReadOnlyText:'Please select an existing project,
+load one from a (''.prj'')-file,
 or create a new project.'.
 ! !
 
@@ -867,8 +1119,7 @@
     self hasClassesNodeSelected ifTrue:[
         ^ self class classesItemMenu
     ].      
-
-    ^ nil
+    ^ self class noItemMenu
 !
 
 itemMenuHolder
@@ -917,44 +1168,53 @@
     |projectName pNode 
      propertiesNode docNode classesNode patchesNode subprojectsNode filesNode
      commentNode prerequisitesNode analysisNode designNode codeNode
-     userDocNode userOverViewNode userGuideNode userRefManNode|
+     userDocNode userOverViewNode userGuideNode userRefManNode
+     deploymentNode|
 
     projectName := aProject name.
     pNode := ProjectNode name:projectName.
     pNode contents:aProject.
 
     pNode add:(commentNode := ProjectTreeItem name:'Comment').
-    pNode add:(docNode := ProjectTreeItem name:'Documentation').
+"/    pNode add:(docNode := ProjectTreeItem name:'Documentation').
     pNode add:(propertiesNode := ProjectTreeItem name:'Properties').
     pNode add:(prerequisitesNode := ProjectTreeItem name:'Prerequisites').
-    pNode add:(subprojectsNode := ProjectTreeItem name:'SubProjects').
+"/    pNode add:(subprojectsNode := ProjectTreeItem name:'SubProjects').
     pNode add:(classesNode := ProjectTreeItem name:'Classes').
     pNode add:(patchesNode := ProjectTreeItem name:'Patches').
     pNode add:(filesNode := ProjectTreeItem name:'Files').
+    pNode add:(deploymentNode := ProjectTreeItem name:'Deployment').
 
-    aProject subProjects do:[:aSubProject |
-        subprojectsNode add:(self nodeFor:aSubProject)
+    subprojectsNode notNil ifTrue:[
+        subprojectsNode contents:#subprojects.
+        aProject subProjects do:[:aSubProject |
+            subprojectsNode add:(self nodeFor:aSubProject)
+        ].
     ].
 
+    commentNode icon:(self class commentIcon).
     commentNode action:[:item | self showCommentOf:item].
     commentNode contents:#comment.
 
-    docNode contents:#documentation.
-    docNode action:[:item | self showDocumentationFor:item].
+    docNode notNil ifTrue:[
+        docNode contents:#documentation.
+        docNode action:[:item | self showDocumentationFor:item].
 
-    docNode add:(analysisNode := ProjectTreeItem name:'Analysis').
-    docNode add:(designNode := ProjectTreeItem name:'Design').
-    docNode add:(codeNode := ProjectTreeItem name:'Code').
-    docNode add:(userDocNode := ProjectTreeItem name:'User Documentation').
-    userDocNode add:(userOverViewNode := ProjectTreeItem name:'Overview').
-    userDocNode add:(userGuideNode := ProjectTreeItem name:'Guide').
-    userDocNode add:(userRefManNode := ProjectTreeItem name:'Reference').
-    docNode add:(userDocNode := ProjectTreeItem name:'Error Reports').
-    docNode add:(userDocNode := ProjectTreeItem name:'Other').
+        docNode add:(analysisNode := ProjectTreeItem name:'Analysis').
+        docNode add:(designNode := ProjectTreeItem name:'Design').
+        docNode add:(codeNode := ProjectTreeItem name:'Code').
+        docNode add:(userDocNode := ProjectTreeItem name:'User Documentation').
+        userDocNode add:(userOverViewNode := ProjectTreeItem name:'Overview').
+        userDocNode add:(userGuideNode := ProjectTreeItem name:'Guide').
+        userDocNode add:(userRefManNode := ProjectTreeItem name:'Reference').
+        docNode add:(userDocNode := ProjectTreeItem name:'Error Reports').
+        docNode add:(userDocNode := ProjectTreeItem name:'Other').
+    ].
 
     prerequisitesNode contents:#prerequisites.
 
     classesNode contents:#classes.
+    classesNode icon:(self class classesIcon).
     ((aProject classes ? #()) copy sort:[:a :b | a name < b name]) 
     do:[:aClass |
         |cNode|
@@ -964,12 +1224,15 @@
     ].
 
     propertiesNode contents:#properties.
-
-    subprojectsNode contents:#subprojects.
+    propertiesNode spec:(self class rightCanvasSpecForProperties).
 
     filesNode contents:#files.
+    filesNode icon:(self class filesIcon).
 
     patchesNode contents:#patches.
+    patchesNode icon:(self class methodsIcon).
+
+    deploymentNode icon:(self class deploymentIcon).
 
     ^ pNode
 
@@ -992,7 +1255,7 @@
 !
 
 updateRightCanvas
-    |selectedNode nodeContents|
+    |selectedNode nodeContents spec|
 
     selectedNode := self selectedTreeNode value.
     selectedNode isNil ifTrue:[
@@ -1000,6 +1263,11 @@
         ^ self
     ].
 
+    (spec := selectedNode spec) notNil ifTrue:[
+        self currentCanvasHolder value:spec.
+        ^ self
+    ].
+
     selectedNode isProjectNode ifTrue:[
         self showCommentOf:selectedNode.
         ^ self.
@@ -1014,7 +1282,6 @@
         ^ self.
     ].
 
-
     self currentCanvasHolder value:(self class emptyRightCanvasSpec).
     self rightCanvasTextHolder value:''.
 
@@ -1056,6 +1323,19 @@
     ].
 !
 
+makeCurrentProject
+    "make the selected Project the current project"
+
+    |project selectedNode|
+
+    self hasProjectNodeSelected ifTrue:[
+        selectedNode := self selectedTreeNode value.
+        project := selectedNode contents.
+
+        Project current:project.
+    ]
+!
+
 newProject
     self newProject:Project new.
 
@@ -1121,20 +1401,9 @@
         selectedNode := self selectedTreeNode value.
         projectToRemove := selectedNode contents.
 
-"/        parentNode := selectedNode parent.
-"/        parentNode contents == #subprojects ifTrue:[
-"/            parentNode removeChild:selectedNode.
-"/        ] ifFalse:[
-"/            parentNode removeChild:selectedNode.
-"/        ].
-        self projectTreeHolder removeSelection
-
-"/        self projectTreeHolder root:projectTree.
-
-"/        parentProject addSubProject:newProject.
-"/        subNode := selectedNode children detect:[:child | child contents == #subprojects].
-"/        subNode add:newNode.
-"/        self projectTreeHolder root:projectTree.
+        (self confirm:'Really remove the project ?') ifTrue:[
+            self projectTreeHolder removeSelection
+        ]
     ]
 !
 
@@ -1233,13 +1502,6 @@
     self currentCanvasHolder value:(self class rightCanvasSpecForReadOnlyText).
     self rightCanvasTextHolder value:someText.
 
-!
-
-showTreeItem:anItem
-    anItem contents == #comment ifTrue:[
-        self showCommentOf:anItem.
-        ^ self
-    ].
 ! !
 
 !ProjectBrowser::ProjectTreeItem methodsFor:'accessing'!
@@ -1252,7 +1514,17 @@
 action:something
     "set the value of the instance variable 'action' (automatically generated)"
 
-    action := something.! !
+    action := something.!
+
+spec
+    "return the value of the instance variable 'spec' (automatically generated)"
+
+    ^ spec!
+
+spec:something
+    "set the value of the instance variable 'spec' (automatically generated)"
+
+    spec := something.! !
 
 !ProjectBrowser::ProjectTreeItem methodsFor:'queries'!