'From Squeak3.1alpha of 28 February 2001 [latest update: #4238] on 6 August 2001 at 11:20:13 pm'! "Change Set: DiscardMVCFix-ar Date: 6 August 2001 Author: Andreas Raab Fixes reshaping ParagraphEditor to MouseMenuController. Also introduces a utility for finding methods referencing (now obsolete) globals; evaluate Smalltalk browseObsoleteMethodReferences. "! !SystemDictionary methodsFor: 'housekeeping' stamp: 'ar 8/6/2001 22:50'! browseObsoleteMethodReferences "Open a browser on all referenced behaviors that are obsolete" "Smalltalk browseObsoleteMethodReferences" | list | list _ self obsoleteMethodReferences. self browseMessageList: list name:'Method referencing obsoletes' autoSelect: nil! ! !SystemDictionary methodsFor: 'housekeeping' stamp: 'ar 8/6/2001 22:48'! obsoleteMethodReferences "Smalltalk obsoleteMethodReferences" "Smalltalk browseObsoleteMethodReferences" "Open a browser on all referenced behaviors that are obsolete" | obsClasses obsRefs references | references _ WriteStream on: Array new. obsClasses _ self obsoleteBehaviors. 'Scanning for methods referencing obsolete classes' displayProgressAt: Sensor cursorPoint from: 1 to: obsClasses size during:[:bar| obsClasses keysAndValuesDo:[:index :each| bar value: index. obsRefs _ self pointersTo: each except: obsClasses. obsRefs do:[:ref| "Figure out if it may be a global" ((ref isMemberOf: Association) and:[ref key isKindOf: String "or Symbol"]) ifTrue:[ (self pointersTo: ref) do:[:meth| (meth isKindOf: CompiledMethod) ifTrue:[ meth methodReference ifNotNilDo:[:mref| references nextPut: mref]]]]]]. ]. ^references contents! ! !SystemDictionary methodsFor: 'shrinking' stamp: 'ar 8/6/2001 23:17'! discardMVC "After suitable checks, strip out much of MVC from the system" "Smalltalk discardMVC" | keepers | self flag: #bob. "zapping projects" Smalltalk isMorphic ifFalse: [self inform: 'You must be in a Morphic project to discard MVC.'. ^ self]. "Check that there are no MVC Projects" (Project allProjects allSatisfy: [ :proj | proj isMorphic]) ifFalse: [(self confirm: 'Would you like a chance to remove your MVC projects in an orderly manner?') ifTrue: [^ self]. (self confirm: 'If you wish, I can remove all MVC projects, make this project be the top project, and place all orphaned sub-projects of MVC parents here. Would you like be to do this and proceed to discard all MVC classes?') ifTrue: [self zapMVCprojects] ifFalse: [^ self]]. Smalltalk reclaimDependents. "Remove old Paragraph classes and View classes." Smalltalk at: #Paragraph ifPresent:[:paraClass| (ChangeSet superclassOrder: paraClass withAllSubclasses asArray) reverseDo: [:c | c removeFromSystem]]. Smalltalk at: #View ifPresent:[:viewClass| (ChangeSet superclassOrder: viewClass withAllSubclasses asArray) reverseDo: [:c | c removeFromSystem]]. "Get rid of ParagraphEditor's ScrollController dependence" #(markerDelta viewDelta scrollAmount scrollBar computeMarkerRegion) do: [:sel | ParagraphEditor removeSelector: sel]. ParagraphEditor compile: 'updateMarker'. "Reshape to MouseMenuController" Compiler evaluate: (ParagraphEditor definition copyReplaceAll: 'ScrollController' with: 'MouseMenuController'). "Get rid of all Controller classes not needed by ParagraphEditor and ScreenController" keepers _ TextMorphEditor withAllSuperclasses copyWith: ScreenController. (ChangeSet superclassOrder: Controller withAllSubclasses asArray) reverseDo: [:c | (keepers includes: c) ifFalse: [c removeFromSystem]]. SystemOrganization removeCategoriesMatching: 'ST80-Paths'. SystemOrganization removeCategoriesMatching: 'ST80-Symbols'. SystemOrganization removeCategoriesMatching: 'ST80-Pluggable Views'. Smalltalk removeClassNamed: 'FormButtonCache'. Smalltalk removeClassNamed: 'WindowingTransformation'. Smalltalk removeClassNamed: 'ControlManager'. Smalltalk removeClassNamed: 'DisplayTextView'. ScheduledControllers _ nil. Undeclared removeUnreferencedKeys. SystemOrganization removeEmptyCategories. Symbol rehash. ! !