Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:13 Go to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
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 11:11 Go to previous messageGo to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
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 13:35 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
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: Thu Apr 25 15:33:55 GMT 2024

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

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

Back to the top