@Override
 public void fileCreated(@NotNull VirtualFileEvent event) {
   final VirtualFile createdFile = event.getFile();
   final VirtualFile taskDir = createdFile.getParent();
   if (taskDir != null && taskDir.getName().contains(Task.TASK_DIR)) {
     int taskIndex = StudyUtils.getIndex(taskDir.getName(), Task.TASK_DIR);
     final VirtualFile lessonDir = taskDir.getParent();
     if (lessonDir != null && lessonDir.getName().contains(StudyNames.LESSON_DIR)) {
       int lessonIndex = StudyUtils.getIndex(lessonDir.getName(), StudyNames.LESSON_DIR);
       if (myCourse != null) {
         List<Lesson> lessons = myCourse.getLessons();
         if (StudyUtils.indexIsValid(lessonIndex, lessons)) {
           final Lesson lesson = lessons.get(lessonIndex);
           final List<Task> tasks = lesson.getTaskList();
           if (StudyUtils.indexIsValid(taskIndex, tasks)) {
             final Task task = tasks.get(taskIndex);
             final TaskFile taskFile = new TaskFile();
             taskFile.init(task, false);
             taskFile.setUserCreated(true);
             task.getTaskFiles().put(createdFile.getName(), taskFile);
           }
         }
       }
     }
   }
 }
 @Nullable
 public TaskFile getTaskFile(@NotNull final VirtualFile file) {
   if (myCourse == null) {
     return null;
   }
   final VirtualFile taskDir = file.getParent();
   if (taskDir == null) {
     return null;
   }
   final String taskDirName = taskDir.getName();
   if (taskDirName.contains(Task.TASK_DIR)) {
     final VirtualFile lessonDir = taskDir.getParent();
     if (lessonDir != null) {
       int lessonIndex = StudyUtils.getIndex(lessonDir.getName(), StudyNames.LESSON_DIR);
       List<Lesson> lessons = myCourse.getLessons();
       if (!StudyUtils.indexIsValid(lessonIndex, lessons)) {
         return null;
       }
       final Lesson lesson = lessons.get(lessonIndex);
       int taskIndex = StudyUtils.getIndex(taskDirName, Task.TASK_DIR);
       final List<Task> tasks = lesson.getTaskList();
       if (!StudyUtils.indexIsValid(taskIndex, tasks)) {
         return null;
       }
       final Task task = tasks.get(taskIndex);
       return task.getFile(file.getName());
     }
   }
   return null;
 }
 @Override
 public void actionPerformed(AnActionEvent e) {
   Project project = e.getProject();
   if (project == null) {
     return;
   }
   for (StudyActionListener listener : Extensions.getExtensions(StudyActionListener.EP_NAME)) {
     listener.beforeCheck(e);
   }
   final AnswerPlaceholder answerPlaceholder = getAnswerPlaceholder(e);
   if (answerPlaceholder == null) {
     return;
   }
   StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
   final StudyState studyState = new StudyState(studyEditor);
   if (answerPlaceholder.getTaskFile().getTask().hasSubtasks()) {
     StudySubtaskUtils.refreshPlaceholder(studyState.getEditor(), answerPlaceholder);
     return;
   }
   Document patternDocument =
       StudyUtils.getPatternDocument(
           answerPlaceholder.getTaskFile(), studyState.getVirtualFile().getName());
   if (patternDocument == null) {
     return;
   }
   AnswerPlaceholder.MyInitialState initialState = answerPlaceholder.getInitialState();
   int startOffset = initialState.getOffset();
   final String text =
       patternDocument.getText(new TextRange(startOffset, startOffset + initialState.getLength()));
   CommandProcessor.getInstance()
       .executeCommand(
           project,
           () ->
               ApplicationManager.getApplication()
                   .runWriteAction(
                       () -> {
                         Document document = studyState.getEditor().getDocument();
                         int offset = answerPlaceholder.getOffset();
                         document.deleteString(offset, offset + answerPlaceholder.getRealLength());
                         document.insertString(offset, text);
                       }),
           NAME,
           null);
 }
 @Nullable
 private static AnswerPlaceholder getAnswerPlaceholder(AnActionEvent e) {
   final Project project = e.getProject();
   if (project == null) {
     return null;
   }
   StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
   final StudyState studyState = new StudyState(studyEditor);
   if (studyEditor == null || !studyState.isValid()) {
     return null;
   }
   final Editor editor = studyState.getEditor();
   final TaskFile taskFile = studyState.getTaskFile();
   return taskFile.getAnswerPlaceholder(editor.getCaretModel().getOffset());
 }
 public void showNoSdkNotification(@NotNull final Project project) {
   final String text =
       "<html>No Python interpreter configured for the project<br><a href=\"\">Configure interpreter</a></html>";
   final BalloonBuilder balloonBuilder =
       JBPopupFactory.getInstance()
           .createHtmlTextBalloonBuilder(
               text,
               null,
               MessageType.WARNING.getPopupBackground(),
               event -> {
                 if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                   ApplicationManager.getApplication()
                       .invokeLater(
                           () ->
                               ShowSettingsUtil.getInstance()
                                   .showSettingsDialog(project, "Project Interpreter"));
                 }
               });
   balloonBuilder.setHideOnLinkClick(true);
   final Balloon balloon = balloonBuilder.createBalloon();
   StudyUtils.showCheckPopUp(project, balloon);
 }
 @Override
 public void setCommandLineParameters(
     @NotNull final GeneralCommandLine cmd,
     @NotNull final Project project,
     @NotNull final String filePath,
     @NotNull final String sdkPath,
     @NotNull final Task currentTask) {
   final List<UserTest> userTests =
       StudyTaskManager.getInstance(project).getUserTests(currentTask);
   if (!userTests.isEmpty()) {
     StudyLanguageManager manager =
         StudyUtils.getLanguageManager(currentTask.getLesson().getCourse());
     if (manager != null) {
       cmd.addParameter(
           new File(project.getBaseDir().getPath(), manager.getUserTester()).getPath());
       cmd.addParameter(sdkPath);
       cmd.addParameter(filePath);
     }
   } else {
     cmd.addParameter(filePath);
   }
 }