Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How call Eclipse Quick Fix programmatically
How call Eclipse Quick Fix programmatically [message #1391251] Mon, 30 June 2014 16:48
nitasha nitasha is currently offline nitasha nitashaFriend
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.
Previous Topic:Eclipse doesn't recognize java 8 default method
Next Topic:save preferences between workspaces
Goto Forum:
  


Current Time: Sat Dec 07 21:15:50 GMT 2024

Powered by FUDForum. Page generated in 0.02650 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top