[3.9a6703 BUG] [FIX] Adding a new method category

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Tue Nov 8 15:06:09 UTC 2005


This fix a walkback when you try to add a new method category to a class.
I attach walkback and proposed .cs fix

Edgar

-------------- next part --------------
'From Squeak3.9alpha of 4 July 2005 [latest update: #6703] on 8 November 2005 at 11:57:23 am'!
"Change Set:		Browser>addCategory
Date:			8 November 2005
Author:			Edgar J. De Cleene

Fix a walkback when you try to assing a category to new method>"!


!Browser methodsFor: 'message category functions' stamp: 'edc 11/8/2005 11:51'!
addCategory
	"Present a choice of categories or prompt for a new category name and add it before the current selection, or at the end if no current selection"
	| labels reject lines cats menuIndex oldIndex newName |
	self okToChange ifFalse: [^ self].
	classListIndex = 0 ifTrue: [^ self].
	labels _ OrderedCollection with: 'new...'.
	reject _ Set new.
	reject
		addAll: self selectedClassOrMetaClass organization categories;
		add: ClassOrganizer nullCategory;
		add: ClassOrganizer default.
	lines _ OrderedCollection new.
	self selectedClassOrMetaClass allSuperclasses do: [:cls |
		cls = Object ifFalse: [
			cats _ cls organization categories reject:
				 [:cat | reject includes: cat].
			cats isEmpty ifFalse: [
				lines add: labels size.
				labels addAll: cats asSortedCollection.
				reject addAll: cats]]].
	newName _ (labels size = 1 or: [
		menuIndex _ (UIManager default chooseFrom: labels lines: lines title: 'Add Category').
		menuIndex = 0 ifTrue: [^ self].
		menuIndex = 1])
			ifTrue: [
				self request: 'Please type new category name'
					initialAnswer: 'category name']
			ifFalse: [
				labels at: menuIndex].
	oldIndex _ messageCategoryListIndex.
	newName isEmpty
		ifTrue: [^ self]
		ifFalse: [newName _ newName asSymbol].
	self classOrMetaClassOrganizer
		addCategory: newName
		before: (messageCategoryListIndex = 0
				ifTrue: [nil]
				ifFalse: [self selectedMessageCategoryName]).
	self changed: #messageCategoryList.
	self messageCategoryListIndex:
		(oldIndex = 0
			ifTrue: [self classOrMetaClassOrganizer categories size + 1]
			ifFalse: [oldIndex]).
	self changed: #messageCategoryList.
! !

-------------- next part --------------
MessageNotUnderstood: SmallInteger>>startUpWithCaption:
8 November 2005 12:01:58 pm

VM: Mac OS - a SmalltalkImage
Image: Squeak3.9alpha [latest update: #6703]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir Discovery:Users:admin:SqueakDevelop:Squeak3.9a-6693
Trusted Dir Discovery:Users:admin:SqueakDevelop:Squeak3.9a-6693
Untrusted Dir foobar:tooBar:forSqueak:bogus

SmallInteger(Object)>>doesNotUnderstand: #startUpWithCaption:
	Receiver: 27
	Arguments and temporary variables: 
		aMessage: 	startUpWithCaption: 'Add Category'
	Receiver's instance variables: 
27

Browser>>addCategory
	Receiver: a Browser
	Arguments and temporary variables: 
		labels: 	an OrderedCollection('new...' #accessing #annotation #breakpoints #'cla...etc...
		reject: 	a Set(#'code pane' #'package list' #commands #'categories & search pane...etc...
		lines: 	an OrderedCollection(1 19 31 36 40)
		cats: 	#(#testing #comparing #'system primitives' #'objects from disk' #debuggin...etc...
		menuIndex: 	nil
		oldIndex: 	nil
		newName: 	nil
		cls: 	ProtoObject
		cat: 	#'apply primitives'
	Receiver's instance variables: 
		dependents: 	a DependentsArray(a SystemWindow<Browser>(533) a PluggableListMorph...etc...
		contents: 	nil
		currentCompiledMethod: 	nil
		contentsSymbol: 	#source
		systemOrganizer: 	('Kernel-Chronology' ChronologyConstants Date DateAndTime Dura...etc...
		classOrganizer: 	('initialize-release' defaultBrowserTitle openAsMorphEditing: s...etc...
		metaClassOrganizer: 	('instance creation' prototypicalToolWindow)
('window color...etc...
		systemCategoryListIndex: 	182
		classListIndex: 	8
		messageCategoryListIndex: 	0
		messageListIndex: 	0
		editSelection: 	#editClass
		metaClassIndicated: 	false

Browser(StringHolder)>>perform:orSendTo:
	Receiver: a Browser
	Arguments and temporary variables: 
		selector: 	#addCategory
		otherTarget: 	a PluggableMessageCategoryListMorph(1105)
	Receiver's instance variables: 
		dependents: 	a DependentsArray(a SystemWindow<Browser>(533) a PluggableListMorph...etc...
		contents: 	nil
		currentCompiledMethod: 	nil
		contentsSymbol: 	#source
		systemOrganizer: 	('Kernel-Chronology' ChronologyConstants Date DateAndTime Dura...etc...
		classOrganizer: 	('initialize-release' defaultBrowserTitle openAsMorphEditing: s...etc...
		metaClassOrganizer: 	('instance creation' prototypicalToolWindow)
('window color...etc...
		systemCategoryListIndex: 	182
		classListIndex: 	8
		messageCategoryListIndex: 	0
		messageListIndex: 	0
		editSelection: 	#editClass
		metaClassIndicated: 	false

[] in MenuItemMorph>>invokeWithEvent: {[(selArgCount := selector numArgs) = 0   ifTrue: [target perform: selector] ...]}
	Arguments and temporary variables: 
		evt: 	[539 at 219 mouseUp 55577]
		selArgCount: 	2
		w: 	a PasteUpMorph(1622) [world]


--- The full stack ---
SmallInteger(Object)>>doesNotUnderstand: #startUpWithCaption:
Browser>>addCategory
Browser(StringHolder)>>perform:orSendTo:
[] in MenuItemMorph>>invokeWithEvent: {[(selArgCount := selector numArgs) = 0   ifTrue: [target perform: selector] ...]}
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BlockContext>>ensure:
CursorWithMask(Cursor)>>showWhile:
MenuItemMorph>>invokeWithEvent:
MenuItemMorph>>mouseUp:
MenuItemMorph>>handleMouseUp:
MouseButtonEvent>>sentTo:
MenuItemMorph(Morph)>>handleEvent:
MorphicEventDispatcher>>dispatchDefault:with:
MorphicEventDispatcher>>dispatchEvent:with:
MenuItemMorph(Morph)>>processEvent:using:
MorphicEventDispatcher>>dispatchDefault:with:
MorphicEventDispatcher>>dispatchEvent:with:
MenuMorph(Morph)>>processEvent:using:
MenuMorph(Morph)>>processEvent:
MenuMorph>>handleFocusEvent:
[] in HandMorph>>sendFocusEvent:to:clear: {[ActiveHand := self.  ActiveEvent := anEvent.  result := focusHolder     han...]}
[] in PasteUpMorph>>becomeActiveDuring: {[aBlock value]}
BlockContext>>on:do:
PasteUpMorph>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendMouseEvent:
HandMorph>>handleEvent:
HandMorph>>processEvents
[] in WorldState>>doOneCycleNowFor: {[:h |  ActiveHand := h.  h processEvents.  capturingGesture := capturingGest...]}
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
WorldState>>doOneCycleNowFor:
WorldState>>doOneCycleFor:
PasteUpMorph>>doOneCycle
[] in Project class>>spawnNewProcess {[[World doOneCycle.  Processor yield.  false] whileFalse.  nil]}
...etc...


More information about the Squeak-dev mailing list