refresh placeholder for subtasks
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / actions / StudyRefreshAnswerPlaceholder.java
index b2b7c86aadf05253f47c61a1bd643d93ce43d68e..3c45e8e701e07ecf555ffa5ed7d33fb727aed88f 100644 (file)
@@ -11,14 +11,11 @@ import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
-import com.jetbrains.edu.learning.StudyActionListener;
-import com.jetbrains.edu.learning.StudyTaskManager;
+import com.jetbrains.edu.learning.*;
 import com.jetbrains.edu.learning.core.EduNames;
 import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder;
 import com.jetbrains.edu.learning.courseFormat.Course;
 import com.jetbrains.edu.learning.courseFormat.TaskFile;
-import com.jetbrains.edu.learning.StudyState;
-import com.jetbrains.edu.learning.StudyUtils;
 import com.jetbrains.edu.learning.editor.StudyEditor;
 import org.jetbrains.annotations.Nullable;
 
@@ -45,6 +42,10 @@ public class StudyRefreshAnswerPlaceholder extends DumbAwareAction {
     }
     StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
     final StudyState studyState = new StudyState(studyEditor);
+    if (answerPlaceholder.getTaskFile().getTask().hasSubtasks()) {
+      StudySubtaskUtils.refreshPlaceholder(project, studyState.getEditor(), answerPlaceholder);
+      return;
+    }
     Document patternDocument = StudyUtils.getPatternDocument(answerPlaceholder.getTaskFile(), studyState.getVirtualFile().getName());
     if (patternDocument == null) {
       return;