private void doTestAppResolveTest(String expectedAppDirName) throws Exception { PsiFile testappuserErl = myFixture.getFile(); assertTrue(testappuserErl instanceof ErlangFile); List<ErlangFile> directlyIncludedFiles = ErlangPsiImplUtil.getDirectlyIncludedFiles((ErlangFile) testappuserErl); assertEquals(1, directlyIncludedFiles.size()); PsiDirectory ebinDirectory = directlyIncludedFiles.get(0).getParent(); assertNotNull(ebinDirectory); PsiDirectory appDir = ebinDirectory.getParent(); assertNotNull(appDir); assertEquals(expectedAppDirName, appDir.getName()); }
private static void renameTask( @NotNull final Project project, Course course, @NotNull final PsiDirectory directory) { PsiDirectory lessonDir = directory.getParent(); if (lessonDir == null || !lessonDir.getName().contains(EduNames.LESSON)) { return; } Lesson lesson = course.getLesson(lessonDir.getName()); if (lesson == null) { return; } String directoryName = directory.getName(); Task task = lesson.getTask(directoryName); if (task != null) { processRename(task, EduNames.TASK, project); } }
@Nullable private static PsiDirectory findRes(@NotNull PsiFile file) { PsiDirectory resourceFolder = file.getParent(); return resourceFolder == null ? null : resourceFolder.getParent(); }