'From Squeak6.0alpha of 25 January 2018 [latest update: #17716] on 26 January 2018 at 8:06:55 pm'!

!Object methodsFor: '*Tools-inspecting' stamp: 'mt 1/26/2018 20:05'!
inspectorMenu: aMenu for: anInspector
	"Can extend the inspector menu."

	Smalltalk isMorphic ifFalse: [^ self].

	aMenu
		add: 'Dance ', self printString
		target: self
		selector: #explore.! !


!Debugger methodsFor: 'toolbuilder' stamp: 'mt 1/26/2018 19:57'!
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 pluggableListSpec new.
	listSpec 
		model: self receiverInspector;
		list: #fieldList; 
		getIndex: #selectionIndex; 
		setIndex: #toggleIndex:; 
		menu: #fieldListMenu:shifted:; 
		keyPress: #inspectorKey:from:;
		frame: (0@0.8 corner: 0.2@1);
		help: 'Receiver''s\Instance\Variables' withCRs.
	windowSpec children add: listSpec.

	textSpec := builder pluggableTextSpec new.
	textSpec 
		model: self receiverInspector;
		getText: #contents; 
		setText: #accept:; 
		help: '<- Select receiver''s field' translated;
		selection: #contentsSelection; 
		menu: #codePaneMenu:shifted:;
		frame: (0.2@0.8 corner: 0.5@1).
	windowSpec children add: textSpec.

	listSpec := builder pluggableListSpec new.
	listSpec 
		model: self contextVariablesInspector;
		list: #fieldList; 
		getIndex: #selectionIndex; 
		setIndex: #toggleIndex:; 
		menu: #fieldListMenu:shifted:;
		keyPress: #inspectorKey:from:;
		frame: (0.5@0.8 corner: 0.7@1);
		help: 'Other\Context\Bindings' withCRs.
	windowSpec children add: listSpec.

	textSpec := builder pluggableTextSpec new.
	textSpec 
		model: self contextVariablesInspector;
		getText: #contents; 
		setText: #accept:; 
		help: '<- Select context''s field' translated;
		selection: #contentsSelection; 
		menu: #codePaneMenu:shifted:;
		frame: (0.7@0.8 corner: 1@1).
	windowSpec children add: textSpec.

	^builder build: windowSpec! !


!Inspector methodsFor: 'menu commands' stamp: 'mt 1/26/2018 19:51'!
fieldListMenu: aMenu shifted: aBoolean
	"Arm the supplied menu with items for the field-list of the receiver"
	^ self menu: aMenu for: #(fieldListMenu fieldListMenuShifted:) shifted: aBoolean
! !

!Inspector methodsFor: 'menu commands' stamp: 'mt 1/26/2018 19:53'!
mainFieldListMenu: aMenu
	"Arm the supplied menu with items for the field-list of the receiver"
	<fieldListMenuShifted: false>
	"gets overriden by subclasses, _whithout_ the <fieldListMenu>"
	aMenu addStayUpItemSpecial.

	aMenu addList: #(
		('inspect (i)'						inspectSelection)
		('explore (I)'						exploreSelection)).

	self addCollectionItemsTo: aMenu.

	aMenu addList: #(
		-
		('method refs to this inst var'		referencesToSelection)
		('methods storing into this inst var'	defsOfSelection)
		('objects pointing to this value'		objectReferencesToSelection)
		('chase pointers'					chasePointers)
		('explore pointers'				explorePointers)
		-
		('browse full (b)'					browseMethodFull)
		('browse class'						browseClass)
		('browse hierarchy (h)'					classHierarchy)
		('browse protocol (p)'				browseFullProtocol)
		-
		('references... (r)'					browseVariableReferences)
		('assignments... (a)'					browseVariableAssignments)
		('class refs (N)'						browseClassRefs)
		-
		('copy name (c)'					copyName)		
		('basic inspect'						inspectBasic)).

	Smalltalk isMorphic ifTrue:
		[aMenu addList: #(
			-
			('tile for this value	(t)'			tearOffTile)
			('viewer for this value (v)'		viewerForValue))].

	^ aMenu


"			-
			('alias for this value'			aliasForValue)
			('watcher for this slot'			watcherForSlot)"

! !

!Inspector methodsFor: 'menu commands' stamp: 'mt 1/26/2018 20:00'!
shiftedFieldListMenu: aMenu
	"Arm the supplied menu with items for the field-list of the receiver"
	<fieldListMenuShifted: true>
	"gets overriden by subclasses, _whithout_ the <fieldListMenu>"
	aMenu addStayUpItemSpecial.

	self object inspectorMenu: aMenu for: self.
	
	^ aMenu! !

!Inspector methodsFor: 'toolbuilder' stamp: 'mt 1/26/2018 19:50'!
buildFieldListWith: builder

	| listSpec |
	listSpec := builder pluggableListSpec new.
	listSpec 
		model: self;
		list: #fieldList; 
		getIndex: #selectionIndex; 
		setIndex: #toggleIndex:; 
		menu: #fieldListMenu:shifted:; 
		dragItem: #dragFromFieldList:;
		dropItem: #dropOnFieldList:at:;
		dropAccept: #wantsDropOnFieldList:type:source:;
		keyPress: #inspectorKey:from:.
	^listSpec! !

