How are Quick Fix Proposals ordered in Quick Fix Dialog (or hover) [message #808819] |
Tue, 28 February 2012 02:13  |
Eclipse User |
|
|
|
Hi all,
I know that proposals offered for a particular compilation error can be retrieved through one of the following:
QuickFixProcessor.getCorrections()
or
JavaCorrectionProcessor.collectCorrections()
Is there a deterministic ordering for the retrieved proposals? In other words, are they
- ordered alphabetically?
- ordered by an internal typing guidance?
- ordered by some other heuristic?
As far as I can see in the source code, the proposals are generated depending on problem id. In this case, some methods (that generate proposals) are called in a deterministic order and if the related location is applicable for that proposal generation, the resulting proposal is generated. However, I am wondering if there is an easier guideline I can use to understand the ordering of proposal in Quick Fix Dialog list?
Thanks in advance, best regards,
|
|
|
|
Re: How are Quick Fix Proposals ordered in Quick Fix Dialog (or hover) [message #809106 is a reply to message #808997] |
Tue, 28 February 2012 08:35  |
Eclipse User |
|
|
|
Some quick answers...
On 2/28/2012 4:41 PM, Kivanc Muslu wrote:
> While digging up the code, I just realized that some classes (e.g.,
> IJavaCompletionProposal and TemplateProposal) contain getRelevance()
> method that is used in sorting the proposals before displaying.
Yup, we set the 'relevance' for the proposals in code.
> However, if the relevance is the same, are they then sorted
> alphabetically?
Not sure, I will have to check. (It is either that, or the order in
which they are added in the code)
> Are relevance constant values?
They are just integers from -10 to +10. Though the javadoc for
getRelevance() API specifies some other range ;-)
> Is there a place where I
> can see all of them?
Unfortunately no. The constants used are spread all over the place. This
is not an ideal situation even for us, as it is a PITA to try and assign
the correct relevance to a new quick fix. (See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=339223)
--
Deepak Azad
http://wiki.eclipse.org/JDT/FAQ
|
|
|
Powered by
FUDForum. Page generated in 0.07642 seconds