I have a block of about 20 lines of code that heavily uses a specific variable name many times.
I want to copy those lines of code to create another one of these variables, obviously using a different name.
So I click on the variable name in the its declaration of the new block of code. But when I press ALT + SHIFT + R
to Rename it and all the subsequent ones, Eclipses highlights every single one in the document and slates them for change.
How do I specify that I only want the following variables to be selected?
I discovered that what I'm trying to do works if I'm redeclaring an earlier variable.
For example if I said:
SomeClass something = new SomeClass(Stuff, Stuff);
methodCall1(Something);
something.coolMethod();
and wanted to copy and paste that as another object and rename the variable, I would just copy/paste it, and put the pointer in the new something
,press ALT + SHIFT + R
and only subsequent something
would be highlighted for change.
SomeClass anotherThing= new SomeClass(Stuff, Stuff);
methodCall1(anotherThing);
anotherThing.coolMethod();
I believe this is because I have redeclared the variable, so Eclipse knows not to go before it. However if I was copying a series of method calls made by one object and trying to rename them to work with another object, I couldn't use ALT + SHIFT + R