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 229684 - Patch for: [Create Field hint] show fieldname in hint label
Summary: Patch for: [Create Field hint] show fieldname in hint label
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: markiewb
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-05-13 21:40 UTC by markiewb
Modified: 2014-07-30 02:33 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch (3.57 KB, patch)
2013-05-13 21:43 UTC, markiewb
Details | Diff
Patch in action (17.03 KB, image/png)
2013-05-13 21:45 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-05-13 21:40:56 UTC
The "Create Field" hint should display the field name too.

Example A)
----------
public class NewClass { 
    public NewClass(String a|, String b, String c ) {
    }
}

Note: | defines the current position of the caret

* invoke fix code, all suitable hints are displayed
ACTUAL:   hint with label "Create Field" is shown
EXPECTED: hint with label "Create Field 'a'" is shown

Example B)
----------
public class NewClass { 
    private final String a;
    public NewClass(String a|, String b, String c ) {
    }
}

Note: | defines the current position of the caret

* invoke fix code, all suitable hints are displayed
ACTUAL:   hint with label "Assign to Existing Field" is shown
EXPECTED: hint with label "Assign to Existing Field 'a'" is shown
Comment 1 markiewb 2013-05-13 21:43:55 UTC
Created attachment 134396 [details]
Proposed patch

I like to propose a patch to solve the issue. It shows the fieldname in the label of the hint. See the screenshot (to be attached)

@Jan: Please review and commit, if appropriate. Thank you!
Comment 2 markiewb 2013-05-13 21:45:16 UTC
Created attachment 134397 [details]
Patch in action
Comment 3 markiewb 2013-05-13 21:52:53 UTC
@Jan: If you like/you have time, you could also add the target class in the label too and thus resolve https://netbeans.org/bugzilla/show_bug.cgi?id=135962 ?!
Comment 4 Jan Lahoda 2013-06-01 20:04:00 UTC
Looks good, thanks, except I don't think the "if (treePath.getLeaf().getKind() == Kind.VARIABLE)" is needed - treePath.getLeaf() is already casted to VariableTree before, and a local variable exists for it ("var"). I can simplify the patch for you, if you wish.

I am also thinking if the warning message should not be dropped (the warning messages for suggestions are typically only confusing to users), but that does not need to be decided/resolved here.
Comment 5 markiewb 2013-06-01 20:55:24 UTC
(In reply to comment #4)
> Looks good, thanks, except I don't think the "if (treePath.getLeaf().getKind()
> == Kind.VARIABLE)" is needed - treePath.getLeaf() is already casted to
> VariableTree before, and a local variable exists for it ("var"). I can simplify
> the patch for you, if you wish.
> 
> I am also thinking if the warning message should not be dropped (the warning
> messages for suggestions are typically only confusing to users), but that does
> not need to be decided/resolved here.

Hi Jan. Feel free to change the patch as you need/like. The visible result is more important for me - not the tiny details. If you want me to provide a more suitable patch then tell me and i will provide it...
Comment 6 markiewb 2014-07-09 21:55:10 UTC
@Svata: Please review the patch
Comment 7 Svata Dedic 2014-07-17 12:00:27 UTC
Patch applied as jet-main#a2295e25a223
(minor polishing).
Comment 8 markiewb 2014-07-26 10:23:49 UTC
@Dusan: Not yet integrated? I cannot see the issue fixed in Product Version: NetBeans IDE Dev (Build 201407260001)
Comment 9 Quality Engineering 2014-07-30 02:33:50 UTC
Integrated into 'main-silver', will be available in build *201407300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/a2295e25a223
User: Svata Dedic <sdedic@netbeans.org>
Log: #229684: field names displayed in hint label (patch by Markiweb)