do not show task description for subtasks in project view
authorLiana Bakradze <liana.bakradze@jetbrains.com>
Thu, 22 Sep 2016 12:30:33 +0000 (15:30 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 17 Nov 2016 14:05:04 +0000 (17:05 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/StudyUtils.java
python/educational-core/student/src/com/jetbrains/edu/learning/projectView/StudyTreeStructureProvider.java

index 366bfe76d1ab0b32f20029e4597a56a36db122e9..5ab871aee27eccb391b17f846343aef316264ff2 100644 (file)
@@ -31,6 +31,7 @@ import com.intellij.openapi.ui.popup.Balloon;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.io.FileUtilRt;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtil;
@@ -690,7 +691,14 @@ public class StudyUtils {
   }
   
   public static boolean isTaskDescriptionFile(@NotNull final String fileName) {
-    return EduNames.TASK_HTML.equals(fileName) || EduNames.TASK_MD.equals(fileName);
+    if (EduNames.TASK_HTML.equals(fileName) || EduNames.TASK_MD.equals(fileName)) {
+      return true;
+    }
+    String extension = FileUtilRt.getExtension(fileName);
+    if (!extension.equals(FileUtilRt.getExtension(EduNames.TASK_HTML)) && !extension.equals(FileUtilRt.getExtension(EduNames.TASK_MD))) {
+      return false;
+    }
+    return fileName.contains(EduNames.TASK) && fileName.contains(EduNames.SUBTASK_MARKER);
   }
   
   @Nullable
index 4b1e88f8dd65c658abcc38528435adc8c12a5c30..3330a2e3b28cdeb43de25e411eda2023225315fc 100644 (file)
@@ -50,6 +50,7 @@ public class StudyTreeStructureProvider implements TreeStructureProvider, DumbAw
             final TaskFile taskFile = StudyUtils.getTaskFile(project, virtualFile);
             if (taskFile != null) {
               nodes.add(node);
+              continue;
             }
             final String parentName = parent.getName();
             if (parentName != null) {