mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] move to test root: NPE (EA-943438)
GitOrigin-RevId: e625fa12c785eb70ee7360e40bb2e8c16794a38b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
94948d7245
commit
10d7f78b70
@@ -68,6 +68,7 @@ public class MoveToTestRootFix extends LocalQuickFixAndIntentionActionOnPsiEleme
|
||||
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
|
||||
ModuleFileIndex fileIndex = rootManager.getFileIndex();
|
||||
if (!fileIndex.isInSourceContent(virtualFile)) return false;
|
||||
if (JavaDirectoryService.getInstance().getPackage(file.getContainingDirectory()) == null) return false;
|
||||
return getTestRoots(rootManager).findFirst().isPresent();
|
||||
}
|
||||
|
||||
@@ -107,6 +108,7 @@ public class MoveToTestRootFix extends LocalQuickFixAndIntentionActionOnPsiEleme
|
||||
if (sourceRoot == null) return;
|
||||
|
||||
PsiPackage targetPackage = JavaDirectoryService.getInstance().getPackage(myFile.getContainingDirectory());
|
||||
if (targetPackage == null) return;
|
||||
|
||||
PackageWrapper wrapper = PackageWrapper.create(targetPackage);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user