views:

130

answers:

3

I am trying to refactor a class I have into 2 classes. Unfortunately eclipse's extract class function seems to only support the variables which really isn't all that helpful. Is there a way to do it that extracts the methods or Is there a plugin that does it? Thanks

+3  A: 

The "Extract Superclass" refactoring is much more useful for this. It will allow you to pick the members and the methods you want, and then use "Add Required" to add any members of the class that are required to make the methods you chose work.

jprete
ahh man. I really wish there was a better option. That requires so much more work, though better than nothing I suppose
John Baker
+4  A: 

One other solution is to CTRL C-CTRL V your class into another one, and start removing what you do not want...

You can select multiple elements in the outline view of the new class and select delete.
Crude but effective.

alt text

VonC
Ahh great idea to use the outline view. I was using copy paste but this would help a lot
John Baker
A: 

Right now, I have resorted to using "copy class and delete methods" as described above or using IntelliJ's Extract Class, which does move both methods and classes, albeit buggily.

I'm hoping that others will vote for fixing bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=312347. I'd really like Eclipse to have a fully functioning extract class.

kc2001