Jason
Jason

Reputation: 12789

Shortcut for changing package name declaration in java

We have a simple java project in eclipse and we have migrated package name for an already existing source code. Is there a shortcut for changing package name declarations while you are inside the code editor

Upvotes: 5

Views: 12001

Answers (4)

drekka
drekka

Reputation: 21883

Refactoring is the best way, however be wary of changing package names if your source is under version control. I've had all sorts of conflict, update issues with changing package names because of the sequence of commits done (to SVN). It does work, just can be tricky to get everything commited correctly and the repository and working directory correctly in sync.

Upvotes: 2

Mahendra Liya
Mahendra Liya

Reputation: 13218

Just select your package and press-hold the Alt-Shift-R keys. Alternatively, you can select your package, right click it and select Refactor -> Rename.

Hope this helps.

Regards, Mahendra Liya.

Upvotes: 1

Mudassir
Mudassir

Reputation: 13184

When you change the structure of a project, eclipse prompts you to update the references. If you allow eclipse, it will do it automatically. Now, you can perform a Find & Replace operation to manually update you package names.

Upvotes: 0

Michael Mrozek
Michael Mrozek

Reputation: 175585

Select the package name, and use Refactor -> Rename (Shift+Alt+R) to open the Rename Package dialog

Upvotes: 8

Related Questions