[squeak-dev] Review Request: toolCodePane.2.cs
christoph.thiede at student.hpi.uni-potsdam.de
christoph.thiede at student.hpi.uni-potsdam.de
Thu May 5 17:12:24 UTC 2022
Thank you for the feedback! Merged via Tools-ct.1150 + (ST80-ct.285 + Services-Base-ct.72 + Protocols-ct.84 + Monticello-ct.778 + 60Deprecated-ct.114). :-)
Best,
Christoph
---
Sent from Squeak Inbox Talk
On 2022-04-08T09:50:19+02:00, marcel.taeumel at hpi.de wrote:
> Hi Christoph --
>
> Looks good. Except for "some" -> "any":
>
> someTextPaneWithSelector: -> anyTextPaneWithSelector:
>
>
> Just like we have in the Collection protocol.
>
>
> Best,
> Marcel
> Am 05.04.2022 20:51:36 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
> =============== Summary ===============
>
> Change Set: toolCodePane
> Date: 5 April 2022
> Author: Christoph Thiede
>
> Improves MVC compatibility for view accesses from model.
>
> * Moves up #someTextPaneWithSelector: & friends from StringHolder to Model and improves documentation on the antiidiomatic pattern they represent.
> * Fixes 'run to selection' & 'tally it' button in MVC debugger.
> * Improves MVC compatibility in Monticello save version dialog (still, showModally does not yet work, though.)
>
> =============== Diff ===============
>
> CodeHolder>>searchPane {categories & search pane} · ct 4/5/2022 20:19 (changed)
> searchPane
> "Answer the search pane associated with the receiver in its window, or nil if none. Morphic only"
>
> - ^ self textPaneWithSelector: #lastSearchString
> + | pane |
> + pane := self someTextPaneWithSelector: #lastSearchString.
> + ^ pane isMorph ifTrue: [pane]
>
> Debugger>>codePaneSelectionInterval {code pane} · ct 4/5/2022 19:50 (changed)
> codePaneSelectionInterval
>
> - ^ self codeTextMorph
> + ^ self codeTextPane
> ifNotNil: [:cp | cp selectionInterval]
> ifNil: [Interval from: 0 to: 0]
>
> Debugger>>getSelectedText {tally support} · ct 4/5/2022 19:50 (changed)
> getSelectedText
> | m interval text |
> - m := self codeTextMorph ifNil: [^ ''].
> + m := self codeTextPane ifNil: [^ ''].
> interval := m selectionInterval.
> text := m text.
> ^ text copyFrom: interval first to: interval last
>
>
> Debugger>>tally {tally support} · ct 4/5/2022 19:46 (changed)
> tally
>
> - self codeTextMorph ifNotNil: [:o| o tallyIt] ifNil: [Beeper beep]
> + self codeTextPane ifNotNil: [:o | o tallyIt] ifNil: [Beeper beep]
>
>
> MCSaveVersionDialog>>accept {actions} · ct 4/5/2022 19:57 (changed)
> accept
> | logMessage logMessageWidget |
> self updateItems.
> - logMessage := (logMessageWidget := self findTextMorph: #logMessage) text asString.
> + logMessage := (logMessageWidget := self someTextPaneWithSelector: #logMessage) text asString.
> (logMessage isEmpty or: [logMessage beginsWith: 'empty log message'])
> ifTrue:
> - [(UIManager confirm: 'the log message is empty; are you sure you want to commit') ifFalse: [^ self]]
> + [(Project uiManager confirm: 'the log message is empty; are you sure you want to commit') ifFalse: [^ self]]
> ifFalse: [logMessageWidget accept].
> self answer: {
> - (self findTextMorph: #versionName) text asString.
> + (self someTextPaneWithSelector: #versionName) text asString.
> logMessage.
> ignore }
>
> MCSaveVersionDialog>>okToClose {actions} · ct 4/5/2022 19:57 (changed)
> okToClose
> - ^ (self findTextMorph: #logMessage)
> + ^ (self someTextPaneWithSelector: #logMessage)
> ifNil: [true]
> ifNotNil:
> [:widget | widget canDiscardEdits or: [self confirm: 'Version notes are not saved.
> Is it OK to discard those notes?' translated]]
>
> Model>>dependentTextPaneWithSelector: {*Tools-private} · ct 4/5/2022 19:42
> + dependentTextPaneWithSelector: selector
> +
> + ^ self dependents detect:
> + [:dependent | dependent isTextView and:
> + [dependent getTextSelector == selector]]
> + ifNone: [nil]
>
> Model>>someTextPaneWithSelector: {*Tools} · ct 4/5/2022 20:17
> + someTextPaneWithSelector: aSelector
> + "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."
> + ^ (self dependentTextPaneWithSelector: aSelector)
> + ifNil: [self textPaneWithSelector: aSelector]
>
> Model>>textPaneWithSelector: {*Tools-private} · mt 4/12/2015 19:45
> + textPaneWithSelector: aSelector
> + "If, among my window's paneMorphs, there is a text pane defined with aSelector as its retriever, answer it, else answer nil"
> +
> + | aWindow |
> + Smalltalk isMorphic ifFalse: [^ nil].
> + ^ (aWindow := self containingWindow) ifNotNil:
> + [aWindow paneMorphSatisfying:
> + [:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
> + [aMorph getTextSelector == aSelector]]]
>
> PluggableTextView>>tallyIt {as yet unclassified} · ct 4/5/2022 19:50
> + tallyIt
> +
> + self controller tallyIt.
>
> StringHolder>>codeTextMorph {*Tools} · ct 4/5/2022 20:16 (changed)
> codeTextMorph
> -
> - ^ self someTextPaneWithSelector: #contents
> + "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."
> +
> + | textPane |
> + textPane := self codeTextPane.
> + ^ textPane isMorph ifTrue: [textPane]
>
> StringHolder>>codeTextPane {*Tools} · ct 4/5/2022 20:16
> + codeTextPane
> + "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."
> +
> + ^ self someTextPaneWithSelector: #contents
>
> StringHolder>>selectedInterval {*services-base} · ct 4/5/2022 19:46 (changed)
> selectedInterval
> - ^self codeTextMorph selectionInterval
> + ^self codeTextPane selectionInterval
>
> StringHolderView>>accept {controller access} · ct 4/5/2022 19:59
> + accept
> +
> + ^ self controller accept
>
> StringHolderView>>text {controller access} · ct 4/5/2022 19:56
> + text
> +
> + ^ self displayContents text
>
> ["toolCodePane.2.cs"]
>
> ---
> Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220408/5d240c55/attachment-0001.html>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220505/c42840cf/attachment.html>
More information about the Squeak-dev
mailing list
|