'From Squeak6.0alpha of 11 April 2018 [latest update: #17884] on 12 April 2018 at 2:52:10 pm'!
AbstractHierarchicalList subclass: #ObjectExplorer
	instanceVariableNames: 'root currentParent inspector monitorList expression context rootName '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Tools-Explorer'!

!Debugger methodsFor: 'context stack (message list)' stamp: 'mt 4/12/2018 14:50'!
expandStack
	"A Notifier is being turned into a full debugger.  Show a substantial amount of stack in the context pane."

	self newStack: (self contextStackTop stackOfSize: 20).
	contextStackIndex := 0.
	receiverInspector := (ObjectExplorer explore: nil) rootName: 'receiver'; yourself.
	contextVariablesInspector := (ObjectExplorer explore: nil) rootName: 'context'; yourself.
	proceedValue := nil! !

!Debugger methodsFor: 'toolbuilder' stamp: 'mt 4/12/2018 14:47'!
buildFullWith: builder
	| windowSpec listSpec textSpec |
	windowSpec := builder pluggableWindowSpec new
		model: self;
		label: 'Debugger';
		children: OrderedCollection new.

	listSpec := builder pluggableListSpec new.
	listSpec 
		model: self;
		list: #contextStackList; 
		getIndex: #contextStackIndex; 
		setIndex: #toggleContextStackIndex:; 
		menu: #contextStackMenu:shifted:; 
		icon: #messageIconAt:;
		helpItem: #messageHelpAt:;
		keyPress: #contextStackKey:from:;
		frame: (0@0 corner: 1@0.22).
	windowSpec children add: listSpec.


	textSpec := self buildCodePaneWith: builder.
	textSpec frame: (0@0.22corner: 1@0.8).
	windowSpec children add: textSpec.

	listSpec := builder pluggableTreeSpec new.
	listSpec 
		model: self receiverInspector;
		nodeClass: ObjectExplorer nodeClass;
		roots: #getList;
		keyPress: #explorerKey:from:event:;
		getSelected: #currentSelection;
		setSelected: #currentSelection:;
		setSelectedParent: #currentParent:;
		menu: #genericMenu:;
		dragItem: #getDragItem:;
		autoDeselect: false;
		columns: (ObjectExplorerWrapper showContentsInColumns
			ifTrue: [{
				[:listMorph | (listMorph filteredItems collect: [:item |
					item preferredWidthOfColumn: 1]) max].
				nil "take all the space"}]);
		frame: (0@0.8 corner: 0.5@0.95);
		help: 'Receiver''s\Instance\Variables' withCRs.
	windowSpec children add: listSpec.

	textSpec := builder pluggableCodePaneSpec new.
	textSpec 
		model: self receiverInspector;
		getText: #expression;
		editText: #expression:;
		menu: #codePaneMenu:shifted:;
		help: 'Evaluate expressions for the current tree selection...' translated;
		frame: (0@0.95 corner: 0.5@1).
	windowSpec children add: textSpec.

	listSpec := builder pluggableTreeSpec new.
	listSpec 
		model: self contextVariablesInspector;
		nodeClass: ObjectExplorer nodeClass;
		roots: #getList;
		keyPress: #explorerKey:from:event:;
		getSelected: #currentSelection;
		setSelected: #currentSelection:;
		setSelectedParent: #currentParent:;
		menu: #genericMenu:;
		dragItem: #getDragItem:;
		autoDeselect: false;
		columns: (ObjectExplorerWrapper showContentsInColumns
			ifTrue: [{
				[:listMorph | (listMorph filteredItems collect: [:item |
					item preferredWidthOfColumn: 1]) max].
				nil "take all the space"}]);
		frame: (0.5@0.8 corner: 1@0.95);
		help: 'Other\Context\Bindings' withCRs.
	windowSpec children add: listSpec.

	textSpec := builder pluggableTextSpec new.
	textSpec 
		model: self contextVariablesInspector;
		getText: #expression;
		editText: #expression:;
		menu: #codePaneMenu:shifted:;
		help: 'Evaluate expressions for the current tree selection...' translated;
		frame: (0.5@0.95 corner: 1@1).
	windowSpec children add: textSpec.

	^builder build: windowSpec! !


!ObjectExplorer methodsFor: 'accessing' stamp: 'mt 4/12/2018 14:28'!
doItContext
	"Answer the context in which a text selection can be evaluated."

	^ self context! !

!ObjectExplorer methodsFor: 'accessing' stamp: 'mt 4/12/2018 14:49'!
root

	^ root ifNil: [root := self rootName -> nil]! !

!ObjectExplorer methodsFor: 'accessing' stamp: 'mt 4/12/2018 14:48'!
rootName
	^ rootName ifNil: ['root']! !

!ObjectExplorer methodsFor: 'accessing' stamp: 'mt 4/12/2018 14:49'!
rootName: aString
	rootName := aString.
	self root key: rootName.! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:28'!
context
	^ context! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:28'!
context: aContext
	context := aContext.! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:42'!
fieldList
	"Compatibility for Inspector protocol."
	
	^ (self class nodeClass with: self rootObject) contents collect: [:ea | ea item key]! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:26'!
object: anObject
	"Compatibility with Inspector interface."
	
	self rootObject: anObject.! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:47'!
selectedSlotName
	"Compatibility for Inspector protocol."
	^ self selectedInstVarName! !

!ObjectExplorer methodsFor: 'inspector compatibility' stamp: 'mt 4/12/2018 14:27'!
update
	"Compatibility with Inspector protocol."! !

ObjectExplorer removeSelector: #selectedSlotNameName!
AbstractHierarchicalList subclass: #ObjectExplorer
	instanceVariableNames: 'root rootName currentParent inspector monitorList expression context'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Tools-Explorer'!

!ObjectExplorer reorganize!
('accessing' currentParent currentParent: currentSelection currentSelection: doItContext doItReceiver expression expression: getList label root rootName rootName:)
('menus' codePaneMenu:shifted: explorerKey:from:event: genericMenu: mainTreeListMenu:)
('monitoring' monitor: monitorList release shouldGetStepsFrom: step stopMonitoring world)
('user interface' explore: getDragItem: initialExtent representsSameBrowseeAs:)
('toolbuilder' buildWith: inspectObject)
('accessing - objects' object parentObject rootObject rootObject:)
('accessing - other' inspector selectedClass selectedInstVarName selectedParentClass setExpression:)
('styling' aboutToStyle:)
('inspector compatibility' context context: fieldList object: selectedSlotName update)
('menus - actions' browseClassRefs browseFull browseVariableAssignments browseVariableReferences chasePointersForSelection classHierarchy copyName copyValue defsOfSelection explorePointersForSelection exploreSelection inspectBasic inspectSelection monitorSelection objectReferencesToSelection referencesToSelection viewerForValue)
('*Protocols-Tools' browseFullProtocol)
!

