Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Extract methods across classes?
Extract methods across classes? [message #335673] Mon, 20 April 2009 20:42 Go to next message
Al Mising name is currently offline Al Mising nameFriend
Messages: 123
Registered: July 2009
Senior Member
If I have something like this:

public void myMethod() {

System.out.println("Hello);
int y = 1;

for (int i = 0; i <= 99; i++) {
System.out.println("i = " + i);
}

y++;

for (int i = 0; i <= 99; i++) {
System.out.println("i = " + i);
}

}

and I highlight the first for loop and command it to extract into a
method, it will recognize that the 2nd for loop is the same and replace it
with a call to the new method, in addition of a call at the place of the
first for loop.

My question is, can it do this across methods? across classes?
Re: Extract methods across classes? [message #335678 is a reply to message #335673] Tue, 21 April 2009 09:59 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3801
Registered: July 2009
Senior Member
Al wrote:
> If I have something like this:
>
> public void myMethod() {
>
> System.out.println("Hello);
> int y = 1;
>
> for (int i = 0; i <= 99; i++) {
> System.out.println("i = " + i);
> }
>
> y++;
>
> for (int i = 0; i <= 99; i++) {
> System.out.println("i = " + i);
> }
>
> }
>
> and I highlight the first for loop and command it to extract into a
> method, it will recognize that the 2nd for loop is the same and
> replace it with a call to the new method, in addition of a call at the
> place of the first for loop.
>
> My question is, can it do this across methods? across classes?
It works but only inside one compilation unit.

Dani
>
>
>
Re: Extract methods across classes? [message #335682 is a reply to message #335678] Tue, 21 April 2009 14:12 Go to previous message
Al Mising name is currently offline Al Mising nameFriend
Messages: 123
Registered: July 2009
Senior Member
Thanks for your reply.
IntelliJ can do this across classes.
Something for the Eclipse team to consider, if they are not already doing
so.
Previous Topic:update Site Problem
Next Topic:signer information does not match
Goto Forum:
  


Current Time: Tue Nov 25 00:59:43 GMT 2014

Powered by FUDForum. Page generated in 0.02452 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software