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);
 }
示例#2
0
 @Override
 public int compareTo(@NotNull Object o) {
   Task task = (Task) o;
   return myIndex - task.getIndex();
 }