Is there an easy way to override an inherited class?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there an easy way to override an inherited class?

Tim M
When I turn on the "Show inherited methods" option, and see a class
that I would like to override (possibly a subclassResponsibility) - is
there an easy way to override it without have to retype the selector
etc.

Unfortunately the method pane is grayed out for inherited methods, so
you can't just type away and then save it in the current class's
context (other versions of smalltalk allow this).

Instead I seem to find myself, doing a select all (with the mouse)
-then click on the method again, type Alt+m N and then a paste.

Its quite a lot of keystrokes and mouse movements - and could be a big
time saver. I was kind of hoping there might a context menu item
"Override" which would do this for me - but wondering if there is
something I've not spotted.

Tim


Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to override an inherited class?

Tim M
Correction: meant to say easy way to override an inherited method!


Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to override an inherited class?

Chris Uppal-3
In reply to this post by Tim M
TimM wrote:

> Unfortunately the method pane is grayed out for inherited methods, so
> you can't just type away and then save it in the current class's
> context (other versions of smalltalk allow this).

Drag and drop (again) will do it.  Drag it across to the class entry in the
tree pane.

Incidentally, while I'm on the subject, you can also move/copy methods between
instance-side and class-side by dropping them over the "Instance" or "Class"
tabs (not sure how this works in D6).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to override an inherited class?

Tim M
Great tip - that works reasonably well.

I still wish there was a keyboard way of doing it, but I suppose I can
investigate that side of things.

Tim


Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to override an inherited class?

Blair McGlashan-3
"TimM" <[hidden email]> wrote in message
news:[hidden email]...
> Great tip - that works reasonably well.
>
> I still wish there was a keyboard way of doing it, but I suppose I can
> investigate that side of things.

In the next D6 beta there is a refactoring command to do this.

You might also be interested to know of the new "Implement In" feature in
the browsers that is similar to the Debugger functionality. Essentially you
can click over any message send in the browser, and issue a command to
implement that in an appropriate class. For example for 'self' sends you get
the option to implement in the class itself, or any of its superclasses.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to override an inherited class?

Blair McGlashan-3
In reply to this post by Chris Uppal-3
"Chris Uppal" <[hidden email]> wrote in message
news:4300b03a$0$38045$[hidden email]...
>...
> Incidentally, while I'm on the subject, you can also move/copy methods
> between
> instance-side and class-side by dropping them over the "Instance" or
> "Class"
> tabs (not sure how this works in D6).
>

Drop over the instance/class radio buttons. Or if dragging between two
browsers you can drop over the method list pane. The methods will be dropped
on the class/instance side, depending on which mode the browser is in. In
contrast if you drop over a class in the tree (or list in the system
browser) then the methods will always go to the same side as they are in the
source.

Regards

Blair