Bug 538518

Summary: [extract local] variable replace all occurrences only in nearest enclosing block
Product: [Eclipse Project] JDT Reporter: Ori Marko <orimarko>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipse
Version: 4.9   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Ori Marko CLA 2018-09-03 00:10:48 EDT
I want an option to extract local variable only in nearest enclosing block, for example in the following the code, allow to change only inside if statements:

    if (myState.equals(STATE_ONE){
      if (myObj.getStatus() == ONE || myObj.getStatus() == TWO ) {
      }
      myObj.changeMe();
    }
    if (myObj.getStatus() == THREE || myObj.getStatus() == FOUR) {
    }
    myObj.changeMe2();
Comment 1 Holger Voormann CLA 2018-09-03 02:24:26 EDT
First asked on Stack Overflow: https://stackoverflow.com/q/52137330