Reputation: 93
I have hundreds of projects in my workspace, some of which are dependent on others. I have a generated Java file (Example.java) with static fields that are being referenced throughout the codebase. I have also generated files within specific modules that have these static fields. I want to migrate the references to the fields to the modularized version of the fields that belong in the specific packages.
For instance, Example.java contains:
public static final ObjectType OT1 = ObjectTypeFactory.makeObject("OT1");
public static final ObjectType OT2 = ObjectTypeFactory.makeObject("OT2");
public static final ObjectType OT3 = ObjectTypeFactory.makeObject("OT3");
Then Modularized Java files within the packages look something like:
Mod1.java
public static final ObjectType OT1 = ObjectTypeFactory.makeObject("OT1");
Mod2.java
public static final ObjectType OT2 = ObjectTypeFactory.makeObject("OT2");
Mod3.java
public static final ObjectType OT3 = ObjectTypeFactory.makeObject("OT3");
I want to move the references to Example.OT1 to Mod1.OT1 throughout my codebase, as well as change the rest of them. I have thousands of such changes to make.
Upvotes: 1
Views: 922
Reputation: 787
JDT supports refactoring scripts. However I have never used them so I do not know what is possible.
Otherwise you may try using Eclipse EASE coupled with the JDT APIs for refactoring and in particular the move static field refactoring.
Upvotes: 1