private void deleteTaskFile(Course course, VirtualFile removedFile) { VirtualFile taskDir = removedFile.getParent(); if (taskDir == null || !taskDir.getName().contains("task")) { return; } VirtualFile lessonDir = taskDir.getParent(); if (lessonDir == null || !lessonDir.getName().contains("lesson")) { return; } VirtualFile courseDir = lessonDir.getParent(); if (!courseDir.getName().equals(myProject.getName())) { return; } Lesson lesson = course.getLesson(lessonDir.getName()); if (lesson == null) { return; } Task task = lesson.getTask(taskDir.getName()); if (task == null) { return; } TaskFile taskFile = task.getTaskFile(removedFile.getName()); if (taskFile == null) { return; } String name = CCProjectService.getRealTaskFileName(removedFile.getName()); task.getTaskFiles().remove(name); }
private void deleteTask(Course course, VirtualFile removedFile) { VirtualFile lessonDir = removedFile.getParent(); if (lessonDir == null || !lessonDir.getName().contains("lesson")) { return; } VirtualFile courseDir = lessonDir.getParent(); if (!courseDir.getName().equals(myProject.getName())) { return; } Lesson lesson = course.getLesson(lessonDir.getName()); if (lesson == null) { return; } Task task = lesson.getTask(removedFile.getName()); if (task == null) { return; } lesson.getTaskList().remove(task); lesson.getTasksMap().remove(removedFile.getName()); }