compute initial state of placeholder correctly
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / actions / CCAddAnswerPlaceholder.java
index 0643eaa8cf0cb66d6dd1bf5d7ddf9455968ce22f..2ad1d79faf1fb5776b10d5163992b878dbf8a6ee 100644 (file)
@@ -84,7 +84,7 @@ public class CCAddAnswerPlaceholder extends CCAnswerPlaceholderAction {
   }
 
   private static void computeInitialState(Project project, PsiFile file, TaskFile taskFile, Document document) {
-    Document patternDocument = StudyUtils.getPatternDocument(project, taskFile, file.getName());
+    Document patternDocument = StudyUtils.getPatternDocument(taskFile, file.getName());
     if (patternDocument == null) {
       return;
     }
@@ -102,8 +102,7 @@ public class CCAddAnswerPlaceholder extends CCAnswerPlaceholderAction {
 
     for (int i = 0; i < placeholders.size(); i++) {
       AnswerPlaceholder fromPlaceholder = placeholders.get(i);
-      AnswerPlaceholder.MyInitialState state = fromPlaceholder.getInitialState();
-      taskFile.getAnswerPlaceholders().get(i).setInitialState(new AnswerPlaceholder.MyInitialState(state.getOffset(), state.getLength()));
+      taskFile.getAnswerPlaceholders().get(i).setInitialState(new AnswerPlaceholder.MyInitialState(fromPlaceholder.getOffset(), fromPlaceholder.getLength()));
     }
   }