From VisualWorks®, 7.6 of February 8, 2008 on March 3, 2008 at 9:44:10 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.'] <methods> Refactory.Browser.CodeTool <category>testing</category>
areProbeCommandsLegal ^false
</methods> <methods> Refactory.Browser.AddMethodChange <category>private</category>
executeNotifying: aBlock | undo oldMethod tool | undo := self asUndoOperation. undo notNil ifTrue: [undo name: self name. oldMethod := undo method]. self primitiveExecute. aBlock value. PDPManager reinsertProbesAfterMethod: self method recompileFor: source asText. controller notNil ifTrue: [tool := controller performer]. PDPManager changedMethodFrom: oldMethod to: self method by: tool. ^undo
</methods> <methods> Refactory.Browser.AddMethodChange <category>accessing</category>
method | co | self selector == #unknown ifTrue: [^nil]. co := self changeObject. co ifNil: [^nil]. ^co compiledMethodAt: self selector ifAbsent: [nil]
</methods> <methods> Refactory.Browser.BrowserNavigator <category>class probes</category>
allProbedMethodsInClass ^self selectedClass methodDictionary values select: [:meth | meth isProbed].
</methods> <methods> UI.MenuAutomaticGenerator <category>generating</category>
submenu: label nameKey: key enablement: enablement menu: menuIDs position: position "If the method is to be inserted into our menu, create a MenuItem, otherwise answer nil." | realLabel | menuIDs first = menuName ifFalse: [^nil]. realLabel := self decodeLabel: label. ^Array with: ((MenuItem labeled: realLabel) nameKey: key; enablement: enablement; submenu: Menu new) with: (menuIDs copyFrom: 2 to: menuIDs size) with: position
</methods> <methods> Refactory.Browser.RefactoringBrowser <category>testing</category>
areProbeCommandsLegal ^self codeTool tool areProbeCommandsLegal
isClassSelected ^navigator isClassSelected
</methods> <methods> Refactory.Browser.RemoveMethodChange <category>accessing</category>
method ^nil
</methods> <methods> Refactory.Browser.BrowserCodeTool class <category>instance creation</category>
new | browser | browser := super new. PDPManager notifyOnMethodChanged: browser. ^browser "Smalltalk Professional Debug Package Version 2.6 (c) 2001 Crafted Smalltalk"
</methods> <methods> Refactory.Browser.BrowserCodeTool <category>probes</category>
areProbeCommandsLegal ^self selectors size = 1
basicReinsertProbesAndIndices: probesAndIndices into: probedMethod | probesInError | probesInError := OrderedCollection new. probesAndIndices do: [:ac | | probe index newRecord | probe := ac key baseParent copy. index := ac value. newRecord := probedMethod probeRecordFor: (index to: index). probe record: newRecord. (probe updateTempVarIndexForMethod: probedMethod) ifTrue: [probedMethod addProbe: probe] ifFalse: [newRecord updateMethod: probedMethod. "update mclass and selector for reporting" probesInError add: probe]]. probesInError addAll: probedMethod recompileProbes. ProbedCompiledMethod reportOnFailedProbes: probesInError.
basicRemoveProbe: aProbe | probedMethod replacementMethod | probedMethod := self selectedMethod. probedMethod totalProbes = 1 ifTrue: [^probedMethod revert]. replacementMethod := probedMethod newFullProbedMethod. replacementMethod removeProbe: aProbe. probedMethod mclass addSelector: self selector withMethod: replacementMethod.
changedMethodFrom: oldMethod to: newMethod by: aBrowser "This message notifies the receiver that the method text for aSelector has changed and should be updated." | widget | builder isNil ifTrue: [^self]. widget := builder componentAt: #textEditor. widget isNil ifTrue: [^self]. widget isOpen ifFalse: [^self]. (newMethod selector == self selector and: [newMethod mclass == self methodClass]) ifFalse: [^self]. (aBrowser ~~ self and: [self isEditing]) ifTrue: [self textNoChange: self text allItalic] ifFalse: [self updateContents].
findSelectedProbeEmphasisIn: aText from: aController ^PDPManager findSelectedProbeEmphasisIn: (aText copyFrom: aController selectionStartIndex to: aController selectionStopIndex + 1)
makeProbeTyped: probeType using: aProbeRecord at: selectionRange method: probedMethod "Prompts the user to select a probe and returns an Association where the key is the probe and the value is the conditional flag." | probe probeRecord | probeRecord := aProbeRecord isNil ifTrue: [probedMethod probeRecordFor: selectionRange] ifFalse: [aProbeRecord]. probeType == #Breakpoint ifTrue: [probe := CodeProbe new]. probeType == #Variable ifTrue: [probe := self promptForProbeVariableClass: self selectedClass method: probedMethod record: probeRecord. probe isNil ifTrue: [^nil]]. probeType == #Expression ifTrue: [probe := DisplayActionProbe new]. probe record: probeRecord. ^probe
promptForProbeVariableClass: aClass method: probedMethod record: probeRecord "Prompts the user to select a probe and returns an Association where the key is the probe and the value is the conditional flag." | legalTempNames legalTemps ivarNames dialog aBuilder ivar tmpVar windoe wVar varType | windoe := self interfaceWindow. wVar := ValueHolder newString. legalTemps := OrderedCollection new. (probedMethod variableMapAt: probeRecord blockMethodIndex) temps do: [:var | (var key first == $. or: [legalTemps contains: [:lvar | lvar key = var key]]) ifFalse: [legalTemps add: var]]. legalTempNames := legalTemps collect: [:ac | ac key]. ivarNames := aClass allInstVarNames. dialog := SimpleDialog new. dialog initializeBuilderFor: windoe. aBuilder := dialog builder. aBuilder aspectAt: #TOS put: [varType := #tos. wVar value: 'Top of Stack']. aBuilder aspectAt: #iVar put: [ivar := (Menu labelArray: ivarNames values: ivarNames) startUp. ivar ~~ 0 ifTrue: [wVar value: ivar. varType := #inst]]. aBuilder aspectAt: #tVar put: [tmpVar := (Menu labelArray: legalTempNames values: legalTemps) startUp. tmpVar ~~ 0 ifTrue: [wVar value: tmpVar key. varType := #tmp]]. aBuilder aspectAt: #wVar put: wVar. dialog builder add: (UISpecification from: self class watchVarSpec). dialog initializeWindowFor: windoe. ivarNames isEmpty ifTrue: [(aBuilder componentAt: #IvarSwitch) disable]. legalTemps isEmpty ifTrue: [(aBuilder componentAt: #TempSwitch) disable]. dialog preOpen. dialog builder openDialogWithExtent: dialog builder window displayBox extent. dialog accept value ifFalse: [^nil]. varType == nil ifTrue: [^nil]. varType == #tos ifTrue: [^DisplayTOSProbe new]. varType == #inst ifTrue: [^DisplayInstanceVarProbe name: ivar index: (ivarNames indexOf: ivar)]. ^DisplayMethodVarProbe slot: tmpVar
selectedMethod ^self methodClass compiledMethodAt: self selector
validateProbeMenuItemsInMenu: aMenu | enableProbes | enableProbes := self areProbeCommandsLegal. #(insertBreakpoint insertProbe modifyProbe removeProbeMenu) do: [:each | (aMenu atNameKey: each) enabled: enableProbes]
</methods> <methods> Refactory.Browser.RefactoryChange <category>accessing</category>
method ^nil
</methods> <methods> Refactory.Browser.RBActionDispatcher <category>testing-code tools</category>
areProbeCommandsLegal ^self selector notNil
</methods> <methods> Refactory.Browser.BrowserNavigator <category>class probes</category>
addClassProbesMenu <submenu: #(#AddClassProbe #pdp 'Add Class Probe') nameKey: #addClassProbesMenu enablement: #isClassSelected menu: #(#classMenu) position: 75.1> ^self
addIvarRefProbe <menuItem: #(#OnInstanceVarableAccessDots #pdp 'On Instance Variable Access...') nameKey: nil menu: #(#classMenu #addClassProbesMenu) position: 10.1> PDPInstrumenterGUIModel instrumentIvarsIn: self selectedClass.
addMsgRcvdProbe <menuItem: #(#OnMessageReceipt #pdp 'On Message Receipt...') nameKey: nil menu: #(#classMenu #addClassProbesMenu) position: 10.2> PDPInstrumenterGUIModel instrumentMsgRcvdIn: self selectedClass.
</methods> <methods> Refactory.Browser.BrowserNavigator <category>method probes</category>
addMsgRcvdProbeToMethods <menuItem: #(#AddProbeOnMessageDot #pdp 'Add Probe on Message...') nameKey: nil enablement: #isSelectorSelected indication: nil menu: #(#selectorMenu) position: 55.1 > | methColl | methColl := self methodDefinitions collect: [:md | md implementingClass -> md selector]. PDPInstrumenterGUIModel instrumentMsgRcvdOnList: methColl.
</methods> <methods> Refactory.Browser.BrowserNavigator <category>class probes</category>
browseProbedMethods "Open a method browser on all the probed methods belonging to the selected class." <menuItem: #(#BrowseProbedMethods #pdp 'Browse Probed Methods') nameKey: #browseProbedMethods enablement: #isClassSelected indication: nil menu: #(#classMenu ) position: 75.3> ^MethodCollector new openListBrowserOn: (self allProbedMethodsInClass collect: [:meth | MethodDefinition class: meth mclass selector: meth selector]) label: (#ProbedMethods << #pdp >> 'Probed Methods') initialSelection: nil
removeClassProbes <menuItem: #(#FromThisClassOnly #pdp 'From This Class Only') nameKey: nil menu: #(#classMenu #removeClassProbesMenu) position: 10.1> (Dialog choose: ((#ThisWillRemoveAllProbesFromClassMethods << #pdp >> 'This will remove all the probes from<n>the methods belonging to class <1s>') expandMacrosWith: self selectedClass name) labels: (Array with: (#Proceed << #pdp >> 'Proceed') with: (#Cancel << #pdp >> 'Cancel')) values: #(true false) default: false) ifFalse: [^self]. self selectedClass methodDictionary do: [:meth | meth revert].
removeClassProbesMenu <submenu: #(#removeClassProbes #pdp 'Remove Class Probes') nameKey: #removeClassProbesMenu enablement: #isClassSelected menu: #(#classMenu) position: 75.2> ^self
removeProbesInClassTree <menuItem: #(#FromThisClassAndSubclasses #pdp 'From This Class and Subclasses') nameKey: nil menu: #(#classMenu #removeClassProbesMenu) position: 10.2> (Dialog choose: ((#ThisWillRemoveAllProbesFromClass1sAndSubs << #pdp >> 'This will remove all the probes from the methods<n>belonging to class <1s> and its subclasses.') expandMacrosWith: self selectedClass name) labels: (Array with: (#Proceed << #pdp >> 'Proceed') with: (#Cancel << #pdp >> 'Cancel')) values: #(true false) default: false) ifFalse: [^self]. self selectedClass withAllSubclasses do: [:cl | cl methodDictionary do: [:meth | meth revert]].
</methods> <methods> Refactory.Browser.BrowserCodeTool class <category>interface specs</category>
watchVarSpec "Tools.UIPainter new openOnClass: self andSelector: #watchVarSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: #(#{Kernel.UserMessage} #key: #InsertVariableWatch #defaultString: 'Insert Variable Watch' #catalogID: #pdp ) #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 0 0 ) #bounds: #(#{Graphics.Rectangle} 720 450 1237 595 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 318 98 407 128 ) #model: #accept #tabable: false #label: #(#{Kernel.UserMessage} #key: #OK #defaultString: 'OK' #catalogID: #pdp ) #defaultable: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 419 98 504 128 ) #model: #cancel #tabable: false #label: #(#{Kernel.UserMessage} #key: #Cancel #defaultString: 'Cancel' #catalogID: #pdp ) #defaultable: true ) #(#{UI.InputFieldSpec} #layout: #(#{Graphics.Rectangle} 143 55 503 82 ) #model: #wVar #tabable: false #isReadOnly: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 9 20 132 49 ) #model: #TOS #tabable: false #label: #(#{Kernel.UserMessage} #key: #TopOfStack #defaultString: 'Top of Stack' #catalogID: #pdp ) #defaultable: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 143 19 332 49 ) #name: #IvarSwitch #model: #iVar #tabable: true #label: #(#{Kernel.UserMessage} #key: #InstanceVariableDots #defaultString: 'Instance Variable...' #catalogID: #pdp ) #defaultable: true ) #(#{UI.ActionButtonSpec} #layout: #(#{Graphics.Rectangle} 342 19 503 50 ) #name: #TempSwitch #model: #tVar #tabable: false #label: #(#{Kernel.UserMessage} #key: #TempVariableDots #defaultString: 'Temp Variable...' #catalogID: #pdp ) #defaultable: true ) #(#{UI.LabelSpec} #layout: #(#{Core.Point} 14 61 ) #name: #Label1 #label: #(#{Kernel.UserMessage} #key: #WatchC #defaultString: 'Watch:' #catalogID: #pdp ) ) ) ) )
</methods> <methods> Refactory.Browser.BrowserCodeTool <category>probes</category>
addBreakpoint <menuItem: #(#NewBreakpoint #pdp 'Insert Breakpoint') nameKey: #insertBreakpoint enablement: #areProbeCommandsLegal indication: nil menu: #(#mainMenu) position: 25.1> | probedMethod unprobedMethod probe aController | aController := self textController. self selector isNil ifTrue: [^Dialog warn: (#InsertBreakpointNeedsMethodSelection << #pdp >> 'The "insert breakpoint" operation is only valid when a method is selected.')]. aController textHasChanged ifTrue: [^Dialog warn: ((#BreakpointCannotBeInsertedCodeChanged << #pdp >> 'A breakpoint cannot be inserted because<1s> the source code has changed.') expandMacrosWith: (String with: Character cr))]. unprobedMethod := self selectedMethod. probedMethod := unprobedMethod newFullProbedMethod. probedMethod isNil ifTrue: [^self]. PDPManager debugActive ifFalse: [PDPTransientWarning on: (#ProbesAreDisabled << #pdp >> 'Probes are disabled')]. probe := CodeProbe new. probe record: (probedMethod probeRecordFor: aController selectionRange). probedMethod addProbe: probe. probe unconditionallyInsertInto: probedMethod replacing: unprobedMethod.
addProbe <menuItem: #(#NewProbeDots #pdp 'Insert Probe...') nameKey: nil enablement: #areProbeCommandsLegal indication: nil menu: #(#mainMenu) position: 25.2> | probedMethod unprobedMethod probe probeSpec aController | aController := self textController. self selector isNil ifTrue: [^Dialog warn: (#InsertProbeValidWhenMethodSelected << #pdp >> 'The "insert probe" operation is only valid when a method is selected.')]. aController textHasChanged ifTrue: [^Dialog warn: ((#ProbeCannotBeInsertedSourceChanged << #pdp >> 'A probe cannot be inserted because<1s> the source code has changed.') expandMacrosWith: (String with: Character cr))]. probeSpec := CodeProbe selectBrowserProbeType. probeSpec == nil ifTrue: [^nil]. unprobedMethod := self selectedMethod. probedMethod := unprobedMethod newFullProbedMethod. probedMethod isNil ifTrue: [^self]. PDPManager debugActive ifFalse: [PDPTransientWarning on: (#ProbesAreDisabled << #pdp >> 'Probes are disabled')]. probe := self makeProbeTyped: probeSpec probeClass using: nil at: aController selectionRange method: probedMethod. probe isNil ifTrue: [^self]. probedMethod addProbe: probe. probe makeConditional: probeSpec replacing: unprobedMethod with: probedMethod
modifyProbe <menuItem: #(#EditSelectedProbeDots #pdp 'Edit Selected Probe...') nameKey: nil enablement: #areProbeCommandsLegal indication: nil menu: #(#mainMenu) position: 25.3> | emphasis probedMethod aController | aController := self textController. self selector isNil ifTrue: [^Dialog warn: (#ThisOperationValidWhenMethodSelected << #pdp >> 'This operation is only valid when a method is selected.')]. probedMethod := self selectedMethod. probedMethod isProbed ifFalse: [^aController view invalidate]. emphasis := self findSelectedProbeEmphasisIn: aController text from: aController. emphasis isNil ifTrue: [^Dialog warn: (#ReselectBreakpointAndReissue << #pdp >> 'Reselect breakpoint and reissue command.')]. emphasis value modifyIn: probedMethod
removeAllProbes <menuItem: #(#RemoveAllProbes #pdp 'Remove All Probes') nameKey: nil enablement: #areProbeCommandsLegal indication: nil menu: #(#mainMenu) position: 25.5> "Removes all the probes by reverting the probed compiled method back to its original unprobed method." | probedMethod aController | aController := self textController. self selector isNil ifTrue: [^Dialog warn: (#RemoveProbeValidWhenMethodSelected << #pdp >> 'The "remove probe" operation is only<n>valid when a method is selected.') expandMacros]. aController textHasChanged ifTrue: [(Dialog choose: (#RemovingProbesWillLoseChangesWhatToDo << #pdp >> 'Removing the probes will result in losing your changes. What do you want do?') labels: (Array with: (#RemoveProbes << #pdp >> 'Remove Probes') with: (#Cancel << #pdp >> 'Cancel')) values: #(true false) default: false) ifFalse: [^self]]. probedMethod := self selectedMethod. probedMethod isProbed ifFalse: [^aController view invalidate]. probedMethod mclass addSelector: self selector withMethod: probedMethod originalMethod. ObjectMemory compactingGC. PDPManager changedMethodFrom: probedMethod to: probedMethod originalMethod by: self.
removeProbe <menuItem: #(#RemoveSelectedProbe #pdp 'Remove Selected Probe') nameKey: nil enablement: #areProbeCommandsLegal indication: nil menu: #(#mainMenu) position: 25.4> | emphasis probedMethod aController | aController := self textController. self selector isNil ifTrue: [^Dialog warn: (#ThisOperationValidWhenMethodSelected << #pdp >> 'This operation is only valid when a method is selected.')]. aController textHasChanged ifTrue: [(Dialog choose: (#RemovingProbeWillLoseChangesWhatToDo << #pdp >> 'Removing the probe will result in losing your changes. What do you want do?') labels: (Array with: (#RemoveProbe << #pdp >> 'Remove Probe') with: (#Cancel << #pdp >> 'Cancel')) values: #(true false) default: false) ifFalse: [^self]]. probedMethod := self selectedMethod. probedMethod isProbed ifFalse: [^aController view invalidate]. emphasis := self findSelectedProbeEmphasisIn: aController text from: aController. emphasis isNil ifTrue: [^Dialog warn: (#ReselectBreakpointAndReissue << #pdp >> 'Reselect breakpoint and reissue command.')]. self basicRemoveProbe: emphasis value. "The following is necessary because apparently the method cache is not completely flushed." ObjectMemory compactingGC. PDPManager changedMethodFrom: probedMethod to: probedMethod by: self.
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>RefactoryChange</name> <environment>Refactory.Browser</environment> <super>Core.Object</super> <private>false</private> none name <imports></imports> <category>Browser-Change Objects</category> <attributes> <package>Browser-ChangeObjects</package> </attributes> </class> <class> <name>RBActionDispatcher</name> <environment>Refactory.Browser</environment> <super>Core.Object</super> <private>false</private> none objects <imports></imports> <category>Browser-Commands</category> <attributes> <package>Browser-BaseUI</package> </attributes> </class> <class> <name>RefactoringBrowser</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.BrowserApplicationModel</super> <private>false</private> none navigator policyClass dispatcher findHolder findList toolbarMenuHolder toolsetsList showToolbarHolder <imports></imports> <category>Browser-RB UI</category> <attributes> <package>Browser-BrowserUI</package> </attributes> </class> <class> <name>CodeTool</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.BrowserApplicationModel</super> <private>false</private> none codeModel menu <imports></imports> <category>Browser-Code Tools</category> <attributes> <package>Browser-BrowserUI</package> </attributes> </class> <class> <name>AddMethodChange</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.RefactoryObjectChange</super> <private>false</private> none source selector protocols parcels controller definedSelector package <imports></imports> <category>Browser-Change Objects</category> <attributes> <package>Browser-ChangeObjects</package> </attributes> </class> <class> <name>BrowserNavigator</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.Navigator</super> <private>false</private> none navigatorType cachedSelectors windowLabel navigatorSpecBlocks dependents <imports> Store.* </imports> <category>Browser-Navigator</category> <attributes> <package>Browser-BrowserUI</package> </attributes> </class> <class> <name>RemoveMethodChange</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.RefactoryObjectChange</super> <private>false</private> none selector <imports></imports> <category>Browser-Change Objects</category> <attributes> <package>Browser-ChangeObjects</package> </attributes> </class> <class> <name>BrowserCodeTool</name> <environment>Refactory.Browser</environment> <super>Refactory.Browser.BrowserTextTool</super> <private>false</private> none modified initialLookPrefs <imports></imports> <category>Browser-Code Tools</category> <attributes> <package>Browser-BrowserUI</package> </attributes> </class> <class> <name>MenuAutomaticGenerator</name> <environment>UI</environment> <super>Core.Object</super> <private>false</private> none menuName menuDefiner messageSelector <imports></imports> <category>Interface-Menus</category> <attributes> <package>Interface-Menus</package> </attributes> </class>