use of com.intellij.refactoring.move.MoveHandler in project intellij-community by JetBrains.
the class JarRootsRefreshTest method checkMove.
private void checkMove(File jar, VirtualFile vFile, PsiFile file) {
VirtualFile jarRoot;
File libDir = new File(jar.getParent(), "lib");
assertTrue(libDir.mkdir());
VirtualFile vLibDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(libDir);
assertNotNull(vLibDir);
jarRoot = JarFileSystem.getInstance().getRootByLocal(vFile);
assertNotNull(jarRoot);
assertTrue(jarRoot.isValid());
PsiDirectory directory = getPsiManager().findDirectory(vLibDir);
DataContext psiDataContext = SimpleDataContext.getSimpleContext(LangDataKeys.TARGET_PSI_ELEMENT.getName(), directory);
new MoveHandler().invoke(myProject, new PsiElement[] { file }, psiDataContext);
assertFalse(jarRoot.isValid());
jarRoot = JarFileSystem.getInstance().getRootByLocal(vFile);
assertNotNull(jarRoot);
assertTrue(jarRoot.isValid());
rename(directory, "lib2");
assertFalse(jarRoot.isValid());
}
Aggregations