Kai B. Heinz
Kai B. Heinz

Reputation: 71

Modify Java source code programmatically


I used the EMF ANT-Task XSD2Java to generate Java code from an existing XSD. Unfortunately the ANT-Task works not as correct as the manual tool and generates a package like 'org.example.interface.something'. Thus the key-word 'interface' is not allowd as a package name I want to refactor it to make the code run. (btw doing it via the UI the package name is 'org.example.interface_.something') My question is: How to refactor the package name including dependencies in the source files? Can I use JDT and if, how? Thanks for any hints.
Kai

Upvotes: 2

Views: 695

Answers (2)

user256717
user256717

Reputation:

As tjameson suggested,

find -name *.java | 
xargs sed -i s/org.example.interface.something/org.example.interface_.something/g

will work?

Upvotes: 0

Sylar
Sylar

Reputation: 2333

Right-click the package name in the package explorer. Then from the menu click Refactor -> Rename.

enter image description here

Upvotes: 1

Related Questions