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 134648

Summary: Create Method hint: Wrong position of method and cursor
Product: java Reporter: Jan Becicka <jbecicka>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: blocker CC: jlahoda
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Jan Becicka 2008-05-07 07:33:12 UTC
.
.

    public String getName() {
(o)     test();
        return NbBundle.getMessage(QuickSearchAction.class, "CTL_QuickSearchAction");
    }

    @Override
    protected String iconResource() {
        return "org/netbeans/modules/jumpto/resources/edit_parameters.png";
    }

    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }

    @Override
    protected boolean asynchronous() {
        return false;
    }

    @Override
    public java.awt.Component getToolbarPresenter() {
        return retValue;
    }

| <--cursor
    private void test() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

I would expect, that test() method should be generated right after getName(), not at the end of class. User will lose
context of editing. And method body should be preselected. Otherwise user is forced to go into method, delete body and
then start coding.
Comment 1 Max Sauer 2008-07-01 13:59:45 UTC
Method body preselection has been fixed as part of
http://hg.netbeans.org/main/rev/25b7ec83be0c

Comment 2 Max Sauer 2008-07-08 09:17:40 UTC
The method position is not easy to correct and changes would be possibly inconsistent with other generation behaviour -- currently, we insert the method 
at the end of block of class members with same priority (GeneratorUtilities ClassMemberComparator).