Search in sources :

Example 1 with SafeDeleteHandler

use of com.intellij.refactoring.safeDelete.SafeDeleteHandler in project android by JetBrains.

the class AndroidSafeDeleteTest method testDeleteComponent.

public void testDeleteComponent() {
    myFixture.copyFileToProject(TEST_FOLDER + "f1.xml", "AndroidManifest.xml");
    final VirtualFile activityFile = myFixture.copyFileToProject(TEST_FOLDER + "MyActivity.java", "src/p1/p2/MyActivity.java");
    myFixture.configureFromExistingVirtualFile(activityFile);
    final PsiFile psiActivityFile = PsiManager.getInstance(getProject()).findFile(activityFile);
    final PsiClass activityClass = ((PsiJavaFile) psiActivityFile).getClasses()[0];
    final DataContext context = DataManager.getInstance().getDataContext(myFixture.getEditor().getComponent());
    new SafeDeleteHandler().invoke(getProject(), new PsiElement[] { activityClass }, context);
    myFixture.checkResultByFile("AndroidManifest.xml", TEST_FOLDER + "f1_after.xml", true);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DataContext(com.intellij.openapi.actionSystem.DataContext) SafeDeleteHandler(com.intellij.refactoring.safeDelete.SafeDeleteHandler)

Aggregations

DataContext (com.intellij.openapi.actionSystem.DataContext)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 SafeDeleteHandler (com.intellij.refactoring.safeDelete.SafeDeleteHandler)1