Christoph Thiede uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-ct.1221.mcz ==================== Summary ==================== Name: System-ct.1221 Author: ct Time: 2 March 2021, 3:43:49.27617 pm UUID: 9d574208-4d9d-9549-b398-2b34b8fce241 Ancestors: System-mt.1219 Refactors removal of selectors. Deprecates #confirmRemovalOf:on: because of its high coupling and magic number return values. Also improves multilingual support. Please only merge together with {Tools-ct.1028. Protocols-ct.78}, (HelpSystem-Core-ct.124 isInTrunk ifTrue: [{HelpSystem-Core-ct.135}] ifFalse: [].) :-) =============== Diff against System-mt.1219 =============== Item was added: + ----- Method: SystemNavigation>>confirmAndRemoveSelector:class: (in category 'ui') ----- + confirmAndRemoveSelector: selector class: aClass + + | method allCalls browse remove | + method := MethodReference class: aClass selector: selector environment: self environment. + allCalls := self allCallsOn: selector. + + remove := true. + browse := false. + (allCalls anySatisfy: [:ea | ea ~= method]) ifTrue: [ + | choice | + choice := UIManager default + chooseFromLabeledValues: (OrderedDictionary newFrom: { + 'Remove it' translated -> []. + 'Remove, then browse senders' translated -> [browse := true]. + 'Don''t remove, but show me those senders' translated -> [remove := false. browse := true]. + 'Forget it -- do nothing -- sorry I asked' translated -> [remove := false] }) + title: ('The message "{1}" has {2}.' translated format: { + selector. + allCalls size > 1 + ifFalse: ['1 sender' translated] + ifTrue: ['{1} senders' translated format: {allCalls size}] }). + choice ifNil: [choice := [remove := false]]. + choice value]. + + remove ifTrue: [ + aClass removeSelector: selector]. + browse ifTrue: [ + self headingAndAutoselectForLiteral: selector do: [ :label :autoSelect | + self + browseMessageList: allCalls + name: label + autoSelect: autoSelect]]. + + ^ remove! Item was changed: ----- Method: SystemNavigation>>confirmRemovalOf:on: (in category 'ui') ----- confirmRemovalOf: aSelector on: aClass "Determine if it is okay to remove the given selector. Answer 1 if it should be removed, 2 if it should be removed followed by a senders browse, and 3 if it should not be removed." | count answer caption allCalls | + self deprecated: 'ct: Use #confirmAndRemoveSelector:class: instead.'. + allCalls := self allCallsOn: aSelector. (count := allCalls size) = 0 ifTrue: [^ 1]. "no senders -- let the removal happen without warning" count = 1 ifTrue: [(allCalls first actualClass == aClass and: [allCalls first methodSymbol == aSelector]) ifTrue: [^ 1]]. "only sender is itself" caption := 'The message "{1}" has {2} sender{3}.' translated format: {aSelector. count. count > 1 ifTrue: ['s'] ifFalse: ['']}. answer := UIManager default chooseFrom: #('Remove it' 'Remove, then browse senders' 'Don''t remove, but show me those senders' 'Forget it -- do nothing -- sorry I asked') title: caption. answer = 3 ifTrue: [self browseMessageList: allCalls name: 'Senders of ' , aSelector autoSelect: aSelector keywords first]. answer = 0 ifTrue: [answer := 3]. "If user didn't answer, treat it as cancel" ^ answer min: 3! |
> Please only merge together with {Tools-ct.1028. Protocols-ct.78},
(HelpSystem-Core-ct.124 isInTrunk ifTrue: [{HelpSystem-Core-ct.135}] ifFalse: [].) :-) Instead of HelpSystem-Core-ct.135, I was referring to HelpSystem-Core-ct.134. Sorry for the confusion! Best, Christoph ----- Carpe Squeak! -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
Carpe Squeak!
|
Free forum by Nabble | Edit this page |