How call Eclipse Quick Fix programmatically [message #1391251] |
Mon, 30 June 2014 16:48 |
nitasha nitasha Messages: 1 Registered: June 2014 |
Junior Member |
|
|
I am writing an eclipse pulugin to use eclipse quick fix. My aim is to print list of all suggestions
proposed by eclipse quick fix in order to fix compiler errors in an active project. Note that I do not
want to fix compiler errors. In fact, I only want to print compiler errors with their eclipse quick fix
suggestions. For example, if the error is "Dublicate Method", then my program only prints the suggestion
that is "Rename the method".
To do that I extend "org.eclipse.jdt.ui.quickFixProcessors" and also extend class "QuickFixProcessor" class.
In addition, I add below code to new defined class to print proposed correction.
public class MyQuickFixProcessor extends QuickFixProcessor {
@Override
public IJavaCompletionProposal[] getCorrections(IInvocationContext context, IProblemLocation[] locations) throws CoreException {
IJavaCompletionProposal[] corrections = super.getCorrections(context, locations)
for (IJavaCompletionProposal correction : corrections) {
System.out.println(correction.getDisplayString());
}
}
The code works fine and it prints quick fix suggestions when I move mouse on a compiler error in the editor.
However, I want to know how can I call quick fix programmatically without moving mouse on the compiler error?
In fact, call quick fix for all compiler errors programmatically. Note that I have the compiler error and all
its detailed information such as its location.
|
|
|
Powered by
FUDForum. Page generated in 0.03306 seconds