public class MoveJavaFileHandler extends MoveFileHandler
Constructor and Description |
---|
MoveJavaFileHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
canProcessElement(PsiFile element)
Checks whether a file can be handled by this move handler.
|
java.util.List<UsageInfo> |
findUsages(PsiFile psiFile,
PsiDirectory newParent,
boolean searchInComments,
boolean searchInNonJavaFiles)
Finds the list of references to the file being moved that will need to be updated during the move refactoring.
|
void |
prepareMovedFile(PsiFile file,
PsiDirectory moveDestination,
java.util.Map<PsiElement,PsiElement> oldToNewMap)
Performs any necessary modifications of the file contents before the move.
|
void |
retargetUsages(java.util.List<UsageInfo> usageInfos,
java.util.Map<PsiElement,PsiElement> oldToNewMap)
After a file has been moved, updates the references to the file so that they point to the new location of the file.
|
void |
updateMovedFile(PsiFile file)
Updates the contents of the file after it has been moved (e.g.
|
forElement
public boolean canProcessElement(PsiFile element)
MoveFileHandler
canProcessElement
in class MoveFileHandler
element
- the file being moved.public void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, java.util.Map<PsiElement,PsiElement> oldToNewMap)
MoveFileHandler
prepareMovedFile
in class MoveFileHandler
file
- the file being moved.moveDestination
- the directory to which the file is being moved.oldToNewMap
- the map of elements which can be referenced from other files directly (not through a file reference)
to their counterparts after the move. The handler needs to add elements to this map according to the
file modifications that it has performed.public java.util.List<UsageInfo> findUsages(PsiFile psiFile, PsiDirectory newParent, boolean searchInComments, boolean searchInNonJavaFiles)
MoveFileHandler
findUsages
in class MoveFileHandler
psiFile
- the file being moved.newParent
- the directory to which the file is being moved.searchInComments
- if true, search for references in comments has been requested.searchInNonJavaFiles
- if true, search for references in non-code files (such as .xml) has been requested.public void retargetUsages(java.util.List<UsageInfo> usageInfos, java.util.Map<PsiElement,PsiElement> oldToNewMap)
MoveFileHandler
retargetUsages
in class MoveFileHandler
usageInfos
- the list of references, as returned from MoveFileHandler.findUsages(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, boolean, boolean)
oldToNewMap
- the map of all moved elements, filled by MoveFileHandler.prepareMovedFile(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, java.util.Map<com.intellij.psi.PsiElement, com.intellij.psi.PsiElement>)
public void updateMovedFile(PsiFile file) throws IncorrectOperationException
MoveFileHandler
updateMovedFile
in class MoveFileHandler
file
- the moved file.IncorrectOperationException