check if it's student project
authorLiana.Bakradze <liana.bakradze@jetbrains.com>
Tue, 4 Oct 2016 14:46:48 +0000 (17:46 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 17 Nov 2016 14:08:28 +0000 (17:08 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/StudySubtaskUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/StudyTypeHandlerDelegate.java
python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java

index 008389400d2a010fd5d26ee2ba9f3e068f5470c9..9faa6125f2b83e1e11a7ab9b3eb12de9584a7db9 100644 (file)
@@ -53,7 +53,7 @@ public class StudySubtaskUtils {
       }
       updatePlaceholderTexts(project, document, taskFile, fromSubtaskIndex, toSubtaskIndex);
       EditorNotifications.getInstance(project).updateNotifications(virtualFile);
-      if (StudyUtils.isStudyProject(project)) {
+      if (StudyUtils.isStudentProject(project)) {
         WolfTheProblemSolver.getInstance(project).clearProblems(virtualFile);
         taskFile.setHighlightErrors(false);
       }
index 27f7593b3ba72ee906465bc979bd7ef1e62c9e1e..643692757621dc07befb6ec53fc3dd019ae7f42f 100644 (file)
@@ -27,7 +27,7 @@ public class StudyTypeHandlerDelegate extends TypedHandlerDelegate {
 
   @NotNull
   private static Result handleTyping(Project project, Editor editor, PsiFile file) {
-    if (!StudyUtils.isStudyProject(project)) {
+    if (!StudyUtils.isStudentProject(project)) {
       return Result.CONTINUE;
     }
     TaskFile taskFile = StudyUtils.getTaskFile(project, file.getVirtualFile());
index b15c1913eb66cb242df4e5fff5437a110cf5108f..2026a25e401fe23f4c0143d575d204071ce7bf62 100644 (file)
@@ -595,6 +595,14 @@ public class StudyUtils {
     return StudyTaskManager.getInstance(project).getCourse() != null;
   }
 
+  public static boolean isStudentProject(@NotNull Project project) {
+    Course course = StudyTaskManager.getInstance(project).getCourse();
+    if (course == null) {
+      return false;
+    }
+    return EduNames.STUDY.equals(course.getCourseMode());
+  }
+
   @Nullable
   public static Project getStudyProject() {
     Project studyProject = null;