In Eclipse's "Package Explorer", let's say I have a list of packages like this:
If I want to rename the "com" part of the package structure to be "animal", then I could select each package (above) and perform a refactor > rename.
If I have many packages that start with "com", that process may take a while. Is there an easy way to rename the "com" package name without having to individually rename each package in the Package Explorer? or removing those packages from the build path before renaming?
I tried going to the "Navigator" pane where it displays the folders in a tree structure but I am not given the rename capability.
Rename a package In the Project tool window, click Project and select Packages from the list. IntelliJ IDEA lists all the packages in your project. Right-click the package you want to rename and from the context menu, select Refactor | Rename ( Shift+F6 ).
Right-mouse click in the repository view on the folder you want to rename and choose Rename path process. Rename the folder. Invoke "Add to Workspace". Perform synchronizing the Eclipse project folder and change will be reflected.
By default empty parent packages are hidden in the package explorer, if you modify the Filters... in the Package Explorer to uncheck Empty Parent Packages (third from top in second screenshot) you'll be able to see the empty packages.
(source: eclipse.org)
You can then rename the com package and check the Rename subpackages option to force all child packages to be renamed.
(source: eclipse.org)
Then when you're done reapply the filter to hide all those empty packages again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With