class: Tools::NewSystemBrowser
authorClaus Gittinger <cg@exept.de>
Fri, 04 Jul 2014 12:28:03 +0200
changeset 14583 50923489b9fd
parent 14582 66eb95a62527
child 14584 4e917e8a9736
class: Tools::NewSystemBrowser changed:6 methods use new copyButLast
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Fri Jul 04 12:27:35 2014 +0200
+++ b/Tools__NewSystemBrowser.st	Fri Jul 04 12:28:03 2014 +0200
@@ -18283,7 +18283,7 @@
             className := (className copyTo:(className indexOfSubCollection:'(Name')-1) withoutSeparators
         ] ifFalse:[
             className := ((className copyFrom:(className indexOfSubCollection:'(in ')+4)
-                            copyButLast:1)
+                            copyButLast)
                          , '::' , className asCollectionOfWords first
         ].
         ((className startsWith:'JAVA::') and:[className includes:$.]) ifTrue:[
@@ -26094,7 +26094,7 @@
                                         ] ifFalse:[
                                             searchAllLabel := 'Methods referring to the value of ''%1'''.
                                             otherKeysReferringToValue size <= 3 ifTrue:[
-                                                msg := (otherKeysReferringToValue copyButLast:1) asStringWith:', '.
+                                                msg := (otherKeysReferringToValue copyButLast) asStringWith:', '.
                                                 msg := msg , ' and ' , otherKeysReferringToValue last.
                                                 msg := msg , ' also refer to that value. Search those references too ?'.
                                             ] ifFalse:[
@@ -29120,7 +29120,7 @@
             (newClassName includes:$:) ifTrue:[
                 idx := newClassName lastIndexOf:$:.
                 ownerName := newClassName copyTo:idx.
-                [ownerName endsWith:$:] whileTrue:[ownerName := ownerName copyButLast:1].
+                [ownerName endsWith:$:] whileTrue:[ownerName := ownerName copyButLast].
                 newClassName := newClassName copyFrom:idx+1.
             ] ifFalse:[
                 (self confirm:(resources string:'Copy as public class ''%1'' ?' with:newClassName) withCRs)
@@ -34374,7 +34374,7 @@
     "/ need a better solution for that in the long term
     #fixme.
     (manager == CVSSourceCodeManager and:[ rev endsWith:$m ]) ifTrue:[
-        rev := rev copyButLast:1.
+        rev := rev copyButLast.
     ].
     self classMenuCompareAgainstVersionInRepository:rev usingManager: manager
 !
@@ -35286,7 +35286,10 @@
     "for now, this works only for a diffSet containing only a single class"
 
     |fileNamePrefix fileNameMiddle stxPatchesDir
-     changedClassesAndMetaclasses changedClasses fileName changedOwningClasses generatedPatchFilename tempStream changeSet labels values answer|
+     changedClassesAndMetaclasses changedClasses 
+     fileName changedOwningClasses generatedPatchFilename 
+     tempStream changeSet labels values answer
+     keyFileGeneratorClass browseFile|
 
     "/ find the highest numbered patchfile
     fileNamePrefix := self nextPatchNumberIn:'stxPatches' asFilename.
@@ -35330,27 +35333,34 @@
     generatedPatchFilename := ('stxPatches' asFilename construct:fileName).
 
     tempStream fileName renameTo:generatedPatchFilename.
-
-    labels := #('OK' 'Show' 'Generate Signed Patch').
-    values := #(ok show sign).
-
-    (Smalltalk at:#'Expecco::KeyFileGenerator') isNil ifTrue:[
-        "Cannot sign"
-        labels := labels copyButLast:1.
-        values := values copyButLast:1.
+    browseFile := false.
+
+    labels := #('OK' 'Show').
+    values := #(ok show).
+
+    "/ CG: this hard coded expecco stuff in here should be
+    "/ done by installing an extension method, whenever expecco is loaded,
+    "/ which adds the corresponding item to the browser's menu and adds another method
+
+    (keyFileGeneratorClass := Smalltalk at:#'Expecco::KeyFileGenerator') notNil ifTrue:[
+        "Can generate signed patches"
+        labels := labels , #( 'Generate Signed Patch' ).
+        values := values , #( sign ).
     ].
     answer := Dialog
         confirmWithCancel:('Created new patchFile as: "%1"' bindWith:generatedPatchFilename name)
         labels:labels values:values default:1.
+
     answer == #sign ifTrue:[
-        |pkcs7SignedData patchesDir|
-
+        |pkcs7SignedData patchesDir expeccoVersionArray|
+
+        expeccoVersionArray := (Smalltalk at:#'Expecco::Expecco') versionArray.
         patchesDir := (Smalltalk at:#exept_expecco) packageDirectory / 'patches'
-                        / ('%1.%2.%3' expandPlaceholdersWith:Expecco::Expecco versionArray).
+                        / ('%1.%2.%3' expandPlaceholdersWith:expeccoVersionArray).
 
         patchesDir exists ifFalse:[
             "Not an expecco development version - fall back"
-            patchesDir := Expecco::Expecco patchesDir.
+            patchesDir := (Smalltalk at:#'Expecco::Expecco') patchesDir.
             patchesDir exists ifFalse:[
                 patchesDir recursiveMakeDirectory.
             ].
@@ -35360,7 +35370,7 @@
         generatedPatchFilename moveTo:fileName.
         generatedPatchFilename := fileName.
 
-        pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:generatedPatchFilename contentsOfEntireFile.
+        pkcs7SignedData := keyFileGeneratorClass new signExpeccoCode:generatedPatchFilename contentsOfEntireFile.
         (generatedPatchFilename withSuffix:'expeccoPatch') contents:pkcs7SignedData.
         generatedPatchFilename := generatedPatchFilename withSuffix:'info'.
         generatedPatchFilename writingFileDo:[:stream |
@@ -35371,9 +35381,13 @@
             Timestamp now printOn:stream.
             stream cr; close.
         ].
-        UserPreferences fileBrowserClass openOn:generatedPatchFilename
+        browseFile := true.
     ].
     answer == #show ifTrue:[
+        browseFile := true.
+    ].
+
+    browseFile ifTrue:[
         UserPreferences fileBrowserClass openOn:generatedPatchFilename
     ].
 
@@ -55676,7 +55690,7 @@
     changedSource := changedSource collect:[:line | line string withoutTrailingSeparators withTabsExpanded].
     changedSource := changedSource collect:[:line | line asNilIfEmpty].
     [changedSource size > 0 and:[changedSource last isNil]] whileTrue:[
-        changedSource := changedSource copyButLast:1
+        changedSource := changedSource copyButLast
     ].
     changedSource := changedSource asString.
 
@@ -61779,11 +61793,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2089 2014-07-01 19:53:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2090 2014-07-04 10:28:03 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2089 2014-07-01 19:53:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.2090 2014-07-04 10:28:03 cg Exp $'
 !
 
 version_HG
@@ -61792,7 +61806,7 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__NewSystemBrowser.st,v 1.2089 2014-07-01 19:53:17 cg Exp $'
+    ^ '$Id: Tools__NewSystemBrowser.st,v 1.2090 2014-07-04 10:28:03 cg Exp $'
 ! !