When I need to provide Interface implementations or specialized classes
I often create anonymous inner classes. When the class stays small and
the isn't need at several places I keep the class where it is but when
not I want to move it to a top level class that has its own file. Of
course I can do copy&paste but with all the refactoring
possibilities that Eclipse offers this seems to be a little bit lame.
So I've searched a little bit and found a solution with Eclipse 3.6.1.
Put the cursor in the anonymous class you want to extract, select Refactor->Convert Anonymous Class
to Nested... from the menu (no shortcut :-( ) and give the new
class a good name. Then put the cursor on the newly created class and
select Refector->Move Type to
New File... from the menu (again no shortcut).
Now you've got your top level class but it hasn't saved you much
clicks. On the other hand it is very likely that you need to create a
constructor between step one and two and this will take more than the
three clicks you need to put your cursor in the code, select the menu,
and then the menu entry.