Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 211719 - Inline only selected method call
Inline only selected method call
Status: NEW
Product: java
Classification: Unclassified
Component: Refactoring
7.2
PC Windows 7
: P2 (vote)
: 7.3
Assigned To: Ralph Ruijs
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-25 14:34 UTC by Jiri Prox
Modified: 2012-04-25 15:01 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo