mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-407 Files created by user code are invisible
This commit is contained in:
+9
@@ -36,6 +36,7 @@ public class StudyTaskManager implements PersistentStateComponent<StudyTaskManag
|
||||
public Map<AnswerPlaceholder, StudyStatus> myStudyStatusMap = new HashMap<AnswerPlaceholder, StudyStatus>();
|
||||
public Map<TaskFile, StudyStatus> myTaskStatusMap = new HashMap<TaskFile, StudyStatus>();
|
||||
public Map<Task, List<UserTest>> myUserTests = new HashMap<Task, List<UserTest>>();
|
||||
public List<String> myInvisibleFiles = new ArrayList<String>();
|
||||
|
||||
private StudyTaskManager() {
|
||||
}
|
||||
@@ -184,4 +185,12 @@ public class StudyTaskManager implements PersistentStateComponent<StudyTaskManag
|
||||
public static StudyTaskManager getInstance(@NotNull final Project project) {
|
||||
return ServiceManager.getService(project, StudyTaskManager.class);
|
||||
}
|
||||
|
||||
public void addInvisibleFiles(String filePath) {
|
||||
myInvisibleFiles.add(filePath);
|
||||
}
|
||||
|
||||
public boolean isInvisibleFile(String path) {
|
||||
return myInvisibleFiles.contains(path);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -80,6 +80,7 @@ public class StudyRunAction extends DumbAwareAction {
|
||||
Disposer.register(project, executor);
|
||||
executor.run();
|
||||
}
|
||||
EduUtils.synchronize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -9,6 +9,7 @@ import com.jetbrains.edu.courseFormat.Course;
|
||||
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 org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -68,6 +69,7 @@ public class StudyGenerator {
|
||||
File resourceFile = new File(newResourceRoot, fileName);
|
||||
File fileInProject = new File(taskDir.getCanonicalPath(), fileName);
|
||||
FileUtil.copy(resourceFile, fileInProject);
|
||||
StudyTaskManager.getInstance(project).addInvisibleFiles(fileInProject.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -54,6 +54,9 @@ public class StudyTreeStructureProvider implements TreeStructureProvider, DumbAw
|
||||
if (parentName.equals(EduNames.SANDBOX_DIR)) {
|
||||
nodes.add(node);
|
||||
}
|
||||
if (parentName.startsWith(EduNames.TASK)) {
|
||||
addNonInvisibleFiles(nodes, node, project, virtualFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +65,18 @@ public class StudyTreeStructureProvider implements TreeStructureProvider, DumbAw
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private static void addNonInvisibleFiles(@NotNull final Collection<AbstractTreeNode> nodes,
|
||||
@NotNull final AbstractTreeNode node,
|
||||
@NotNull final Project project,
|
||||
@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)) {
|
||||
nodes.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isCourseBasedProject(@NotNull final AbstractTreeNode parent) {
|
||||
final Project project = parent.getProject();
|
||||
if (project != null) {
|
||||
|
||||
Reference in New Issue
Block a user