<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Marcel,</p>
<p><br>
</p>
<p>> <span style="font-size: 12pt;">What about ToolSet class >> #askForDefault?</span></p>
<div><br>
</div>
<div>Oh, that's some duplication. Maybe we can just delete that override?</div>
<div><br>
</div>
<div>> <span>What is the benefit of extracting #requestDefault out of #askDefault? It is not obvious that one has a side effect and the other does not.</span></div>
<div><span><br>
</span></div>
<div><span>I found that this could factor out the side effect. IMHO it is easier to see where the default is actually set if this happens at one single place.</span></div>
<div><span>In addition, if the user cancels the dialog, #askForDefault should return a fallback value, but it should *not* store this fallback as the default!</span></div>
<div><span><br>
</span></div>
<div><span>> <span>UIManager default -> Project uiManager</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span>Good point, will update in the next revision :)</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span>Best,</span></span></div>
<div><span><span>Christoph</span></span></div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel<br>
<b>Gesendet:</b> Sonntag, 17. Mai 2020 14:35:24<br>
<b>An:</b> gettimothy via Squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: System-ct.1158.mcz</font>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
Hi Christoph.
<div><br>
</div>
<div>- What about ToolSet class >> #askForDefault?</div>
<div>- What is the benefit of extracting #requestDefault out of #askDefault? It is not obvious that one has a side effect and the other does not.</div>
<div>- <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">UIManager default</span><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"> -> Project uiManager</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br>
</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div>
<div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div>
<div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">Am 16.05.2020 20:53:34 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">Christoph Thiede uploaded a new version of System to project The Inbox:<br>
http://source.squeak.org/inbox/System-ct.1158.mcz<br>
<br>
==================== Summary ====================<br>
<br>
Name: System-ct.1158<br>
Author: ct<br>
Time: 16 May 2020, 8:53:15.785708 pm<br>
UUID: 03cddc8b-5593-504d-95c0-fc6851a15d88<br>
Ancestors: System-nice.1157<br>
<br>
Refactor AppRegistry class >> #askForDefault. Add multilingual support. If request is cancelled by the user, don't set a default and return a fallback value.<br>
<br>
=============== Diff against System-nice.1157 ===============<br>
<br>
Item was changed:<br>
----- Method: AppRegistry class>>askForDefault (in category 'defaults') -----<br>
askForDefault<br>
<br>
+ self requestDefault ifNotNil: [:newDefault |<br>
+ default := newDefault].<br>
+ ^ default ifNil: [self registeredClasses first]!<br>
- self registeredClasses isEmpty ifTrue:<br>
- [self inform: 'There are no ', self appName, ' applications registered.'.<br>
- ^ default := nil].<br>
- self registeredClasses size = 1 ifTrue:<br>
- [^ default := self registeredClasses anyOne].<br>
- default := UIManager default <br>
- chooseFrom: (self registeredClasses collect: [:ea | ea nameForViewer])<br>
- values: self registeredClasses<br>
- title: 'Which ', self appName, ' would you prefer?'.<br>
- default ifNil: [default := self registeredClasses first].<br>
- ^default.!<br>
<br>
Item was added:<br>
+ ----- Method: AppRegistry class>>requestDefault (in category 'defaults') -----<br>
+ requestDefault<br>
+ <br>
+ self registeredClasses isEmpty ifTrue: [<br>
+ self inform: ('There are no {1} applications registered' translated format: {self appName}).<br>
+ ^ nil].<br>
+ self registeredClasses size = 1 ifTrue: [<br>
+ ^ self registeredClasses anyOne].<br>
+ ^ UIManager default<br>
+ chooseFrom: (self registeredClasses collect: [:ea | ea nameForViewer])<br>
+ values: self registeredClasses<br>
+ title: ('Which {1} would you prefer?' translated format: {self appName})!<br>
<br>
<br>
</div>
</blockquote>
</div>
</div>
</body>
</html>