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 211719

Summary: Inline only selected method call
Product: java Reporter: Jiri Prox <jiriprox>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 7.2   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description Jiri Prox 2012-04-25 14:34:40 UTC
The only one selected method call should be inlined when inline refactoring is called on method call, not on the method declaration.

Motivation:

1) I have test class:
    @Test
    public void testSelectWord3() {        
        doTest("This is a sample text", 23,"text",10,16);        
    }
    
    @Test
    public void testSelectWord4() {                        
        doTest("This is a  sample text", 10,"",10,10);        
    }

    private void doTest(String text, int caretPos,String res,int start, int end) {
        Selection result = Utils.selectWord(text, caretPos);
        assertEquals(res,text.subSequence(result.getStart(), result.getEnd()));        
        assertEquals(10, result.getStart());
        assertEquals(10, result.getEnd());
    }

2) I want to modify the testSelectWord4 to do something slightly different than doTest do. So I would select the doTest call and invoke inline

Current state:
All doTest calls are inlined. So I have to use copy/paste and manually correct the method parameters

Expected state:
Only one call is inlined and I can continue with modifying the code
Comment 1 Ralph Ruijs 2012-04-25 15:01:00 UTC
After a small discussion with Jirka, the problem consists of two parts.

The most logical solution would be to invoke inline and unselect the changes the user does not want. In this case all except the one occurrence. This is not easy to do because of #206043.

A more consistent solution would be to have the option "inline all occurrences". But, instead of creating a configuration dialog, should probably work inplace, like rename.