fixed EDU-301 and some minor changes
[idea/community.git] / python / edu / learn-python / src / com / jetbrains / python / edu / course / TaskWindow.java
index a4211b17a15caff67f7be47244d47ab0f5a9d975..2229309092e723ba0b8a7ec03a8a875f944b88e8 100644 (file)
@@ -9,7 +9,10 @@ import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.colors.EditorColors;
 import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.markup.*;
+import com.intellij.openapi.editor.markup.HighlighterLayer;
+import com.intellij.openapi.editor.markup.HighlighterTargetArea;
+import com.intellij.openapi.editor.markup.RangeHighlighter;
+import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
@@ -197,19 +200,19 @@ public class TaskWindow implements Comparable, Stateful {
                          @NotNull final Document usersDocument) {
 
     try {
-      VirtualFile windowCopy =
-        answerFile.copy(this, answerFile.getParent(), answerFile.getNameWithoutExtension() + WINDOW_POSTFIX);
+      final VirtualFile windowCopy =
+        answerFile.copy(this, answerFile.getParent(), answerFile.getNameWithoutExtension() + myIndex + WINDOW_POSTFIX);
       final FileDocumentManager documentManager = FileDocumentManager.getInstance();
       final Document windowDocument = documentManager.getDocument(windowCopy);
       if (windowDocument != null) {
-        File resourceFile = StudyUtils.copyResourceFile(virtualFile.getName(), windowCopy.getName(), project, usersTaskFile.getTask());
-        TaskFile windowTaskFile = new TaskFile();
+        final File resourceFile = StudyUtils.copyResourceFile(virtualFile.getName(), windowCopy.getName(), project, usersTaskFile.getTask());
+        final TaskFile windowTaskFile = new TaskFile();
         TaskFile.copy(answerTaskFile, windowTaskFile);
         StudyDocumentListener listener = new StudyDocumentListener(windowTaskFile);
         windowDocument.addDocumentListener(listener);
         int start = getRealStartOffset(windowDocument);
         int end = start + getLength();
-        TaskWindow userTaskWindow = usersTaskFile.getTaskWindows().get(getIndex());
+        final TaskWindow userTaskWindow = usersTaskFile.getTaskWindows().get(getIndex());
         int userStart = userTaskWindow.getRealStartOffset(usersDocument);
         int userEnd = userStart + userTaskWindow.getLength();
         String text = usersDocument.getText(new TextRange(userStart, userEnd));