Rename processor

Hello.I try to implement automatic refactoring.
For example i have class

namespace Test{
class UserController {
  public  function actionEdit(){

  }
}
}


I have some strings in my code that is reference to this action:
test/userController/actionEdit

When i rename class or method i whant to change this trings.This section i alredy done via  RenamePsiElementProcessor
If i rename method to actionEditUser all strings become
test/userController/actionEditUser

But when i move class from one namespace to other RenamePsiElementProcessor doesn`t fire.
Question:
How to catch class move from one namespace to other and change other strings?

3 comments
Comment actions Permalink

here is how to catch package renamed event:

1) implement EP refactoring.elementListenerProvider

2) implement RefactoringElementListener:

public void elementRenamed(@NotNull PsiElement psi) {
  if (!(psi instanceof PsiPackage)) return;

      // 3) implement the processFilesInPackage method
      processFilesInPackage((PsiPackage) psi);    
}

0
Comment actions Permalink

Please take a look to com.intellij.refactoring.move.MoveHandlerDelegate

On 9/16/2015 1:47 PM, ivan sh wrote:

Hello.I try to implement automatic refactoring.
For example i have class
namespace Test{
  class UserController {
   public  function actionEdit(){

>

   }
  }
}

>

I have some strings in my code that is reference to this action:
test/userController/actionEdit

>

When i rename class or method i whant to change this trings.This section i alredy done via  RenamePsiElementProcessor
If i rename method to actionEditUser all strings become
test/userController/actionEditUser

>

But when i move class from one namespace to other RenamePsiElementProcessor doesn`t fire.
Question:
How to catch class move from one namespace to other and change other strings?

>

---
Original message URL: https://devnet.jetbrains.com/message/5558471#5558471

>

0
Comment actions Permalink

Thanks for help. When i will have result i will post it here.
As i can see OPEN API documentation does not cover this request. If someone have documenation about this feature, please share a link.

0

Please sign in to leave a comment.