mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-450 Add tests and task.html to invisible files when converting from old course format
This commit is contained in:
+12
@@ -212,6 +212,18 @@ public class StudyUtils {
|
||||
return language == null ? null : StudyLanguageManager.INSTANCE.forLanguage(language);
|
||||
}
|
||||
|
||||
public static boolean isTestsFile(@NotNull Project project, @NotNull final String name) {
|
||||
Course course = StudyTaskManager.getInstance(project).getCourse();
|
||||
if (course == null) {
|
||||
return false;
|
||||
}
|
||||
StudyLanguageManager manager = getLanguageManager(course);
|
||||
if (manager == null) {
|
||||
return false;
|
||||
}
|
||||
return manager.getTestFileName().equals(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TaskFile getTaskFile(@NotNull final Project project, @NotNull final VirtualFile file) {
|
||||
final Course course = StudyTaskManager.getInstance(project).getCourse();
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import com.jetbrains.edu.courseFormat.Lesson;
|
||||
import com.jetbrains.edu.courseFormat.Task;
|
||||
import com.jetbrains.edu.courseFormat.TaskFile;
|
||||
import com.jetbrains.edu.learning.StudyTaskManager;
|
||||
import com.jetbrains.edu.learning.StudyUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -65,7 +66,7 @@ public class StudyGenerator {
|
||||
if (filesInTask != null) {
|
||||
for (File file : filesInTask) {
|
||||
String fileName = file.getName();
|
||||
if (!task.isTaskFile(fileName)) {
|
||||
if (!task.isTaskFile(fileName) && !StudyUtils.isTestsFile(project, fileName) && !EduNames.TASK_HTML.equals(fileName)) {
|
||||
File resourceFile = new File(newResourceRoot, fileName);
|
||||
File fileInProject = new File(taskDir.getCanonicalPath(), fileName);
|
||||
FileUtil.copy(resourceFile, fileInProject);
|
||||
|
||||
+2
-1
@@ -71,7 +71,8 @@ public class StudyTreeStructureProvider implements TreeStructureProvider, DumbAw
|
||||
@NotNull final VirtualFile virtualFile) {
|
||||
if (!StudyTaskManager.getInstance(project).isInvisibleFile(virtualFile.getPath())) {
|
||||
String fileName = virtualFile.getName();
|
||||
if (!fileName.contains(EduNames.WINDOW_POSTFIX) && !fileName.contains(EduNames.WINDOWS_POSTFIX)) {
|
||||
if (!fileName.contains(EduNames.WINDOW_POSTFIX) && !fileName.contains(EduNames.WINDOWS_POSTFIX)
|
||||
&& !StudyUtils.isTestsFile(project, fileName) && !EduNames.TASK_HTML.equals(fileName) && !fileName.contains(".answer")) {
|
||||
nodes.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user