Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to automatically correct all class' package declarations(within a package?)
How to automatically correct all class' package declarations [message #525630] Wed, 07 April 2010 05:33 Go to next message
Eclipse UserFriend
I have a java package of classes. Say 100 classes. All of them have the incorrect package declaration. How can I automatically fix them so they reflect the current package that they are in?
Re: How to automatically correct all class' package declarations [message #525666 is a reply to message #525630] Wed, 07 April 2010 08:28 Go to previous messageGo to next message
Eclipse UserFriend
- Create the package they should be in.
- Copy all of them inside it (better do that outside Eclipse)
- Move them to the package you want to change them to.

OR

You could just move them around to some other package and then move them back to the package they should be in.

I recommend using the first method because the second one include refactoring classes with compile errors. That could cause unpredictable results.
Re: How to automatically correct all class' package declarations [message #525846 is a reply to message #525666] Wed, 07 April 2010 20:31 Go to previous message
Eclipse UserFriend
Vinicius Isola wrote:
> - Create the package they should be in. - Copy all of them inside it
> (better do that outside Eclipse)
> - Move them to the package you want to change them to.
>
> OR
>
> You could just move them around to some other package and then move them
> back to the package they should be in.
>
> I recommend using the first method because the second one include
> refactoring classes with compile errors. That could cause unpredictable
> results.

Hm, I think you can just right-click on the package in Package Explorer and
select "Refactor -> Rename". It will generally do the right thing, although you
should check to make sure that references in strings (for instance, if you are
loading classes reflectively) get properly fixed up.
Previous Topic:create javadoc automatically in eclipse
Next Topic:Inserting AST Nodes at every Statements
Goto Forum:
  


Current Time: Wed Mar 19 23:05:39 EDT 2025

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

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

Back to the top