public abstract class MoveFileHandler
extends java.lang.Object
Constructor and Description |
---|
MoveFileHandler() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canProcessElement(PsiFile element)
Checks whether a file can be handled by this move handler.
|
abstract 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.
|
static MoveFileHandler |
forElement(PsiFile element) |
abstract void |
prepareMovedFile(PsiFile file,
PsiDirectory moveDestination,
java.util.Map<PsiElement,PsiElement> oldToNewMap)
Performs any necessary modifications of the file contents before the move.
|
abstract 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.
|
abstract void |
updateMovedFile(PsiFile file)
Updates the contents of the file after it has been moved (e.g.
|
public abstract boolean canProcessElement(PsiFile element)
element
- the file being moved.public abstract void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, java.util.Map<PsiElement,PsiElement> oldToNewMap)
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 abstract java.util.List<UsageInfo> findUsages(PsiFile psiFile, PsiDirectory newParent, boolean searchInComments, boolean searchInNonJavaFiles)
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 abstract void retargetUsages(java.util.List<UsageInfo> usageInfos, java.util.Map<PsiElement,PsiElement> oldToNewMap)
usageInfos
- the list of references, as returned from findUsages(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, boolean, boolean)
oldToNewMap
- the map of all moved elements, filled by prepareMovedFile(com.intellij.psi.PsiFile, com.intellij.psi.PsiDirectory, java.util.Map<com.intellij.psi.PsiElement, com.intellij.psi.PsiElement>)
public abstract void updateMovedFile(PsiFile file) throws IncorrectOperationException
file
- the moved file.IncorrectOperationException
public static MoveFileHandler forElement(PsiFile element)