News:

Pretty crazy that we're closer to 2030, than we are 2005. Where did the time go!

Main Menu

[Eclipse] Change method signature

Started by Camel, December 08, 2007, 06:19:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Camel

Today, I realized that I had a fatal flaw in my plugin system: I needed to add a parameter to every event to indicate what the source of the event was.

Crap. There are 27 event methods defined in the interface, and the interface is implemented many times in my codebase. Rewriting this by hand was going to suck, so I started looking for a way to cheat. I found it.

I opened up my interface, right clicked on the first method > refactor > change method signature. A dialog pops up with all of the existing parameters; it allows you to add new fields, and a defualt value. When you click OK, it goes through your entire codebase and changes references to that method, using the default value for new fields.

What I estimated to be a couple of hours of work was compressed in to approximately ten minutes.

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Newby

Well done. Did you go through and verify by hand afterwards that everything was correct?
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Camel

I always look at a diff before I commit to SVN.

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!