<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi Christoph --<div><br></div><div>Looks good. Except for "some" -> "any":</div><div><br></div><div><b style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">someTextPaneWithSelector: -> any</b><b style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">TextPaneWithSelector:</b><br></div><div><br></div><div>Just like we have in the Collection protocol.<br></div><div><br></div><div>Best,</div><div>Marcel</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 05.04.2022 20:51:36 schrieb christoph.thiede@student.hpi.uni-potsdam.de <christoph.thiede@student.hpi.uni-potsdam.de>:</p><div style='font-family:Arial,Helvetica,sans-serif'>
<b>=============== Summary ===============</b><br>
<br>
Change Set: toolCodePane<br>
Date: 5 April 2022<br>
Author: Christoph Thiede<br>
<br>
Improves MVC compatibility for view accesses from model.<br>
<br>
* Moves up #someTextPaneWithSelector: & friends from StringHolder to Model and improves documentation on the antiidiomatic pattern they represent.<br>
* Fixes 'run to selection' & 'tally it' button in MVC debugger.<br>
* Improves MVC compatibility in Monticello save version dialog (still, showModally does not yet work, though.)<br>
<br>
<b>=============== Diff ===============</b><br>
<br>
<b>CodeHolder>>searchPane {categories & search pane} · ct 4/5/2022 20:19 (changed)</b><br>
searchPane<br>
"Answer the search pane associated with the receiver in its window, or nil if none. Morphic only"<br>
<br>
<s><span style="color: #0000FF">- ^ self textPaneWithSelector: #lastSearchString<br>
</span></s><span style="color: #FF0000">+ | pane |<br>
+ pane := self someTextPaneWithSelector: #lastSearchString.<br>
+ ^ pane isMorph ifTrue: [pane]</span><br>
<br>
<b>Debugger>>codePaneSelectionInterval {code pane} · ct 4/5/2022 19:50 (changed)</b><br>
codePaneSelectionInterval<br>
<br>
<s><span style="color: #0000FF">- ^ self codeTextMorph<br>
</span></s><span style="color: #FF0000">+ ^ self codeTextPane<br>
</span> ifNotNil: [:cp | cp selectionInterval]<br>
ifNil: [Interval from: 0 to: 0]<br>
<br>
<b>Debugger>>getSelectedText {tally support} · ct 4/5/2022 19:50 (changed)</b><br>
getSelectedText<br>
| m interval text |<br>
<s><span style="color: #0000FF">- m := self codeTextMorph ifNil: [^ ''].<br>
</span></s><span style="color: #FF0000">+ m := self codeTextPane ifNil: [^ ''].<br>
</span> interval := m selectionInterval.<br>
text := m text.<br>
^ text copyFrom: interval first to: interval last<br>
<br>
<br>
<b>Debugger>>tally {tally support} · ct 4/5/2022 19:46 (changed)</b><br>
tally<br>
<br>
<s><span style="color: #0000FF">- self codeTextMorph ifNotNil: [:o| o tallyIt] ifNil: [Beeper beep]<br>
</span></s><span style="color: #FF0000">+ self codeTextPane ifNotNil: [:o | o tallyIt] ifNil: [Beeper beep]<br>
</span><br>
<br>
<b>MCSaveVersionDialog>>accept {actions} · ct 4/5/2022 19:57 (changed)</b><br>
accept<br>
| logMessage logMessageWidget |<br>
self updateItems.<br>
<s><span style="color: #0000FF">- logMessage := (logMessageWidget := self findTextMorph: #logMessage) text asString.<br>
</span></s><span style="color: #FF0000">+ logMessage := (logMessageWidget := self someTextPaneWithSelector: #logMessage) text asString.<br>
</span> (logMessage isEmpty or: [logMessage beginsWith: 'empty log message'])<br>
ifTrue:<br>
<s><span style="color: #0000FF">- [(UIManager confirm: 'the log message is empty; are you sure you want to commit') ifFalse: [^ self]]<br>
</span></s><span style="color: #FF0000">+ [(Project uiManager confirm: 'the log message is empty; are you sure you want to commit') ifFalse: [^ self]]<br>
</span> ifFalse: [logMessageWidget accept].<br>
self answer: {<br>
<s><span style="color: #0000FF">- (self findTextMorph: #versionName) text asString.<br>
</span></s><span style="color: #FF0000">+ (self someTextPaneWithSelector: #versionName) text asString.<br>
</span> logMessage.<br>
ignore }<br>
<br>
<b>MCSaveVersionDialog>>okToClose {actions} · ct 4/5/2022 19:57 (changed)</b><br>
okToClose<br>
<s><span style="color: #0000FF">- ^ (self findTextMorph: #logMessage)<br>
</span></s><span style="color: #FF0000">+ ^ (self someTextPaneWithSelector: #logMessage)<br>
</span> ifNil: [true]<br>
ifNotNil:<br>
[:widget | widget canDiscardEdits or: [self confirm: 'Version notes are not saved.<br>
Is it OK to discard those notes?' translated]]<br>
<br>
<b>Model>>dependentTextPaneWithSelector: {*Tools-private} · ct 4/5/2022 19:42</b><br>
<span style="color: #FF0000">+ dependentTextPaneWithSelector: selector<br>
+ <br>
+ ^ self dependents detect:<br>
+ [:dependent | dependent isTextView and:<br>
+ [dependent getTextSelector == selector]]<br>
+ ifNone: [nil]</span><br>
<br>
<b>Model>>someTextPaneWithSelector: {*Tools} · ct 4/5/2022 20:17</b><br>
<span style="color: #FF0000">+ someTextPaneWithSelector: aSelector<br>
+ "Try to find the text pane for aSelector in my dependents or my window. Note that this is a hack only and violates the original idea of the model-view pattern. Usually, the communication should come from the view instead, e.g., via a pluggable selector."<br>
+ ^ (self dependentTextPaneWithSelector: aSelector)<br>
+ ifNil: [self textPaneWithSelector: aSelector]</span><br>
<br>
<b>Model>>textPaneWithSelector: {*Tools-private} · mt 4/12/2015 19:45</b><br>
<span style="color: #FF0000">+ textPaneWithSelector: aSelector<br>
+ "If, among my window's paneMorphs, there is a text pane defined with aSelector as its retriever, answer it, else answer nil"<br>
+ <br>
+ | aWindow |<br>
+ Smalltalk isMorphic ifFalse: [^ nil].<br>
+ ^ (aWindow := self containingWindow) ifNotNil:<br>
+ [aWindow paneMorphSatisfying:<br>
+ [:aMorph | (aMorph isKindOf: PluggableTextMorph) and:<br>
+ [aMorph getTextSelector == aSelector]]]</span><br>
<br>
<b>PluggableTextView>>tallyIt {as yet unclassified} · ct 4/5/2022 19:50</b><br>
<span style="color: #FF0000">+ tallyIt<br>
+ <br>
+ self controller tallyIt.</span><br>
<br>
<b>StringHolder>>codeTextMorph {*Tools} · ct 4/5/2022 20:16 (changed)</b><br>
codeTextMorph<br>
<s><span style="color: #0000FF">- <br>
- ^ self someTextPaneWithSelector: #contents<br>
</span></s><span style="color: #FF0000">+ "Find a Morphic text pane that displays the contents of the receiver. Note that this is a hack only and violates the original idea of the model-view pattern. Using this selector in your model will likely break compatibility with other UI frameworks such as MVC. Usually, the communication should come from the view instead, e.g., via a pluggable selector."<br>
+ <br>
+ | textPane |<br>
+ textPane := self codeTextPane.<br>
+ ^ textPane isMorph ifTrue: [textPane]</span><br>
<br>
<b>StringHolder>>codeTextPane {*Tools} · ct 4/5/2022 20:16</b><br>
<span style="color: #FF0000">+ codeTextPane<br>
+ "Find a text pane that displays the contents of the receiver. Note that this is a hack only and violates the original idea of the model-view pattern. Usually, the communication should come from the view instead, e.g., via a pluggable selector."<br>
+ <br>
+ ^ self someTextPaneWithSelector: #contents</span><br>
<br>
<b>StringHolder>>selectedInterval {*services-base} · ct 4/5/2022 19:46 (changed)</b><br>
selectedInterval<br>
<s><span style="color: #0000FF">- ^self codeTextMorph selectionInterval<br>
</span></s><span style="color: #FF0000">+ ^self codeTextPane selectionInterval</span><br>
<br>
<b>StringHolderView>>accept {controller access} · ct 4/5/2022 19:59</b><br>
<span style="color: #FF0000">+ accept<br>
+ <br>
+ ^ self controller accept</span><br>
<br>
<b>StringHolderView>>text {controller access} · ct 4/5/2022 19:56</b><br>
<span style="color: #FF0000">+ text<br>
+ <br>
+ ^ self displayContents text</span><br>
<br>
["toolCodePane.2.cs"]<br>
<br>
<span style="color: #808080">---<br>
</span><span style="color: #808080"><i>Sent from </i></span><span style="color: #808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></span>
</div></blockquote>
</div></body>