Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Rename Java Package programmatically(and rename subpackages)
Rename Java Package programmatically [message #669373] Tue, 10 May 2011 06:26 Go to next message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Hello,
I am trying to rename a java package programmatically.
Everything works fine so far, except the renaming of subpackages.
Lets assume the following package structue:

classmodel
classmodel.test
classmodel.test.subtest

If I rename the package classmodel.test to classmodel.testing I want the package subtest to be renamed to this path as well. The new structure should be

classmodel
classmodel.testing
classmodel.testing.subtest

Any suggestions how to handle this?
This:
IPackageFragment lPackage = getPackageToRename(lPath);
RenameSupport lSupport = RenameSupport.create(lPackage,lNewName, UPDATE_REFERENCES | UPDATE_TEXTUAL_MATCHES);
lSupport.perform(lParentWindow.getShell(), lParentWindow);

renames the package but doesn't rename the subpackage test.subtest to testing.subtest...

Regards
Alex

[Updated on: Tue, 10 May 2011 06:27]

Report message to a moderator

Re: Rename Java Package programmatically [message #669675 is a reply to message #669373] Wed, 11 May 2011 06:59 Go to previous message
Alexander Mack is currently offline Alexander MackFriend
Messages: 100
Registered: July 2009
Senior Member
Hello again,
I found a way by searching all subpackes for a given package to rename and then rename each subpackage apart.
It's not the best solution in my opinion but I am still woundering if the JDT framework does support such a feature...?!

Regards
Alex
Previous Topic:Eclipse Forgets how to Build
Next Topic:JRE not recognized by execution environment
Goto Forum:
  


Current Time: Fri Mar 29 15:05:16 GMT 2024

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

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

Back to the top