Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How are Quick Fix Proposals ordered in Quick Fix Dialog (or hover)
How are Quick Fix Proposals ordered in Quick Fix Dialog (or hover) [message #808819] Tue, 28 February 2012 02:13 Go to next message
Eclipse UserFriend
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 #808997 is a reply to message #808819] Tue, 28 February 2012 06:11 Go to previous messageGo to next message
Eclipse UserFriend
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.

However, if the relevance is the same, are they then sorted alphabetically? Are relevance constant values? Is there a place where I can see all of them?

Thanks,
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Problems running java application MAC OSX Lion
Next Topic:eclipse JDT - how to set the background color of the tooltips window in Java editor ?
Goto Forum:
  


Current Time: Fri May 16 08:10:38 EDT 2025

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

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

Back to the top