Reputation: 7206
I know there is re-sharper for Visual Studio, but is there a really good refactoring tool for Eclipse that is better than the small amount of built in refactors?
Preferably something free.
(Update)
Looking to do things like take all string literals in a file and make them constants.
Solve lots of PMD errors in some automated fashion.
Upvotes: 7
Views: 2857
Reputation: 20091
Jackpot is a refactoring language built into javac. It was James Gosling's project, and became the heart of the Netbeans refactoring module. It's essentially a pattern matching language, matching over the AST.
With it, you can write your own patterns.
Upvotes: 2
Reputation: 4371
A fairly recent (as of Jan 2023) project along these lines is Alpha astra.
https://github.com/alfasoftware/astra
It is based on Eclipse JDT so may be more easily integrated with Eclipse than the Jackpot project used by NetBeans. I personally just use NetBeans.
Upvotes: 0
Reputation: 1490
I know you would prefer a free plug in for Eclipse, but if you love ReSharper and have to work with Java, check out InteliJ IDEA http://www.jetbrains.com/idea/index.html. It was the original inspiration for ReSharper and is also developed by JetBrains. I believe it has most of the same refactoring capabilities of RS and also supports the same keyboard scheme (if you chose to use the inteliJ scheme in VS.) If you do try it, let us C# guys know how it compares to your RS experience.
Upvotes: 4
Reputation: 3458
This does not really answer your question but I can't properly format this into a comment.
Here is a nice way to extract Strings into constant in eclipse. (I didn't know about the pick out string until a couple of weeks ago)
We have this line:
System.out.println("This Line Contains a constant The 42 Constant that is stuck inside");
First let mark the desireed constant with our mouse cursor and ctrl-1 + "pick out selected String", the result is:
System.out.println("This Line Contains a constant " + "The 42 Constant" +" that is stuck inside");
Now you can put your mouse cursor on the picked out constant and Alt+Shift+T and than a (extract constant) that will generate the constants THE_42_CONSTANT as a private static final String
private static final String THE_42_CONSTANT = "The 42 Constant";
...
...
System.out.println("This Line Contains a constant " + THE_42_CONSTANT+ " that is stuck inside");
Hope this is what you are actually looking for, of course you can adjust hot-keys for the aboe actions in eclipse
Upvotes: 2
Reputation: 2483
Some plugins like Checkstyle plug into the quick fix framework and do allow mass fixes at once. But what you're looking for should plug into the existing refactoring framework, not replace it.
Upvotes: 0