• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

[eclipse] and renaming packages

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know whether this belongs here or to the eclipse site...
I have an application with a deep package hierarchy, and I try
to refactor a packagename. Here is an example:
com.mycompany.product.serviceimplementation...
should be changed to
com.mycompany.newproduct.serviceimplementation...
I try doing this with eclipse by selecting the package "product" in the
package explorer, then right-click on rename and enter the new
package "newproduct" in the following pop-up. Clicking on continue
does create the new package, but it does not move the underlying
packages into the new package. Here are my questions:
Does eclipse support this?
If yes, is this an eclipse bug?
If no, are there any plugins/tools which will do this for me?
Best,
Rolf
 
Author
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rolf,
Well it might seem strange buy Eclipse is doing exactly what you told it to do. Moving the root package does not move all the resources in the subsequent packages because it is not clear that you would want that in every case.
To accomplish what you are looking to do you need to refactor all the packges under 'product' to be 'newproduct' i.e.
com.foo.product.bar
com.foo.product.baz
both have to be refactored.
Hope this helps!
 
Rolf Mueller
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bill,
That's the way how I do it right now, refactoring
all the top-packages by hand. But if you have hundreds
of them...
Isn't there any tool which helps changing the root
package names including all subsequent packages, so
that I can get
com.faa.product.bar
com.faa.product.baz
from
com.foo.product.bar
com.foo.product.baz ?
Thanks,
Rolf
 
Bill Dudney
Author
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I'm a bone head... I did not run this all the way through and it does not work...
Sorry for the false hope...
-bd-
OK, try this... (worked for me in 3.0M8, have not tried 2.1.x yet)
1) In the Package View - switch the layout to 'Hierarchal' (menu -> Layout -> Hierarchal)
2) Select 'Filters' for the Package View and choose to see 'empty parent packages'.
3) Rename the root package you wanted to update (i.e. faa to foo)
4) select the old parent package and 'open' it so you can see the tree underneath
5) select all the packages under this package that you want to refactor
6) select context menu->Refactor->Move
7) select the new parent package (i.e. foo) from the browser
8) click OK
You should be done, hopefully!
[ April 14, 2004: Message edited by: Bill Dudney ]
 
Rolf Mueller
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bill,
I got to point 6) select context menu->Refactor->Move
In the following "Move" popup, the root package WEB-INF/src appears,
but it is not expandable. I am using eclipse 2.1.2
in conjunction with p4eclipse and the tomcat plugin.
Looks like I have to check on the eclipse site.
Thanks for your help.
Rolf
[ April 14, 2004: Message edited by: Rolf Mueller ]
 
Message for you sir! I think it is a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic