answerPlaceholders.remove(answerPlaceholder);
final Editor editor = state.getEditor();
editor.getMarkupModel().removeAllHighlighters();
- StudyUtils.drawAllWindows(editor, taskFile);
+ StudyUtils.drawAllWindows(editor, taskFile, false);
EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, false);
}
}
return null;
}
-
public static void drawAllWindows(Editor editor, TaskFile taskFile) {
+ drawAllWindows(editor, taskFile, true);
+ }
+
+ public static void drawAllWindows(Editor editor, TaskFile taskFile, boolean useLength) {
editor.getMarkupModel().removeAllHighlighters();
final Project project = editor.getProject();
if (project == null) return;
final StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
for (AnswerPlaceholder answerPlaceholder : taskFile.getAnswerPlaceholders()) {
final JBColor color = taskManager.getColor(answerPlaceholder);
- EduAnswerPlaceholderPainter.drawAnswerPlaceholder(editor, answerPlaceholder, true, color);
+ EduAnswerPlaceholderPainter.drawAnswerPlaceholder(editor, answerPlaceholder, useLength, color);
}
final Document document = editor.getDocument();
EditorActionManager.getInstance()
.setReadonlyFragmentModificationHandler(document, new EduAnswerPlaceholderDeleteHandler(editor));
- EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, true);
+ EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, useLength);
editor.getColorsScheme().setColor(EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, null);
}
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.problems.WolfTheProblemSolver;
+import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.edu.learning.core.EduDocumentListener;
+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.StudyUtils;
import com.jetbrains.edu.learning.navigation.StudyNavigator;
StudyUtils.updateToolWindows(project);
studyToolWindow.show(null);
}
+ Course course = StudyTaskManager.getInstance(project).getCourse();
+ if (course == null) {
+ return;
+ }
+
if (!taskFile.getAnswerPlaceholders().isEmpty()) {
StudyNavigator.navigateToFirstAnswerPlaceholder(editor, taskFile);
- StudyEditor.addDocumentListener(document, new EduDocumentListener(taskFile));
- StudyUtils.drawAllWindows(editor, taskFile);
- editor.addEditorMouseListener(new WindowSelectionListener(taskFile));
+ boolean isStudyProject = EduNames.STUDY.equals(course.getCourseType());
+ StudyEditor.addDocumentListener(document, new EduDocumentListener(taskFile, true,
+ !isStudyProject));
+ StudyUtils.drawAllWindows(editor, taskFile, isStudyProject);
+ if (isStudyProject) {
+ editor.addEditorMouseListener(new WindowSelectionListener(taskFile));
+ }
}
}
}