Bugfix for #17: fixed Cypress package fileout jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 12 Jan 2014 23:30:25 +0000
branchjv
changeset 13752 25c2a13f00c5
parent 13751 adfad43d7693
child 15566 184cea584be5
Bugfix for #17: fixed Cypress package fileout
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Tue Dec 17 10:38:14 2013 +0100
+++ b/Tools__NewSystemBrowser.st	Sun Jan 12 23:30:25 2014 +0000
@@ -45,7 +45,7 @@
 		LastLiteralReplacementOldLiteral LastNewProjectType
 		LastClassProcessingBlockString RecentlyClosedList
 		LastClassSearchBoxShowedFullName CachedTagToRevisionMapping
-		CachedMethodsImplemented'
+		CachedMethodsImplemented LastCypressDirectory'
 	poolDictionaries:''
 	category:'Interface-Browsers-New'
 !
@@ -40421,39 +40421,45 @@
 !
 
 projectMenuFileOutAsWithFormat:aFormatSymbolOrNil
-    |currentProject selectedProjects suffix saveName fileName mgr s classesToFileout|
+    |currentProject selectedProjects suffix saveName fileName "methodsToFileOut fileNameForExtensions" mgr s classesToFileout|
 
     selectedProjects := self selectedProjectsValue.
     currentProject := self theSingleSelectedProject.
     currentProject notNil ifTrue:[
-	fileName := currentProject asString copy replaceAny:' :/' with:$_.
-    ] ifFalse:[
-	fileName := 'someProjects'
-    ].
-    aFormatSymbolOrNil == #xml ifTrue:[
-	suffix := '.xml'
-    ] ifFalse:[
-	aFormatSymbolOrNil == #sif ifTrue:[
-	    suffix := '.sif'
-	] ifFalse:[
-	    aFormatSymbolOrNil == #binary ifTrue:[
-		suffix := '.cls'
-	    ] ifFalse:[
-		suffix := '.st'
-	    ]
-	]
+        fileName := currentProject asString copy replaceAny:' :/' with:$_.
+    ] ifFalse:[
+        fileName := 'someProjects'
+    ].
+    aFormatSymbolOrNil == #cypress ifTrue:[
+        suffix := ''.
+    ] ifFalse:[
+        aFormatSymbolOrNil == #sif ifTrue:[
+            suffix := '.sif'
+        ] ifFalse:[
+            aFormatSymbolOrNil == #binary ifTrue:[
+                suffix := '.cls'
+            ] ifFalse:[
+                suffix := '.st'
+            ]
+        ]
     ].
     fileName := fileName , suffix.
 
     aFormatSymbolOrNil == #binary ifTrue:[
-	self error:'binary must go into separate files' mayProceed:true.
-	^ self
-    ].
-
-    saveName := Dialog
-	requestFileNameForSave:(resources string:'FileOut %1 as:' with:(currentProject ? 'selected projects'))
-	default:fileName
-	fromDirectory:(FileSelectionBox lastFileSelectionDirectory).
+        self error:'binary must go into separate files' mayProceed:true.
+        ^ self
+    ].
+
+    aFormatSymbolOrNil == #cypress ifTrue:[
+        saveName := Dialog
+            requestDirectoryName: (resources string:'FileOut %1 in:' with:(currentProject ? 'selected projects'))
+            default: LastCypressDirectory.
+    ] ifFalse:[
+        saveName := Dialog
+            requestFileNameForSave:(resources string:'FileOut %1 as:' with:(currentProject ? 'selected projects'))
+            default:fileName
+            fromDirectory:(FileSelectionBox lastFileSelectionDirectory).
+    ].
 
 "/    fileBox := FileSelectionBox
 "/                    title:(resources string:'FileOut %1 as:' with:(currentProject ? 'selected projects'))
@@ -40472,68 +40478,80 @@
 "/    fileBox := nil.
 
     saveName isEmptyOrNil ifTrue:[
-	^ self
+        ^ self
     ].
     FileSelectionBox lastFileSelectionDirectory:(saveName asFilename directoryName).
     fileName := saveName.
 
     aFormatSymbolOrNil == #sif ifTrue:[
-	SmalltalkInterchangeSTXFileOutManager initialize.
-	mgr := SmalltalkInterchangeFileManager newForFileOut.
-	mgr fileName: fileName.
-	self selectedProjectClasses do:[:eachClass |
-	    mgr addClass:eachClass.
-	].
-	environment allClassesDo:[:eachClass |
-	    eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
-		|mPckg|
-
-		mPckg := mthd package.
-		mPckg ~= eachClass package ifTrue:[
-		    (selectedProjects includes:mPckg) ifTrue:[
-			mgr addMethodNamed:mthd selector ofClass:mthd mclass
-		    ]
-		]
-	    ]
-	].
-	self busyLabel:'writing...'.
-	mgr fileOut.
-	self normalLabel.
-	^ self
+        SmalltalkInterchangeSTXFileOutManager initialize.
+        mgr := SmalltalkInterchangeFileManager newForFileOut.
+        mgr fileName: fileName.
+        self selectedProjectClasses do:[:eachClass |
+            mgr addClass:eachClass.
+        ].
+        Smalltalk allClassesDo:[:eachClass |
+            eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
+                |mPckg|
+
+                mPckg := mthd package.
+                mPckg ~= eachClass package ifTrue:[
+                    (selectedProjects includes:mPckg) ifTrue:[
+                        mgr addMethodNamed:mthd selector ofClass:mthd mclass
+                    ]
+                ]
+            ]
+        ].
+        self busyLabel:'writing...'.
+        mgr fileOut.
+        self normalLabel.
+        ^ self
     ].
 
     aFormatSymbolOrNil isNil ifTrue:[
-	self busyLabel:'writing...'.
-	s := fileName asFilename writeStream.
-	classesToFileout := OrderedCollection withAll:(self selectedProjectClasses).
-	classesToFileout topologicalSort:[:a :b | b isSubclassOf:a].
-
-	classesToFileout do:[:eachClass |
-	    eachClass fileOutOn:s.
-	].
-
-	environment allClassesDo:[:eachClass |
-	    eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
-		|mPckg|
-
-		mPckg := mthd package.
-		(mPckg = currentProject and:[mPckg ~= eachClass package]) ifTrue:[
-		    eachClass
-			fileOutCategory:mthd category
-			methodFilter:[:m | m == mthd]
-			on:s.
-		    s cr.
-		]
-	    ]
-	].
-	s close.
-	self normalLabel.
-	^ self.
-    ].
+        self busyLabel:'writing...'.
+        s := fileName asFilename writeStream.
+        classesToFileout := OrderedCollection withAll:(self selectedProjectClasses).
+        classesToFileout topologicalSort:[:a :b | b isSubclassOf:a].
+
+        classesToFileout do:[:eachClass |
+            eachClass fileOutOn:s.
+        ].
+
+        Smalltalk allClassesDo:[:eachClass |
+            eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
+                |mPckg|
+
+                mPckg := mthd package.
+                (mPckg = currentProject and:[mPckg ~= eachClass package]) ifTrue:[
+                    eachClass
+                        fileOutCategory:mthd category
+                        methodFilter:[:m | m == mthd]
+                        on:s.
+                    s cr.
+                ]
+            ]
+        ].
+        s close.
+        self normalLabel.
+        ^ self.
+    ].
+
+    aFormatSymbolOrNil == #cypress ifTrue:[
+        mgr := (Smalltalk at:#CypressRepository) on: saveName.
+        self showMessage: (resources string:'Writing Cypress package...')
+                   while: [ selectedProjects do:[:each | mgr write: each ] ]
+            inBackground: true.
+        LastCypressDirectory := saveName.
+        ^ self
+    ].
+
+
 
     self shouldImplement.
 
     "Modified: / 27-10-2010 / 11:34:45 / cg"
+    "Modified: / 12-01-2014 / 23:25:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 projectMenuFileOutBuildSupportFiles