Minor Fix according to review IDEA-CR-11509 phpstorm/163.333
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Mon, 20 Jun 2016 12:18:56 +0000 (15:18 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Mon, 20 Jun 2016 12:21:22 +0000 (15:21 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckTask.java
python/educational-core/student/src/com/jetbrains/edu/learning/checker/StudyCheckUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Course.java
python/educational-core/student/src/com/jetbrains/edu/learning/ui/StudyTestResultsToolWindowFactory.kt

index 90b6110df848bbdc3aa665b1f2690a202660883d..570951877ed58e65dfd3436feec08beacf38bcab 100644 (file)
@@ -74,11 +74,13 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun
   @Override
   public void run(@NotNull ProgressIndicator indicator) {
     final Course course = StudyTaskManager.getInstance(myProject).getCourse();
-    if (course != null && course.isAdaptive()) {
-      checkForAdaptiveCourse(indicator);
-    }
-    else {
-      checkForEduCourse(indicator);
+    if (course != null) {
+      if (course.isAdaptive()) {
+        checkForAdaptiveCourse(indicator);
+      }
+      else {
+        checkForEduCourse(indicator);
+      }
     }
   }
 
index 940ce051c743923eafb0cf8c2cef4e36e046c8be..21d0983f252d56c48ff8c63a9642c89a3dc8ac2f 100644 (file)
@@ -33,6 +33,7 @@ import com.jetbrains.edu.learning.courseFormat.TaskFile;
 import com.jetbrains.edu.learning.editor.StudyEditor;
 import com.jetbrains.edu.learning.navigation.StudyNavigator;
 import com.jetbrains.edu.learning.ui.StudyTestResultsToolWindowFactory;
+import com.jetbrains.edu.learning.ui.StudyTestResultsToolWindowFactoryKt;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -196,10 +197,10 @@ public class StudyCheckUtils {
 
   public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message, boolean solved) {
     final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
-    ToolWindow window = toolWindowManager.getToolWindow("Test Results");
+    ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
     if (window == null) {
-      toolWindowManager.registerToolWindow("Test Results", true, ToolWindowAnchor.BOTTOM);
-      window = toolWindowManager.getToolWindow("Test Results");
+      toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
+      window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
       new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
     }
 
index bfd62a40236ba516e2a6c5143a4e119be6e8f781..86eef6a6b7e1a9c4eee703ff93312e24cf4ebbb2 100644 (file)
@@ -20,7 +20,7 @@ public class Course {
   @Expose private String myCourseDirectory = "";
   @Expose private int id;
   @Expose private boolean myUpToDate;
-  @Expose private boolean isAdaptive;
+  @Expose private boolean isAdaptive = false;
   @Expose @SerializedName("language") private String myLanguage = "Python";
 
   //this field is used to distinguish ordinary and CheckIO projects,
index 40be63a4cf58b967db3b4dc36499a802b7084189..689000f96cd1b2ddab7d3e743b6550b04c1c47f4 100644 (file)
@@ -12,6 +12,7 @@ import com.intellij.openapi.wm.ToolWindowFactory
 import com.jetbrains.edu.learning.StudyUtils
 
 
+@JvmField val ID = "Test Results"
 class StudyTestResultsToolWindowFactory : ToolWindowFactory {
   override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
     val currentTask = StudyUtils.getCurrentTask(project)