2015-07-05 18:09 GMT+02:00 Peter Uhnák <[email protected]>: > And what would be the main benefit? Because there's no other usage of > editor from TextModel, so you would have to add extra instance variable and > method(s) just for this. > Right now it's separated just in the two methods (beFor*) ... look to > inbox at 15237. >
You could implement "self editor" with the TextModelAdapter and make the textmodel independent of any TextEditor/SmalltalkEditor. > > Peter > > On Sun, Jul 5, 2015 at 6:02 PM, Nicolai Hess <[email protected]> wrote: > >> >> >> 2015-07-05 13:06 GMT+02:00 Peter Uhnák <[email protected]>: >> >>> The cleaner way would be to use TextEditor as default EditorClass in >>>> TextModel "beForText" and SmalltalkEditor for "beForCode". >>>> With that, the menublock coude ask the editor class for the default >>>> menu (now it uses SmalltalkEditors menu as default) >>>> >>> >>> That would work only if the TextModel would always have some >>> EditorClass; so if you wanted your custom menu you would have to create a >>> new EditorClass object. >>> >> >> No, I meant specs TextModels default menuBlock could call its editor >> menus: >> >> menuHolder := [ :menu :shifted | shifted >> ifTrue: [ self editor shiftedYellowButtonMenu ] >> ifFalse: [ self editor yellowButtonMenu ] ] asValueHolder. >> >> and if you want your own menu you can set menuHolder to a new value (like >> we already do it now). >> >> >>> While this in principle is ok, Spec already has block-based API so I >>> would stick to it. >>> >> >> >
