public class MoveFilesOrDirectoriesUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
checkIfMoveIntoSelf(PsiElement element,
PsiElement newContainer) |
static void |
checkMove(PsiElement element,
PsiElement newContainer)
Checks if it is possible to move the specified PSI element under the specified container,
and throws an exception if the move is not possible.
|
static void |
doMove(Project project,
PsiElement[] elements,
PsiElement[] targetElement,
MoveCallback moveCallback) |
static void |
doMove(Project project,
PsiElement[] elements,
PsiElement[] targetElement,
MoveCallback moveCallback,
Function<PsiElement[],PsiElement[]> adjustElements) |
static void |
doMoveDirectory(PsiDirectory aDirectory,
PsiDirectory destDirectory)
Moves the specified directory to the specified parent directory.
|
static void |
doMoveFile(PsiFile file,
PsiDirectory newDirectory)
Moves the specified file to the specified directory.
|
static PsiDirectory |
getInitialTargetDirectory(PsiDirectory initialTargetElement,
PsiElement[] movedElements) |
static PsiDirectory |
resolveToDirectory(Project project,
PsiElement element) |
public static void doMoveDirectory(PsiDirectory aDirectory, PsiDirectory destDirectory) throws IncorrectOperationException
aDirectory
- the directory to move.destDirectory
- the directory to move dir
into.IncorrectOperationException
- if the modification is not supported or not possible for some reason.public static void doMoveFile(PsiFile file, PsiDirectory newDirectory) throws IncorrectOperationException
newDirectory.findFile(file.getName())
file
- the file to move.newDirectory
- the directory to move the file into.IncorrectOperationException
- if the modification is not supported or not possible for some reason.public static void doMove(Project project, PsiElement[] elements, PsiElement[] targetElement, MoveCallback moveCallback)
elements
- should contain PsiDirectories or PsiFiles onlypublic static void doMove(Project project, PsiElement[] elements, PsiElement[] targetElement, MoveCallback moveCallback, Function<PsiElement[],PsiElement[]> adjustElements)
elements
- should contain PsiDirectories or PsiFiles only if adjustElements == nullpublic static PsiDirectory resolveToDirectory(Project project, PsiElement element)
public static PsiDirectory getInitialTargetDirectory(PsiDirectory initialTargetElement, PsiElement[] movedElements)
public static void checkMove(PsiElement element, PsiElement newContainer) throws IncorrectOperationException
element
- the element to check the move possibility.newContainer
- the target container element to move into.IncorrectOperationException
- if the modification is not supported or not possible for some reason.public static void checkIfMoveIntoSelf(PsiElement element, PsiElement newContainer) throws IncorrectOperationException
IncorrectOperationException