From VisualWorks®, 7.6 of February 8, 2008 on March 3, 2008 at 9:44:01 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <name>ClipBoard</name> <environment>Tools.Inspector</environment> <private>false</private> <constant>false</constant> <category>As yet unclassified</category> <attributes> <package>Debugger-Tools-Modifications</package> </attributes> <methods> UI.ParagraphEditor <category>private</category>
debug: aCompiledMethod "Open the debugger on the first expression of the argument CompiledMethod. This method partly duplicates the logic of #evaluateCompiled: but it is necessary because of problems with automatic stepping through that method." | doItReceiver doItContext guineaPig context | doItReceiver := self doItReceiver. doItContext := self doItContext. guineaPig := doItContext isNil ifTrue: [[doItReceiver performMethod: aCompiledMethod] newProcess] ifFalse: [[doItReceiver performMethod: aCompiledMethod with: doItContext] newProcess]. "Need to manually push copied values from the closure into the context before stepping because they are not getting pushed during the simulation!" context := guineaPig suspendedContext. context receiver pushCopiedValues: context. [context method == aCompiledMethod] whileFalse: [context := context send]. guineaPig suspendedContext: context. Notifier developmentNotifier openOnProcess: guineaPig interrupted: true label: (#DebugIt << #pdp >> 'Debug It').
</methods> <methods> Tools.OrderedCollectionInspector <category>field list</category>
basicFieldMenu "OrderedCollectionInspector flushMenus" | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Dive << #pdp >> 'Dive') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #diveIntoField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: true. m addLine. m addItem: ((MenuItem labeled: (#InsertDots << #pdp >> 'Insert...')) nameKey: #addField; value: #addField). m addItem: ((MenuItem labeled: (#Remove << #pdp >> 'Remove')) nameKey: #removeField; value: #removeField). ^m
noSelectionMenu "Answer a Menu of operations on the variables that is to be displayed when the operate menu button is pressed." | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: true. m addLine. m addItem: ((MenuItem labeled: (#AddLast << #pdp >> 'Add Last')) nameKey: #addField; value: #addField). ^m
</methods> <methods> Tools.OrderedCollectionInspector <category>private-menu messages</category>
removeField InputState default shiftDown ifFalse: [(Dialog confirm: (#AreYouSureYouWantToRemoveSelected << #pdp >> 'Are you sure you want to remove the selected object?')) ifFalse: [^self]]. self fieldIndex isNil ifTrue: [^self]. object removeAtIndex: self fieldIndex. self resetFields
</methods> <methods> Tools.PoolDictionaryInspector <category>menu commands</category>
addField | aString key | aString := Dialog request: (#EnterKeyAsASmalltalkConstant << #pdp >> 'Enter key as a Smalltalk constant') for: self interfaceWindow. aString isEmpty ifTrue: [^self]. key := [Object evaluatorClass evaluate: aString] on: Object errorSignal do: [:ex | Dialog warn: ((#ErrorDuringEval1sReenter << #pdp >> 'Error during evaluation:<n> "<1s>"<n>please reenter the key as a Smalltalk constant') expandMacrosWith: ex errorString) for: self interfaceWindow. ex return: nil]. key == nil ifTrue: [^nil]. object at: key put: nil. field := key. self resetFields
</methods> <methods> Tools.CompiledCodeInspector <category>text</category>
text "Answer the text displayed by the receiver for the current selection." field == nil ifTrue: [^Text new]. self isSourceCode ifTrue: [^self sourceCodeText]. self isSymbolic ifTrue: [^self inspectMethod symbolic]. ^super text
</methods> <methods> Tools.ContextInspector <category>doIt/accept</category>
acceptText: aText from: aController "Text has been changed. Store or compile the text, depending on the current mode of the receiver." | val | (field == nil) | (field = 'self') ifTrue: [^ false]. val := self evaluateText: aText string from: aController ifFail: [^ false]. object put: val intoTempVar: (field at: 2). self resetText. ^ true
</methods> <methods> Tools.ContextInspector <category>field list</category>
basicUtilsMenu | m | m := Menu new. self addMenuLabels: (Array with: (#Browse << #pdp >> 'Browse') with: (#BasicInspect << #pdp >> 'Basic Inspect') with: (#Owners << #pdp >> 'Owners') with: (#ReferencePath << #pdp >> 'Reference Path')) values: #(browseField basicInspectField ownersOfField findReferencePath) toMenu: m. ^m
fieldIndex "Answer the offset corresponding to the currently selected field." ^properties at: #tempIndex ifAbsent: [0].
fieldList | names | names := object == nil ifTrue: [Array new] ifFalse: [object pdpSlotAccessors]. properties at: #tempNames put: names. ^names collect: [:a | a at: 1]
fieldMenu "Answer a Menu of operations on variables that is to be displayed when the operate menu button is pressed." | m mi | field == nil ifTrue: [^nil]. m := Menu new. m addItem: ((MenuItem labeled: (#Inspect << #pdp >> 'Inspect')) nameKey: #inspectField; value: #inspectField). mi := (MenuItem labeled: (#Utils << #pdp >> 'Utils')) nameKey: #utils. mi submenu: self basicUtilsMenu. m addItem: mi. self addClipBoardFieldsToMenu: m withPaste: true. ^m
fieldValue "field = 'self' ifTrue: [^ object receiver]." ^object getTempVar: (field at: 2)
</methods> <methods> Tools.ContextInspector <category>private</category>
getAndSetNewList | list | list := self fieldList. [fieldList selectionIndexHolder retractInterestsFor: self. fieldList list: list asList.] valueNowOrOnUnwindDo: [fieldList selectionIndexHolder onChangeSend: #changedSelectedField to: self]. ^list
newObject: anObject "Replace the selected object with anObject." object put: anObject intoTempVar: (field at: 2).
resetFields | list tempIndex | tempIndex := self fieldIndex. list := self getAndSetNewList. tempIndex := (tempIndex isNil or: [tempIndex = 0 or: [list size < tempIndex or: [(list at: tempIndex) ~= (field at: 1)]]]) ifTrue: [0] ifFalse: [tempIndex]. properties at: #tempIndex put: tempIndex. fieldList selectionIndexHolder value: tempIndex.
</methods> <methods> Tools.SequenceableCollectionInspector <category>private</category>
newObject: anObject "Replace the selected object with anObject." object at: self fieldIndex put: anObject.
</methods> <methods> Tools.DictionaryInspector <category>field list</category>
basicFieldMenu "DictionaryInspector flushMenus" | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Dive << #pdp >> 'Dive') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #diveIntoField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: true. m addLine. self addMenuLabels: (Array with: (#References << #pdp >> 'References') with: (#AddFieldDots << #pdp >> 'Add Field...') with: (#Remove << #pdp >> 'Remove')) values: #(#browseReferences #addField #removeField) toMenu: m. ^m
</methods> <methods> Tools.DictionaryInspector <category>private</category>
newObject: anObject "Replace the selected object with anObject." object at: field put: anObject.
</methods> <methods> Tools.DictionaryInspector <category>field list</category>
noSelectionMenu "Answer a Menu of operations on the variables that is to be displayed when the operate menu button is pressed." | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: false. m addLine. m addItem: ((MenuItem labeled: (#AddField << #pdp >> 'Add Field')) nameKey: #addField; value: #addField). ^m
</methods> <methods> Tools.Inspector class <category>class initialization</category>
initialize DefaultNumberOfFields := 40. ClipBoard isNil ifTrue: [ClipBoard := WeakArray new: 1]. self flushMenus.
</methods> <methods> Tools.Inspector <category>private</category>
addClipBoardFieldsToMenu: aMenu withPaste: aBool aMenu addLine; addItem: ((MenuItem labeled: (#Copy << #pdp >> 'Copy')) nameKey: #copyField; value: #copyField). aBool ifTrue: [aMenu addItem: ((MenuItem labeled: (#Paste << #pdp >> 'Paste')) nameKey: #pasteField; value: #pasteField)]. aMenu addItem: ((MenuItem labeled: (#Compare << #pdp >> 'Compare')) nameKey: #compareField; value: #compareField).
addMenuLabels: labels values: values toMenu: aMenu labels with: values do: [:label :value | aMenu addItem: ((MenuItem labeled: label) nameKey: value; value: value; yourself)].
</methods> <methods> Tools.Inspector <category>field list</category>
basicFieldMenu "Inspector flushMenus" | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Dive << #pdp >> 'Dive') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #diveIntoField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: true. ^m
</methods> <methods> Tools.Inspector <category>text</category>
basicObjectPrintString: anObject | aStream | aStream := WriteStream on: (String new: 16). aStream nextPutAll: (((self _objectClass: anObject) name at: 1) isVowel ifTrue: ['an '] ifFalse: ['a ']). aStream print: (self _objectClass: anObject). ^aStream contents
</methods> <methods> Tools.Inspector <category>private</category>
clipBoard | val | val := ClipBoard at: 1. val == 0 ifFalse: [^val]. ClipBoard at: 1 put: nil. ^nil
</methods> <methods> Tools.Inspector <category>private-menu messages</category>
compareField | test | test := self fieldValue == self clipBoard ifTrue: [(#FieldTheSameAsClipboard << #pdp >> 'The selected field is the same as the clipboard.')] ifFalse: [self fieldValue = self clipBoard ifTrue: [(#FieldEqualToClipboard << #pdp >> 'The selected field is equal to the clipboard.')] ifFalse: [(#FieldNotEqualToClipboard << #pdp >> 'The selected field is not equal to the clipboard.')]]. Dialog warn: test
copyField ClipBoard at: 1 put: self fieldValue.
inspectField InputState default shiftDown ifTrue: [self fieldValue basicInspect] ifFalse: [self fieldValue inspect].
</methods> <methods> Tools.Inspector <category>private</category>
newObject: anObject "Replace the selected object with anObject." field first isDigit ifTrue: [object basicAt: self fieldIndex put: anObject] ifFalse: [object instVarAt: self fieldIndex put: anObject].
</methods> <methods> Tools.Inspector <category>field list</category>
noSelectionMenu "Inspector flushMenus" | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Pop << #pdp >> 'Pop') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #pop #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: false. ^m
</methods> <methods> Tools.Inspector <category>private-menu messages</category>
ownersOfField "Inspect all who have a reference to the field object. Do not include references generated by the reference gathering process!" (self fieldValue allOwners reject: [:each | "don't include the object under inspection (it always contains the field object)" each == object "don't include the methods that got us here" or: [(each class == MethodContext and: [each selector == #allOwners or: [each selector == #allOwnersWeakly:]]) "don't include the stack array with a temporary variable containing the object" or: [each class == Array and: [each size = 12 and: [each first == false and: [(each at: 2) == self fieldValue]]]]]]) inspect
pasteField field = 'self' ifTrue: [^Dialog warn: (#SorryCantPasteSelf << #pdp >> 'Sorry, can''t paste ''self''')]. (InputState default shiftDown or: [Dialog confirm: (#AreYouSureYouWantToPaste << #pdp >> 'Are you sure you want to paste?').]) ifFalse: [^self]. self newObject: self clipBoard. self resetText.
</methods> <methods> Tools.Inspector <category>text</category>
protectedBasicObjectPrintString: anObject ^[self basicObjectPrintString: anObject] on: Error do: [:ex | #ErrorPrintingTheObject << #labels >> 'Error printing the object']
</methods> <methods> Tools.Inspector <category>private</category>
resetFieldsForDebugger | list | list := self fieldList. self printItems ifTrue: [list := list collect: [:e | e printString]]. list := list asList. list = fieldList list ifTrue: [^self resetText]. fieldList list: list asList
</methods> <methods> Tools.Inspector <category>initialize-release</category>
setObject: anObject history := nil. object := anObject.
</methods> <methods> Tools.Inspector <category>text</category>
text "Answer the text displayed by the receiver." | string | field == nil ifTrue: [^Text new]. string := [ [field = 'self' ifTrue: [self fieldValue inspectString] ifFalse: [self fieldValue printString]] valueWithinSeconds: 5000 orDo: [self basicObjectPrintString: self fieldValue]] on: Error , BreakInterrupt do: [:ex | self protectedBasicObjectPrintString: self fieldValue]. ^string asText
</methods> <methods> Tools.Inspector <category>private-reflection protocol</category>
_objectClass: anObject "Answer the object which is the argument's class.." <primitive: 211> ^self primitiveFailed
</methods> <methods> Tools.PrimitiveObjectInspector <category>field list</category>
fieldMenu | m | m := Menu new. self addMenuLabels: (Array with: (#Inspect << #pdp >> 'Inspect') with: (#Utils << #pdp >> 'Utils')) values: #(#inspectField #utils) toMenu: m. (m atNameKey: #utils) value: nil; submenu: self basicUtilsMenu. self addClipBoardFieldsToMenu: m withPaste: true. ^m
</methods> <initialize> Tools.Inspector </initialize> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>ParagraphEditor</name> <environment>UI</environment> <super>UI.ControllerWithMenu</super> <private>false</private> none beginTypeInIndex anchorIndex emphasisHere dispatchTable charComposer textHasChanged feelPolicy supportCodeEditingFeels localMenuItems extendingDown <imports> private Graphics.TextConstants.* </imports> <category>UIBasics-Support</category> <attributes> <package>UIBasics-Support</package> </attributes> </class> <class> <name>Inspector</name> <environment>Tools</environment> <super>UI.ApplicationModel</super> <private>false</private> none object field fieldList properties history showAllFields <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>DictionaryInspector</name> <environment>Tools</environment> <super>Tools.Inspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>SequenceableCollectionInspector</name> <environment>Tools</environment> <super>Tools.Inspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>OrderedCollectionInspector</name> <environment>Tools</environment> <super>Tools.SequenceableCollectionInspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>ContextInspector</name> <environment>Tools</environment> <super>Tools.Inspector</super> <private>false</private> none <imports></imports> <category>Tools-Programming</category> <attributes> <package>Tools-Programming</package> </attributes> </class> <class> <name>PoolDictionaryInspector</name> <environment>Tools</environment> <super>Tools.DictionaryInspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>PrimitiveObjectInspector</name> <environment>Tools</environment> <super>Tools.Inspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class> <class> <name>CompiledCodeInspector</name> <environment>Tools</environment> <super>Tools.Inspector</super> <private>false</private> none <imports></imports> <category>Tools-Inspector</category> <attributes> <package>Tools-Inspector</package> </attributes> </class>