'From Squeak3.2 of 22 February 2002 [latest update: #4952] on 18 October 2002 at 5:19:31 pm'! "Change Set: Inspect-rename-tk Date: 18 October 2002 Author: Ted Kaehler When you have an Inspector on a Morph, select the 'extension'. Bring up the menu, and choose 'Inspect property...' This will let you get directly to the properties like balloonText, player, and any other properties you have added. In a DictionaryInspector, rename has been added to the menu. This is especially handy for renaming pictures in ImageImports."! !Inspector methodsFor: 'menu commands' stamp: 'tk 10/18/2002 17:13'! addCollectionItemsTo: aMenu "If the current selection is an appropriate collection, add items to aMenu that cater to that kind of selection" | sel | ((((sel _ self selection) isMemberOf: Array) or: [sel isMemberOf: OrderedCollection]) and: [sel size > 0]) ifTrue: [ aMenu addList: #( ('inspect element...' inspectElement))]. (sel isKindOf: MorphExtension) ifTrue: [ aMenu addList: #( ('inspect property...' inspectElement))].! ! !Inspector methodsFor: 'menu commands' stamp: 'tk 10/18/2002 16:52'! inspectElement | sel selSize countString count | "Create and schedule an Inspector on an element of the receiver's model's currently selected collection." self selectionIndex = 0 ifTrue: [^ self changed: #flash]. ((sel _ self selection) isKindOf: SequenceableCollection) ifFalse: [(sel isKindOf: MorphExtension) ifTrue: [^ sel inspectElement]. ^ sel inspect]. (selSize _ sel size) == 1 ifTrue: [^ sel first inspect]. selSize <= 15 ifTrue: [count _ (SelectionMenu selections: (1 to: selSize) asArray) startUpWithCaption: 'which element?'. count ifNil: [^ self] ifNotNil: [^ (sel at: count) inspect]]. countString _ FillInTheBlank request: 'Which element? (1 - ', selSize printString, ')' initialAnswer: '1'. countString isEmptyOrNil ifTrue: [^ self]. count _ Integer readFrom: (ReadStream on: countString). (count > 0 and: [count <= selSize]) ifTrue: [(sel at: count) inspect] ifFalse: [self beep]! ! !DictionaryInspector methodsFor: 'menu' stamp: 'tk 10/18/2002 16:42'! dictionaryMenu: aMenu ^ aMenu labels: 'inspect copy name references objects pointing to this value refresh view add key rename key remove basic inspect' lines: #( 5 8) selections: #(inspectSelection copyName selectionReferences objectReferencesToSelection calculateKeyArray addEntry renameEntry removeSelection inspectBasic) ! ! !DictionaryInspector methodsFor: 'menu' stamp: 'tk 10/18/2002 16:41'! renameEntry | newKey aKey value | value _ object at: (keyArray at: selectionIndex). newKey _ FillInTheBlank request: 'Enter new key, then type RETURN. (Expression will be evaluated for value.) Examples: #Fred ''a string'' 3+4' initialAnswer: (keyArray at: selectionIndex) printString. aKey _ Compiler evaluate: newKey. object removeKey: (keyArray at: selectionIndex). object at: aKey put: value. self calculateKeyArray. selectionIndex _ keyArray indexOf: aKey. self changed: #inspectObject. self changed: #fieldList. self update! ! !MorphExtension methodsFor: 'other' stamp: 'tk 10/18/2002 17:10'! inspectElement | key obj | "Create and schedule an Inspector on the otherProperties and the named properties." key _ (SelectionMenu selections: self sortedPropertyNames) startUpWithCaption: 'Inspect which property?'. key ifNil: [^ self]. obj _ otherProperties at: key ifAbsent: ['nOT a vALuE']. obj = 'nOT a vALuE' ifTrue: [(self perform: key) inspect] "named properties" ifFalse: [obj inspect]. ! !