[squeak-dev] The Trunk: Tools-fbs.333.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Apr 20 23:20:35 UTC 2011
Levente Uzonyi uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-fbs.333.mcz
==================== Summary ====================
Name: Tools-fbs.333
Author: fbs
Time: 30 March 2011, 8:55:49.369 am
UUID: ca634461-e430-8f4f-acda-32f1428552f6
Ancestors: Tools-fbs.332
The start of removing messageCategoryListIndex: inserting the new instvar in parallel with the existing one.
=============== Diff against Tools-fbs.332 ===============
Item was changed:
CodeHolder subclass: #Browser
+ instanceVariableNames: 'systemOrganizer classOrganizer metaClassOrganizer messageCategoryListIndex editSelection metaClassIndicated selectedSystemCategory selectedClassName selectedMessageName selectedMessageCategoryName'
- instanceVariableNames: 'systemOrganizer classOrganizer metaClassOrganizer messageCategoryListIndex editSelection metaClassIndicated selectedSystemCategory selectedClassName selectedMessageName'
classVariableNames: 'ListClassesHierarchically RecentClasses'
poolDictionaries: ''
category: 'Tools-Browser'!
!Browser commentStamp: '<historical>' prior: 0!
I represent a query path into the class descriptions, the software of the system.!
Item was changed:
----- Method: Browser>>addCategory (in category 'message category functions') -----
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 menuIndex oldIndex newName oldCategory |
- | labels reject lines menuIndex oldIndex newName |
self okToChange ifFalse: [^ self].
self hasClassSelected ifFalse: [^ 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 | | cats |
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.
+ oldCategory := self selectedMessageCategoryName.
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 selectMessageCategoryNamed: (oldCategory ifNil: [self messageCategoryList last] ifNotNil: [oldCategory])."
self changed: #messageCategoryList.
!
Item was changed:
----- Method: Browser>>classHierarchy (in category 'multi-window support') -----
classHierarchy
| behavior newBrowser |
(behavior := self selectedClassOrMetaClass) isNil ifTrue:
[^self].
(self isPackage "PackageBrowser pains can't support a hierarchy browser; not sure why."
or: [multiWindowState isNil]) ifTrue:
[^super classHierarchy].
(newBrowser := HierarchyBrowser new initHierarchyForClass: behavior)
+ selectMessageCategoryNamed: self selectedMessageCategoryName;
- messageCategoryListIndex: messageCategoryListIndex;
selectMessageNamed: self selectedMessageName;
editSelection: editSelection.
multiWindowState addWindow: newBrowser
!
Item was changed:
----- Method: Browser>>fileOutMessageCategories (in category 'message category functions') -----
fileOutMessageCategories
"Print a description of the selected message category of the selected class
onto an external file."
Cursor write showWhile:
+ [self hasMessageCategorySelected
- [messageCategoryListIndex ~= 0
ifTrue:
[self selectedClassOrMetaClass fileOutCategory: self selectedMessageCategoryName]]!
Item was changed:
----- Method: Browser>>messageCategoryListIndex: (in category 'message category list') -----
messageCategoryListIndex: anInteger
"Set the selected message category to be the one indexed by anInteger."
messageCategoryListIndex := anInteger.
+ selectedMessageCategoryName := nil.
selectedMessageName := nil.
self changed: #messageCategorySelectionChanged.
self changed: #messageCategoryListIndex. "update my selection"
self changed: #messageList.
self editSelection: (anInteger > 0
ifTrue: [#newMessage]
ifFalse: [self hasClassSelected
ifTrue: [#editClass]
ifFalse: [#newClass]]).
contents := nil.
self contentsChanged.!
Item was changed:
----- Method: Browser>>metaClassIndicated: (in category 'metaclass') -----
metaClassIndicated: trueOrFalse
"Indicate whether browsing instance or class messages."
metaClassIndicated := trueOrFalse.
self setClassOrganizer.
self hasSystemCategorySelected ifTrue:
[self editSelection: (self hasClassSelected
ifFalse: [metaClassIndicated
ifTrue: [#none]
ifFalse: [#newClass]]
ifTrue: [#editClass])].
messageCategoryListIndex := 0.
+ selectedMessageCategoryName := nil.
selectedMessageName := nil.
contents := nil.
self changed: #classSelectionChanged.
self changed: #messageCategoryList.
self changed: #messageList.
self changed: #contents.
self changed: #annotation.
self decorateButtons
!
Item was changed:
----- Method: Browser>>printOutMessageCategories (in category 'message category functions') -----
printOutMessageCategories
"Print a description of the selected message category of the selected class
onto an external file in Html format."
Cursor write showWhile:
+ [self hasMessageCategorySelected
- [messageCategoryListIndex ~= 0
ifTrue:
[self selectedClassOrMetaClass fileOutCategory: self selectedMessageCategoryName
asHtml: true]]!
Item was changed:
----- Method: Browser>>removeMessageCategory (in category 'message category functions') -----
removeMessageCategory
"If a message category is selected, create a Confirmer so the user can
verify that the currently selected message category should be removed
from the system. If so, remove it."
| messageCategoryName |
+ self hasMessageCategorySelected ifFalse: [^ self].
- messageCategoryListIndex = 0 ifTrue: [^ self].
self okToChange ifFalse: [^ self].
messageCategoryName := self selectedMessageCategoryName.
(self messageList size = 0
or: [self confirm: 'Are you sure you want to
remove this method category
and all its methods?'])
ifTrue:
[self selectedClassOrMetaClass removeCategory: messageCategoryName.
+ self selectMessageCategoryNamed: nil.
- self messageCategoryListIndex: 0.
self changed: #classSelectionChanged].
self changed: #messageCategoryList.
!
Item was changed:
----- Method: Browser>>renameCategory (in category 'message category functions') -----
renameCategory
"Prompt for a new category name and add it before the
current selection, or at the end if no current selection"
+ | oldName newName |
- | oldIndex oldName newName |
self hasClassSelected ifFalse: [^ self].
self okToChange ifFalse: [^ self].
+ self hasMessageCategorySelected ifFalse: [^ self].
+
- (oldIndex := messageCategoryListIndex) = 0 ifTrue: [^ self].
oldName := self selectedMessageCategoryName.
newName := self
request: 'Please type new category name'
initialAnswer: oldName.
newName isEmpty
ifTrue: [^ self]
ifFalse: [newName := newName asSymbol].
newName = oldName ifTrue: [^ self].
self classOrMetaClassOrganizer
renameCategory: oldName
toBe: newName.
self selectClassNamed: selectedClassName.
+ self selectMessageCategoryNamed: oldName.
- self messageCategoryListIndex: oldIndex.
self changed: #messageCategoryList.
!
Item was changed:
----- Method: Browser>>selectClassNamed: (in category 'class list') -----
selectClassNamed: aSymbolOrString
| className currentMessageCategoryName currentMessageName |
currentMessageCategoryName := [self selectedMessageCategoryName]
on: Error
do: [:ex| ex return: nil].
currentMessageName := [self selectedMessageName]
on: Error
do: [:ex| ex return: nil].
selectedClassName := aSymbolOrString ifNotNil: [ aSymbolOrString asSymbol ].
self setClassOrganizer.
"Try to reselect the category and/or selector if the new class has them."
messageCategoryListIndex := self messageCategoryList
indexOf: currentMessageCategoryName
ifAbsent: [0].
self selectMessageNamed: (self hasMessageCategorySelected
ifTrue: [ currentMessageName ]
ifFalse: [ nil ]).
self hasMessageSelected ifTrue:
[self editSelection: #editMessage] ifFalse:
+ [self hasMessageCategorySelected ifTrue:
- [self messageCategoryListIndex ~= 0 ifTrue:
[self editSelection: #newMessage] ifFalse:
[self classCommentIndicated
ifTrue: []
ifFalse: [self editSelection: (self hasClassSelected not
ifTrue: [(metaClassIndicated or: [ self hasSystemCategorySelected not ])
ifTrue: [#none]
ifFalse: [#newClass]]
ifFalse: [#editClass])]]].
contents := nil.
self selectedClass isNil
ifFalse: [className := self selectedClass name.
(RecentClasses includes: className)
ifTrue: [RecentClasses remove: className].
RecentClasses addFirst: className.
RecentClasses size > 16
ifTrue: [RecentClasses removeLast]].
self changed: #classSelectionChanged.
self changed: #classCommentText.
self changed: #classListIndex. "update my selection"
self changed: #messageCategoryList.
self changed: #messageList.
self changed: #relabel.
self contentsChanged!
Item was changed:
----- Method: Browser>>selectOriginalCategoryForCurrentMethod (in category 'message category list') -----
selectOriginalCategoryForCurrentMethod
"private - Select the message category for the current method.
Note: This should only be called when somebody tries to save
a method that they are modifying while ALL is selected.
Returns: true on success, false on failure."
| aSymbol selectorName |
aSymbol := self categoryOfCurrentMethod.
selectorName := self selectedMessageName.
(aSymbol notNil and: [aSymbol ~= ClassOrganizer allCategory])
ifTrue:
[messageCategoryListIndex := (self messageCategoryList indexOf: aSymbol).
+ selectedMessageCategoryName := aSymbol.
selectedMessageName := selectorName.
self changed: #messageCategorySelectionChanged.
self changed: #messageCategoryListIndex. "update my selection"
self changed: #messageList.
self changed: #messageListIndex.
^ true].
^ false!
Item was changed:
----- Method: Browser>>selectSystemCategory: (in category 'system category list') -----
selectSystemCategory: aSymbol
"Set the selected system category. Update all other selections to be deselected."
selectedSystemCategory := aSymbol.
selectedClassName := nil.
messageCategoryListIndex := 0.
+ selectedMessageCategoryName := nil.
selectedMessageName := nil.
self editSelection: ( aSymbol isNil ifTrue: [#none] ifFalse: [#newClass]).
metaClassIndicated := false.
self setClassOrganizer.
contents := nil.
self changed: #systemCategorySelectionChanged.
self changed: #systemCategoryListIndex. "update my selection"
self changed: #classList.
self changed: #messageCategoryList.
self changed: #messageList.
self changed: #relabel.
self contentsChanged!
Item was changed:
----- Method: Browser>>setOriginalCategoryIndexForCurrentMethod (in category 'message category list') -----
setOriginalCategoryIndexForCurrentMethod
"private - Set the message category index for the currently selected method.
Note: This should only be called when somebody tries to save
a method that they are modifying while ALL is selected."
+ messageCategoryListIndex := self messageCategoryList indexOf: self categoryOfCurrentMethod.
+ selectedMessageCategoryName := self categoryOfCurrentMethod.!
- messageCategoryListIndex := self messageCategoryList indexOf: self categoryOfCurrentMethod
- !
Item was changed:
----- Method: Browser>>systemOrganizer: (in category 'initialize-release') -----
systemOrganizer: aSystemOrganizer
"Initialize the receiver as a perspective on the system organizer,
aSystemOrganizer. Typically there is only one--the system variable
SystemOrganization."
contents := nil.
systemOrganizer := aSystemOrganizer.
selectedSystemCategory := nil.
+ selectedMessageCategoryName := nil.
selectedClassName := nil.
messageCategoryListIndex := 0.
selectedMessageName := nil.
metaClassIndicated := false.
self setClassOrganizer.
self editSelection: #none.!
Item was changed:
----- Method: Browser>>veryDeepInner: (in category 'copying') -----
veryDeepInner: deepCopier
"Copy all of my instance variables. Some need to be not copied at all, but shared. See DeepCopier class comment."
super veryDeepInner: deepCopier.
"systemOrganizer := systemOrganizer. clone has the old value. we share it"
"classOrganizer := classOrganizer clone has the old value. we share it"
"metaClassOrganizer := metaClassOrganizer clone has the old value. we share it"
selectedSystemCategory := selectedSystemCategory veryDeepCopyWith: deepCopier.
selectedClassName := selectedClassName veryDeepCopyWith: deepCopier.
messageCategoryListIndex := messageCategoryListIndex veryDeepCopyWith: deepCopier.
+ selectedMessageCategoryName := selectedMessageCategoryName veryDeepCopyWith: deepCopier.
selectedMessageName := selectedMessageName veryDeepCopyWith: deepCopier.
editSelection := editSelection veryDeepCopyWith: deepCopier.
metaClassIndicated := metaClassIndicated veryDeepCopyWith: deepCopier.
!
Item was changed:
----- Method: FileContentsBrowser>>removeMessageCategory (in category 'removing') -----
removeMessageCategory
"If a message category is selected, create a Confirmer so the user can
verify that the currently selected message category should be removed
from the system. If so, remove it."
| messageCategoryName |
+ self hasMessageCategorySelected ifFalse: [^ self].
- messageCategoryListIndex = 0 ifTrue: [^ self].
self okToChange ifFalse: [^ self].
messageCategoryName := self selectedMessageCategoryName.
(self messageList size = 0
or: [self confirm: 'Are you sure you want to
remove this method category
and all its methods?']) ifFalse: [^ self].
self selectedClassOrMetaClass removeCategory: messageCategoryName.
self messageCategoryListIndex: 0.
self changed: #messageCategoryList.!
Item was changed:
----- Method: HierarchyBrowser>>assureSelectionsShow (in category 'class list') -----
assureSelectionsShow
"This is a workaround for the fact that a hierarchy browser, when launched, often does not show the selected class"
+ | saveMsgName saveCatName |
+ saveCatName := self selectedMessageCategoryName.
- | saveCatIndex saveMsgName |
- saveCatIndex := messageCategoryListIndex.
saveMsgName := self selectedMessageName.
self selectClassNamed: selectedClassName.
+ self selectMessageCategoryNamed: saveCatName.
- self messageCategoryListIndex: saveCatIndex.
self selectMessageNamed: saveMsgName!
Item was changed:
----- Method: PackagePaneBrowser>>packageListIndex: (in category 'package list') -----
packageListIndex: anInteger
"Set anInteger to be the index of the current package selection."
packageListIndex := anInteger.
anInteger = 0
ifFalse: [package := self packageList at: packageListIndex].
messageCategoryListIndex := 0.
+ selectedMessageCategoryName := nil.
self selectSystemCategory: nil.
- messageListIndex := 0.
selectedMessageName := nil.
selectedClassName := nil.
self setClassOrganizer.
self changed: #packageSelectionChanged.
self changed: #packageListIndex. "update my selection"
self changed: #systemCategoryList. "update the category list"
self selectSystemCategory: nil. "update category list selection"
!
More information about the Squeak-dev
mailing list
|