The Trunk: Tools-mt.707.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-mt.707.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.707.mcz

==================== Summary ====================

Name: Tools-mt.707
Author: mt
Time: 21 July 2016, 11:43:02.277126 am
UUID: 0630c0a4-da1c-114b-be39-e5120a3a0e63
Ancestors: Tools-eem.706

When adding a message category in the browser, invoke choose-or-add dialog via the UI manager.

=============== Diff against Tools-eem.706 ===============

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 newName oldCategory |
- | labels reject lines menuIndex newName oldCategory |
  self okToChange ifFalse: [^ self].
  self hasClassSelected ifFalse: [^ self].
+ labels := OrderedCollection new.
- 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 := UIManager default
+ chooseFromOrAddTo: labels
+ lines: lines
+ title: 'Add Category') ifNil: [^ self].
- 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].
  oldCategory := self selectedMessageCategoryName.
  newName isEmpty
  ifTrue: [^ self]
  ifFalse: [newName := newName asSymbol].
  self classOrMetaClassOrganizer
  addCategory: newName
  before: (self hasMessageCategorySelected
  ifFalse: [nil]
  ifTrue: [self selectedMessageCategoryName]).
  self changed: #messageCategoryList.
  self selectMessageCategoryNamed:
  (oldCategory isNil
  ifTrue: [self classOrMetaClassOrganizer categories last]
  ifFalse: [oldCategory]).
  self changed: #messageCategoryList.
  !