Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Move class to its own file
Move class to its own file [message #227011] Sat, 11 August 2007 10:01 Go to next message
Eclipse UserFriend
Originally posted by: sreddy30.csc.com

Hi,

I am new to Eclipse IDE. I worked in JDeveloper earlier. I have a java
file that contains multiple classes. I wish to move each of them to their
own file with classname.java. I could easily do it in JDeveloper. But in
eclipse 3.2, i could not do it. I have found only one option Move when i
select the class. But to move the text to a new file, that file must be
present already. I find this little cumbersome. Can you please suggest me
any easy way to do this.

Thanks,
Suresh
Re: Move class to its own file [message #227017 is a reply to message #227011] Sat, 11 August 2007 10:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Suresh,

I'm not sure this works for 3.2, but at least in 3.3 you can select the
class (use Edit->Expand Selection To->Enclosing Element), copy it, and
then paste it into the package where you want it. You can use
Source->Organize Imports on the result. All these actions have hot keys.


Suresh wrote:
> Hi,
>
> I am new to Eclipse IDE. I worked in JDeveloper earlier. I have a
> java file that contains multiple classes. I wish to move each of them
> to their own file with classname.java. I could easily do it in
> JDeveloper. But in eclipse 3.2, i could not do it. I have found only
> one option Move when i select the class. But to move the text to a new
> file, that file must be present already. I find this little
> cumbersome. Can you please suggest me any easy way to do this.
>
> Thanks,
> Suresh
>
Re: Move class to its own file [message #227029 is a reply to message #227017] Sat, 11 August 2007 10:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sreddy30.csc.com

Yes. I have tried the same thing in 3.2. It is working fine.
Thanks for the help.
Re: Move class to its own file [message #227205 is a reply to message #227029] Mon, 13 August 2007 13:31 Go to previous message
Eclipse UserFriend
Originally posted by: benno_baumgartner.ch.ibm.com

Suresh wrote:
> Yes. I have tried the same thing in 3.2. It is working fine.
> Thanks for the help.
>

You can also select the inner class and then invoke Refactor>Convert
Member Type to Top Level...

But you are right, we could be smarter here and allow to drop an inner
class onto a package: https://bugs.eclipse.org/bugs/show_bug.cgi?id=8678

HTH
Benno
Previous Topic:How can I use EMF Compare programatically
Next Topic:Modal Popup/Infopop?
Goto Forum:
  


Current Time: Fri Apr 26 18:37:44 GMT 2024

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

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

Back to the top