Question

In order to write a quick fix processor plug-in for Eclipse, ones have to write a class that implements the IQuickFixProcessor interface and overrides its two method: getCorrections and hasCorrections.

I have successfully written the codes in getCorrections and got the quick fix utility to work, but I have no clue what should I write in hasCorrections.

My prior guess is that if it return false, it indicates that the processor have no proposal to fix the current problem and otherwise if true. And consequently, I expected that upon setting it to return false, my quick fix proposal will not be shown when the problem occurs, but it is not the case: there is no different no matter it return true or false.

Was it helpful?

Solution

The source code is a bit hard to read but it looks like it is used when the quick fix code wants to know if anything has corrections, if something does have corrections it calls everything to get the corrections. If nothing has corrections it does not ask for the corrections.

Source is org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top