This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 231133 - Change The Hint Order Of Unknown Variables
Summary: Change The Hint Order Of Unknown Variables
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: Macintosh Mac OS X
: P3 normal with 1 vote (vote)
Assignee: markiewb
Depends on:
Reported: 2013-06-12 12:10 UTC by abien
Modified: 2014-04-24 02:11 UTC (History)
2 users (show)

See Also:
Exception Reporter:

Proposed patch (3.06 KB, patch)
2014-04-02 17:42 UTC, markiewb
Details | Diff
Patch in action (20.87 KB, image/png)
2014-04-02 17:43 UTC, markiewb

Note You need to log in before you can comment on or make changes to this bug.
Description abien 2013-06-12 12:10:52 UTC
Product Version = NetBeans IDE Dev (Build 201306100004)
Operating System = Mac OS X version 10.8.4 running on x86_64
Java; VM; Vendor = 1.7.0_21
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.21-b01

Usually I write code like: = "hugo";

then press alt-enter and use NB for the creation of fields (=less typing).

However NB suggests "Search Dependency at Maven Repositories" first, then create field. I would like to change the order of the hints, because it is more likely to choose the "create field". Then one could just press alt+enter then enter without hitting the down button.
Comment 1 markiewb 2013-11-16 13:01:14 UTC
@Svata: Could be solved via
Comment 2 markiewb 2014-04-02 17:42:36 UTC
Created attachment 146510 [details]
Proposed patch

@Svata: I like to propose a patch to solve this issue.

Hints can be sorted by implementing EnhancedFix#getSortText().
See its usage at org.netbeans.modules.editor.hints.FixData.getSortText(org.netbeans.spi.editor.hints.Fix):java.lang.CharSequence

a) So I updated AddParameterOrLocalFix and CreateFieldFix to implement EnhancedFix.

b) I also introduced a new default ordering with hackish "hardcoded prefix string" approach.
* create local variable
* create field
* create parameter

If you do not want the ordering of the "create XXX" fixes (because [1] will be implemented soon?) then simply return getText() in getSortText().

Comment 3 markiewb 2014-04-02 17:43:24 UTC
Created attachment 146511 [details]
Patch in action
Comment 4 Svata Dedic 2014-04-11 13:34:22 UTC
I think that #125577 is not a good solution here, as the parameter/field/variable decision highly depends on the exact context and may vary. Using ranking is a good choice for fix alternatives, which respect different code styles.

IMHO the fixes should be grouped into scope groups (local text fixes, environment fixes (like imports), project fixes, hint configuration), then maybe even more grouped so the infrastructure gets a clue what are really alternatives.

Integrated as jet-main#f4404bba495a; 
Thanks, markiewb :)
Comment 5 Quality Engineering 2014-04-24 02:11:10 UTC
Integrated into 'main-silver', will be available in build *201404240001* on (upload may still be in progress)

User: Svata Dedic <>
Log: #231133: increased priority of create* fixes over imports