How to rename obsolete classes?
Ingo Hohmann
iho at gmx.de
Mon Dec 13 07:01:50 UTC 2004
Hi All,
I'm trying to rename onsolete classes, using the following code snippet,
but I get an "key not found" error in SystemDictionary>>renameClass:as:
SystemNavigation default obsoleteClasses do: [:c |
(c name beginsWith: 'AnObsolete') ifTrue: [
" Transcript show: (c name copyFrom: 3 to: c name size); cr."
c rename: (c name copyFrom: 3 to: c name size).
]
]
renameClass: aClass as: newName
"Rename the class, aClass, to have the title newName."
| oldref i oldName category |
oldName := aClass name.
category := aClass category.
SystemOrganization classify: newName under: aClass category.
SystemOrganization removeElement: aClass name.
" ----------> this is where the error is reported -------->"
oldref := self associationAt: aClass name.
" ---------------------------------------------------------"
self removeKey: aClass name.
oldref key: newName.
self add: oldref. "Old association preserves old refs"
(Array with: StartUpList with: ShutDownList) do:
[:list | i := list indexOf: aClass name ifAbsent: [0].
i > 0 ifTrue: [list at: i put: newName]].
self flushClassNameCache.
SystemChangeNotifier uniqueInstance classRenamed: aClass from:
oldName to: newName inCategory: category
Any ideas how I can get to rename those classes (I'm trying to clean up
the "AnObsolete..." nameing).
Thanks,
Ingo
More information about the Squeak-dev
mailing list
|