BrowserView.st
changeset 1506 c41c71b6bf2b
parent 1503 5ad4c77262b1
child 1510 ec5dd071b570
equal deleted inserted replaced
1505:417ccb5b70b7 1506:c41c71b6bf2b
   510                 ]
   510                 ]
   511             ].
   511             ].
   512 
   512 
   513             ((someArgument category = currentClassCategory)
   513             ((someArgument category = currentClassCategory)
   514             or:[currentClassCategory notNil
   514             or:[currentClassCategory notNil
   515                 and:[currentClassCategory startsWith:'*']]) ifTrue:[
   515                 and:[currentClassCategory startsWith:$*]]) ifTrue:[
   516                 self updateClassListWithScroll:false.
   516                 self updateClassListWithScroll:false.
   517             ].
   517             ].
   518 
   518 
   519             someArgument category ~= currentClassCategory ifTrue:[
   519             someArgument category ~= currentClassCategory ifTrue:[
   520                 "
   520                 "
   721 
   721 
   722     (changedObject isMethod) ifTrue:[
   722     (changedObject isMethod) ifTrue:[
   723     ]
   723     ]
   724 
   724 
   725     "Created: / 4.1.1997 / 13:54:00 / cg"
   725     "Created: / 4.1.1997 / 13:54:00 / cg"
   726     "Modified: / 4.3.1998 / 14:46:06 / cg"
   726     "Modified: / 5.3.1998 / 02:46:01 / cg"
   727 !
   727 !
   728 
   728 
   729 refetchClass
   729 refetchClass
   730     "after a class definition change in another browser,
   730     "after a class definition change in another browser,
   731      this is sent to update (otherwise, we'd still refer to the obsolete class)"
   731      this is sent to update (otherwise, we'd still refer to the obsolete class)"
   831     "create a file 'categoryName' consisting of all classes in current category"
   831     "create a file 'categoryName' consisting of all classes in current category"
   832 
   832 
   833     |aStream fileName|
   833     |aStream fileName|
   834 
   834 
   835     self checkClassCategorySelected ifFalse:[^ self].
   835     self checkClassCategorySelected ifFalse:[^ self].
   836     (currentClassCategory startsWith:'*') ifTrue:[
   836     (currentClassCategory startsWith:$*) ifTrue:[
   837         self warn:(resources string:'try a real category').
   837         self warn:(resources string:'try a real category').
   838         ^ self
   838         ^ self
   839     ].
   839     ].
   840 
   840 
   841     fileName := currentClassCategory asString , '.st'.
   841     fileName := currentClassCategory asString , '.st'.
   909         ]
   909         ]
   910     ].
   910     ].
   911     self normalLabel.
   911     self normalLabel.
   912 
   912 
   913     "Created: / 11.10.1997 / 16:38:29 / cg"
   913     "Created: / 11.10.1997 / 16:38:29 / cg"
   914     "Modified: / 28.10.1997 / 14:35:50 / cg"
   914     "Modified: / 5.3.1998 / 02:45:17 / cg"
   915 !
   915 !
   916 
   916 
   917 classCategoryFileOutBinaryEach
   917 classCategoryFileOutBinaryEach
   918     "fileOut each class in the current category as binary bytecode."
   918     "fileOut each class in the current category as binary bytecode."
   919 
   919 
   920     |mode|
   920     |mode|
   921 
   921 
   922     (currentClassCategory startsWith:'*') ifTrue:[
   922     (currentClassCategory startsWith:$*) ifTrue:[
   923 	self warn:(resources string:'try a real category').
   923         self warn:(resources string:'try a real category').
   924 	^ self
   924         ^ self
   925     ].
   925     ].
   926 
   926 
   927     mode := Dialog choose:(resources string:'save including sources ?')
   927     mode := Dialog choose:(resources string:'save including sources ?')
   928 		   labels:(resources array:#('cancel' 'discard' 'by file reference' 'include source'))
   928                    labels:(resources array:#('cancel' 'discard' 'by file reference' 'include source'))
   929 		   values:#(nil #discard #reference #keep)
   929                    values:#(nil #discard #reference #keep)
   930 		   default:#keep.
   930                    default:#keep.
   931 
   931 
   932     mode isNil ifTrue:[^ self].
   932     mode isNil ifTrue:[^ self].
   933 
   933 
   934     self withBusyCursorDo:[
   934     self withBusyCursorDo:[
   935 	self allClassesInCategory:currentClassCategory do:[:aClass |
   935         self allClassesInCategory:currentClassCategory do:[:aClass |
   936 	    aClass isPrivate ifFalse:[
   936             aClass isPrivate ifFalse:[
   937 		(self listOfNamespaces includesIdentical:aClass nameSpace)
   937                 (self listOfNamespaces includesIdentical:aClass nameSpace)
   938 		ifTrue:[
   938                 ifTrue:[
   939 		    self busyLabel:'saving binary of: %1' with:aClass name.
   939                     self busyLabel:'saving binary of: %1' with:aClass name.
   940 		    Class fileOutErrorSignal handle:[:ex |
   940                     Class fileOutErrorSignal handle:[:ex |
   941 			self warn:'cannot create: %1' with:ex parameter.
   941                         self warn:'cannot create: %1' with:ex parameter.
   942 			ex return.
   942                         ex return.
   943 		    ] do:[
   943                     ] do:[
   944 			aClass binaryFileOutWithSourceMode:mode.
   944                         aClass binaryFileOutWithSourceMode:mode.
   945 		    ]
   945                     ]
   946 		]
   946                 ]
   947 	    ]
   947             ]
   948 	].
   948         ].
   949 	self normalLabel.
   949         self normalLabel.
   950     ]
   950     ]
   951 
   951 
   952     "Created: 25.1.1996 / 17:27:45 / cg"
   952     "Created: / 25.1.1996 / 17:27:45 / cg"
   953     "Modified: 18.8.1997 / 15:42:30 / cg"
   953     "Modified: / 5.3.1998 / 02:45:30 / cg"
   954 !
   954 !
   955 
   955 
   956 classCategoryFileOutEach
   956 classCategoryFileOutEach
   957     (currentClassCategory startsWith:'*') ifTrue:[
   957     (currentClassCategory startsWith:$*) ifTrue:[
   958 	self warn:(resources string:'try a real category').
   958         self warn:(resources string:'try a real category').
   959 	^ self
   959         ^ self
   960     ].
   960     ].
   961 
   961 
   962     self withBusyCursorDo:[
   962     self withBusyCursorDo:[
   963 	self allClassesInCategory:currentClassCategory do:[:aClass |
   963         self allClassesInCategory:currentClassCategory do:[:aClass |
   964 	    aClass isPrivate ifFalse:[
   964             aClass isPrivate ifFalse:[
   965 		(self listOfNamespaces includesIdentical:aClass nameSpace)
   965                 (self listOfNamespaces includesIdentical:aClass nameSpace)
   966 		ifTrue:[
   966                 ifTrue:[
   967 		    self busyLabel:'saving: %1' with:aClass name.
   967                     self busyLabel:'saving: %1' with:aClass name.
   968 		    Class fileOutErrorSignal handle:[:ex |
   968                     Class fileOutErrorSignal handle:[:ex |
   969 			self warn:'cannot fileOut: %1\(%2)' with:aClass name with:ex errorString.
   969                         self warn:'cannot fileOut: %1\(%2)' with:aClass name with:ex errorString.
   970 			ex return.
   970                         ex return.
   971 		    ] do:[
   971                     ] do:[
   972 			aClass fileOut
   972                         aClass fileOut
   973 		    ]
   973                     ]
   974 		]
   974                 ]
   975 	    ]
   975             ]
   976 	].
   976         ].
   977 	self normalLabel.
   977         self normalLabel.
   978     ]
   978     ]
   979 
   979 
   980     "Modified: 18.8.1997 / 15:42:35 / cg"
   980     "Modified: / 5.3.1998 / 02:45:38 / cg"
   981 !
   981 !
   982 
   982 
   983 classCategoryFindClass
   983 classCategoryFindClass
   984     "find a class - and switch by default"
   984     "find a class - and switch by default"
   985 
   985 
  3377     "let user specify the source-repository values for aClass"
  3377     "let user specify the source-repository values for aClass"
  3378 
  3378 
  3379     |box className
  3379     |box className
  3380      moduleHolder packageHolder fileNameHolder
  3380      moduleHolder packageHolder fileNameHolder
  3381      oldModule oldPackage oldFileName
  3381      oldModule oldPackage oldFileName
  3382      module package fileName 
  3382      module package fileName nameSpace nameSpacePrefix
  3383      y component info project nm mgr creatingNew msg|
  3383      y component info project nm mgr creatingNew msg|
  3384 
  3384 
  3385     aClass isLoaded ifFalse:[
  3385     aClass isLoaded ifFalse:[
  3386         self warn:'please load the class first'.
  3386         self warn:'please load the class first'.
  3387         ^ false.
  3387         ^ false.
  3431             (info includesKey:#directory) ifTrue:[
  3431             (info includesKey:#directory) ifTrue:[
  3432                 package := (info at:#directory).
  3432                 package := (info at:#directory).
  3433             ].
  3433             ].
  3434         ].
  3434         ].
  3435         fileName := mgr containerFromSourceInfo:info.
  3435         fileName := mgr containerFromSourceInfo:info.
  3436         aClass nameSpace ~~ Smalltalk ifTrue:[
  3436         (nameSpace := aClass nameSpace) ~~ Smalltalk ifTrue:[
  3437             (fileName startsWith:(aClass nameSpace name , '::')) ifTrue:[
  3437             nameSpacePrefix := nameSpace name , '::'.
  3438                 fileName := fileName copyFrom:(aClass nameSpace name , '::') size + 1.
  3438             (fileName startsWith:nameSpacePrefix) ifTrue:[
       
  3439                 fileName := fileName copyFrom:(nameSpacePrefix size + 1).
  3439             ]
  3440             ]
  3440         ].
  3441         ].
  3441 "/        (info includesKey:#fileName) ifTrue:[
  3442 "/        (info includesKey:#fileName) ifTrue:[
  3442 "/            fileName := (info at:#fileName).
  3443 "/            fileName := (info at:#fileName).
  3443 "/        ] ifFalse:[
  3444 "/        ] ifFalse:[
  3713         ^ true
  3714         ^ true
  3714     ].
  3715     ].
  3715     box destroy.
  3716     box destroy.
  3716     ^ false
  3717     ^ false
  3717 
  3718 
  3718     "Modified: / 1.2.1998 / 17:55:45 / cg"
  3719     "Modified: / 5.3.1998 / 02:44:45 / cg"
  3719 !
  3720 !
  3720 
  3721 
  3721 classLoadNewRevision
  3722 classLoadNewRevision
  3722     "let user specify a container and fileIn from there"
  3723     "let user specify a container and fileIn from there"
  3723 
  3724 
  4573      className ownerName s|
  4574      className ownerName s|
  4574 
  4575 
  4575     s := TextStream on:''.
  4576     s := TextStream on:''.
  4576 
  4577 
  4577     isNameSpace ifTrue:[
  4578     isNameSpace ifTrue:[
  4578 	s nextPutAll:'Namespace name:''NewNameSpace'''.
  4579         s nextPutAll:'Namespace name:''NewNameSpace'''.
  4579 	s cr; cr.
  4580         s cr; cr.
  4580 	s emphasis:(self commentEmphasis).
  4581         s emphasis:(self commentEmphasis).
  4581 	s nextPutAll:'"
  4582         s nextPutAll:'"
  4582  Replace ''NewNameSpace'' by the desired name.
  4583  Replace ''NewNameSpace'' by the desired name.
  4583 
  4584 
  4584  Create the namespace by ''accepting'',
  4585  Create the namespace by ''accepting'',
  4585  either via the menu or the keyboard (usually CMD-A).
  4586  either via the menu or the keyboard (usually CMD-A).
  4586 "
  4587 "
  4587 '.
  4588 '.
  4588 	^ s contents.
  4589         ^ s contents.
  4589     ].
  4590     ].
  4590 
  4591 
  4591     withNameSpaceDirective :=
  4592     withNameSpaceDirective :=
  4592 	currentNamespace notNil 
  4593         currentNamespace notNil 
  4593 	and:[currentNamespace ~= '* all *'
  4594         and:[currentNamespace ~= '* all *'
  4594 	and:[currentNamespace ~= Smalltalk]].
  4595         and:[currentNamespace ~= Smalltalk]].
  4595 
  4596 
  4596     withNameSpaceDirective ifTrue:[
  4597     withNameSpaceDirective ifTrue:[
  4597 	className := aSuperClass nameWithoutNameSpacePrefix.
  4598         className := aSuperClass nameWithoutNameSpacePrefix.
  4598 	s nextPutAll:('"{ Namespace: ''' , currentNamespace name , ''' }"').
  4599         s nextPutAll:('"{ Namespace: ''' , currentNamespace name , ''' }"').
  4599 	s cr; cr.
  4600         s cr; cr.
  4600     ] ifFalse:[    
  4601     ] ifFalse:[    
  4601 	className := aSuperClass name.
  4602         className := aSuperClass name.
  4602     ].
  4603     ].
  4603 
  4604 
  4604     cat := categoryString.
  4605     cat := categoryString.
  4605     (cat isNil or:[cat startsWith:'*']) ifTrue:[
  4606     (cat isNil or:[cat startsWith:$*]) ifTrue:[
  4606 	cat := '* no category *'
  4607         cat := '* no category *'
  4607     ].
  4608     ].
  4608 
  4609 
  4609     nameProto := 'NewClass'.
  4610     nameProto := 'NewClass'.
  4610     i := 1.
  4611     i := 1.
  4611     isPrivate ifTrue:[
  4612     isPrivate ifTrue:[
  4612 	namePrefix := currentClass name , '::'.
  4613         namePrefix := currentClass name , '::'.
  4613 	existingNames := currentClass privateClasses.
  4614         existingNames := currentClass privateClasses.
  4614 	existingNames size > 0 ifTrue:[
  4615         existingNames size > 0 ifTrue:[
  4615 	    existingNames := existingNames collect:[:cls | cls name].
  4616             existingNames := existingNames collect:[:cls | cls name].
  4616 	]
  4617         ]
  4617     ] ifFalse:[
  4618     ] ifFalse:[
  4618 	namePrefix := ''.
  4619         namePrefix := ''.
  4619 	existingNames := Smalltalk keys
  4620         existingNames := Smalltalk keys
  4620     ].
  4621     ].
  4621 
  4622 
  4622     name := 'NewClass' , i printString.
  4623     name := 'NewClass' , i printString.
  4623     existingNames notNil ifTrue:[
  4624     existingNames notNil ifTrue:[
  4624 	nameProto := namePrefix , name.
  4625         nameProto := namePrefix , name.
  4625 	[nameProto knownAsSymbol and:[existingNames includes:nameProto asSymbol]] whileTrue:[
  4626         [nameProto knownAsSymbol and:[existingNames includes:nameProto asSymbol]] whileTrue:[
  4626 	    i := i + 1.
  4627             i := i + 1.
  4627 	    name := 'NewClass' , i printString.
  4628             name := 'NewClass' , i printString.
  4628 	    nameProto := namePrefix , name
  4629             nameProto := namePrefix , name
  4629 	].
  4630         ].
  4630     ].
  4631     ].
  4631 
  4632 
  4632     s nextPutAll:className.
  4633     s nextPutAll:className.
  4633 
  4634 
  4634     isPrivate ifTrue:[
  4635     isPrivate ifTrue:[
  4635 	withNameSpaceDirective ifTrue:[
  4636         withNameSpaceDirective ifTrue:[
  4636 	    ownerName := currentClass nameWithoutNameSpacePrefix
  4637             ownerName := currentClass nameWithoutNameSpacePrefix
  4637 	] ifFalse:[
  4638         ] ifFalse:[
  4638 	    ownerName := currentClass name
  4639             ownerName := currentClass name
  4639 	].
  4640         ].
  4640 	s nextPutAll:(' subclass:#' , name  , '
  4641         s nextPutAll:(' subclass:#' , name  , '
  4641 ' , '    instanceVariableNames: ''''
  4642 ' , '    instanceVariableNames: ''''
  4642 ' , '    classVariableNames: ''''
  4643 ' , '    classVariableNames: ''''
  4643 ' , '    poolDictionaries: ''''
  4644 ' , '    poolDictionaries: ''''
  4644 ' , '    privateIn:' , ownerName)
  4645 ' , '    privateIn:' , ownerName)
  4645     ] ifFalse:[
  4646     ] ifFalse:[
  4646 	s nextPutAll:(' subclass:#' , name , '
  4647         s nextPutAll:(' subclass:#' , name , '
  4647 ' , '    instanceVariableNames: ''''
  4648 ' , '    instanceVariableNames: ''''
  4648 ' , '    classVariableNames: ''''
  4649 ' , '    classVariableNames: ''''
  4649 ' , '    poolDictionaries: ''''
  4650 ' , '    poolDictionaries: ''''
  4650 ' , '    category: ''').
  4651 ' , '    category: ''').
  4651 	cat notNil ifTrue:[
  4652         cat notNil ifTrue:[
  4652 	    s nextPutAll: cat
  4653             s nextPutAll: cat
  4653 	].
  4654         ].
  4654 	s nextPutAll: ''''
  4655         s nextPutAll: ''''
  4655     ].
  4656     ].
  4656 
  4657 
  4657     s cr; cr.
  4658     s cr; cr.
  4658     s emphasis:(self commentEmphasis).
  4659     s emphasis:(self commentEmphasis).
  4659     s nextPutAll:'
  4660     s nextPutAll:'
  4671 "
  4672 "
  4672 '.
  4673 '.
  4673 
  4674 
  4674     ^ s contents
  4675     ^ s contents
  4675 
  4676 
  4676     "Created: 23.12.1996 / 12:46:31 / cg"
  4677     "Created: / 23.12.1996 / 12:46:31 / cg"
  4677     "Modified: 29.8.1997 / 01:10:54 / cg"
  4678     "Modified: / 5.3.1998 / 02:45:52 / cg"
  4678 !
  4679 !
  4679 
  4680 
  4680 doClassMenu:aBlock
  4681 doClassMenu:aBlock
  4681     "a helper - check if class is selected and evaluate aBlock
  4682     "a helper - check if class is selected and evaluate aBlock
  4682      while showing waitCursor"
  4683      while showing waitCursor"
 11359 ! !
 11360 ! !
 11360 
 11361 
 11361 !BrowserView class methodsFor:'documentation'!
 11362 !BrowserView class methodsFor:'documentation'!
 11362 
 11363 
 11363 version
 11364 version
 11364     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.371 1998-03-04 16:46:09 cg Exp $'
 11365     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.372 1998-03-05 12:50:05 cg Exp $'
 11365 ! !
 11366 ! !
 11366 BrowserView initialize!
 11367 BrowserView initialize!