BrowserView.st
changeset 730 bde80e7b2de0
parent 725 b2877d3000e7
child 731 6889fc8ebac5
--- a/BrowserView.st	Fri Sep 13 09:04:01 1996 +0200
+++ b/BrowserView.st	Fri Sep 13 09:36:32 1996 +0200
@@ -1499,59 +1499,71 @@
 
     |specialMenu labels selectors shorties m|
 
-    labels :=  #(
-                   'fileOut binary'
-                   '-'
-                   'inspect class'
-                   'inspect instances'
-                   '-'
-                   'primitive definitions'
-                   'primitive variables'
-                   'primitive functions'
-                   '-'
-                   'source container ...'
-                   'remove source container ...'
-                   '-'
-                   'revision info' 
-                   'compare with repository ...' 
-                   '-'
-                   'check into source repository'
-                   'fileIn from repository ...' 
-                ).
-    selectors := #(
-                   classFileOutBinary
-                   nil
-                   classInspect
-                   classInstancesInspect
-                   nil
-                   classPrimitiveDefinitions
-                   classPrimitiveVariables
-                   classPrimitiveFunctions
-                   nil
-                   classModifyContainer
-                   classRemoveContainer
-                   nil
-                   classRevisionInfo
-                   classCompareWithNewestInRepository
-                   nil
-                   classCheckin
-                   classLoadRevision
-                  ).
+    currentClass isNil ifTrue:[
+        labels :=  #(
+                       'fileIn new from repository ...' 
+                    ).
+
+        selectors := #(
+                       classLoadNewRevision
+                      ).
+    ] ifFalse:[
+        labels :=  #(
+                       'fileOut binary'
+                       '-'
+                       'inspect class'
+                       'inspect instances'
+                       '-'
+                       'primitive definitions'
+                       'primitive variables'
+                       'primitive functions'
+                       '-'
+                       'source container ...'
+                       'remove source container ...'
+                       '-'
+                       'revision info' 
+                       'compare with repository ...' 
+                       '-'
+                       'check into source repository'
+                       'fileIn from repository ...' 
+                    ).
+        selectors := #(
+                       classFileOutBinary
+                       nil
+                       classInspect
+                       classInstancesInspect
+                       nil
+                       classPrimitiveDefinitions
+                       classPrimitiveVariables
+                       classPrimitiveFunctions
+                       nil
+                       classModifyContainer
+                       classRemoveContainer
+                       nil
+                       classRevisionInfo
+                       classCompareWithNewestInRepository
+                       nil
+                       classCheckin
+                       classLoadRevision
+                      ).
+    ].
 
     specialMenu := PopUpMenu
                         labels:(resources array:labels)
                         selectors:selectors
                         receiver:self.
 
-    currentClass isNil ifTrue:[
-        specialMenu disableAll.
-    ] ifFalse:[
+    currentClass notNil ifTrue:[
         currentClass sourceCodeManager isNil ifTrue:[
             specialMenu disableAll:#(classModifyContainer classRemoveContainer
                                      classRevisionInfo 
                                      classLoadRevision classCheckin 
                                      classCompareWithNewestInRepository).
         ]
+    ] ifFalse:[
+        SourceCodeManager isNil ifTrue:[
+            specialMenu disableAll:#(classLoadNewRevision)
+        ]
     ].
 
     device ctrlDown ifTrue:[
@@ -1695,7 +1707,7 @@
 
     ^ m
 
-    "Modified: 11.9.1996 / 13:07:26 / cg"
+    "Modified: 13.9.1996 / 09:30:15 / cg"
 !
 
 classNewClass
@@ -2560,6 +2572,116 @@
     "Modified: 11.9.1996 / 18:36:18 / cg"
 !
 
+classLoadNewRevision
+    "let user specify a container and fileIn from there"
+
+    |box className
+     moduleHolder packageHolder fileNameHolder
+     oldModule oldPackage oldFileName
+     module package fileName 
+     specialFlags aStream
+     check y component info project nm mgr creatingNew|
+
+    mgr := SourceCodeManager.
+    mgr isNil ifTrue:[^ false].
+
+    fileNameHolder := '' asValue.
+    moduleHolder := (OperatingSystem getLoginName) asValue.
+    packageHolder := 'private' asValue.
+
+    "/
+    "/ open a dialog for the module/package/container
+    "/
+    box := DialogBox new.
+    box label:'container fileIn'.
+
+    component := box addTextLabel:(resources string:'container to fileIn') withCRs.
+    component adjust:#left; borderWidth:0.
+    box addVerticalSpace.
+    box addVerticalSpace.
+
+    y := box yPosition.
+    component := box addTextLabel:(resources string:'Module:').
+    component width:0.4; adjust:#right.
+    box yPosition:y.
+    component := box addInputFieldOn:moduleHolder tabable:true.
+    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+    box addVerticalSpace.
+    y := box yPosition.
+    component := box addTextLabel:'Package:'.
+    component width:0.4; adjust:#right.
+    box yPosition:y.
+    component := box addInputFieldOn:packageHolder tabable:true.
+    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+    box addVerticalSpace.
+    y := box yPosition.
+    component := box addTextLabel:'Filename:'.
+    component width:0.4; adjust:#right.
+    box yPosition:y.
+    component := box addInputFieldOn:fileNameHolder tabable:true.
+    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+    box addVerticalSpace.
+    box addAbortButton; addOkButton.
+
+    box showAtPointer.
+
+    box destroy.
+    box accepted ifFalse:[
+        ^ false
+    ].
+
+    module := moduleHolder value withoutSpaces.
+    package := packageHolder value withoutSpaces.
+    fileName := fileNameHolder value withoutSpaces.
+
+    (fileName endsWith:',v') ifTrue:[
+        fileName := fileName copyWithoutLast:2
+    ].
+    (fileName endsWith:'.st') ifFalse:[
+        fileName := fileName , '.st'
+    ].
+
+    (mgr checkForExistingContainerInModule:module 
+                                   package:package 
+                                 container:fileName) ifFalse:[
+        self warn:'no such container'.
+        ^ false
+    ].
+
+    aStream := mgr 
+            streamForClass:nil 
+            fileName:fileName 
+            revision:#newest
+            directory:package
+            module:module
+            cache:false.
+
+    aStream isNil ifTrue:[
+        self warn:'could not fileIn from repository'.
+        ^ false.
+    ].
+
+    self busyLabel:'loading from %1' with:(module , '/' , package , '/' , fileName).
+
+    Class withoutUpdatingChangesDo:[
+        [
+            aStream fileIn.
+        ] valueNowOrOnUnwindDo:[
+            aStream close.
+            self normalLabel.
+            Smalltalk changed.
+        ].
+    ].
+
+    ^ false
+
+    "Created: 13.9.1996 / 09:27:09 / cg"
+    "Modified: 13.9.1996 / 09:34:25 / cg"
+!
+
 classLoadRevision
     "load a specific revision into the system - especially useful to
      upgrade a class to the newest revision"
@@ -7643,6 +7765,6 @@
 !BrowserView  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.168 1996-09-11 17:19:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.169 1996-09-13 07:36:32 cg Exp $'
 ! !
 BrowserView initialize!