Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Using MoveClassesOrPackagesRefactoring to refactor a java file

$
0
0

I am trying to write a code which  can refactor an input project. I know the file I want to refactor and I  want to create a new package in which I want to move this file.  (Although unconventional but the file could contain multiple classes and  I would want the refactoring to work with such a file too).

 

 

I  saw that IntelliJ does this brilliantly through the IDE. I also see  that there is an openapi available to use the code of Intellij.

 

 

I saw that I could use the class MoveClassesOrPackagesRefactoring to achieve this.

 


What  I can't figure out however, is that how do I give the input project  folder to the API and also the output folder where I want the refactored  code to be put. If output folder cannot be given, I am ok with  refactoring the same input project.

I would really appreciate  if you could give me a sample code which I  could use to achieve my  purpose, or help me understand how to achieve  moving a java file to  another package.

Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>