<commit_before>package com.jetbrains.edu.kotlin;

import com.intellij.ide.projectView.ViewSettings;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.jetbrains.edu.learning.projectView.StudyDirectoryNode;
import org.jetbrains.annotations.NotNull;

public class KotlinDirectoryNode extends StudyDirectoryNode {
    public KotlinDirectoryNode(@NotNull Project project, PsiDirectory value, ViewSettings viewSettings) {
        super(project, value, viewSettings);
    }

    @Override
    public void navigate(boolean requestFocus) {
        //TODO: implement
        //super.navigate(requestFocus);
    }
}<commit_msg>fix navigation for kotlin nodes<commit_after>package com.jetbrains.edu.kotlin;

import com.intellij.ide.projectView.ProjectView;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.jetbrains.edu.EduNames;
import com.jetbrains.edu.courseFormat.Task;
import com.jetbrains.edu.courseFormat.TaskFile;
import com.jetbrains.edu.learning.StudyUtils;
import com.jetbrains.edu.learning.projectView.StudyDirectoryNode;
import org.jetbrains.annotations.NotNull;

import java.util.Map;

public class KotlinDirectoryNode extends StudyDirectoryNode {
    public KotlinDirectoryNode(@NotNull Project project, PsiDirectory value, ViewSettings viewSettings) {
        super(project, value, viewSettings);
    }

    @Override
    public void navigate(boolean requestFocus) {
        final String myValueName = myValue.getName();
        if (myValueName.contains(EduNames.TASK)) {
            PsiDirectory src = myValue.findSubdirectory("src");
            if (src == null) {
                return;
            }
            TaskFile taskFile = null;
            VirtualFile virtualFile =  null;
            for (PsiElement child : src.getChildren()) {
                VirtualFile childFile = child.getContainingFile().getVirtualFile();
                taskFile = StudyUtils.getTaskFile(myProject, childFile);
                if (taskFile != null) {
                    virtualFile = childFile;
                    break;
                }
            }
            if (taskFile != null) {
                VirtualFile taskDir = virtualFile.getParent();
                Task task = taskFile.getTask();
                for (VirtualFile openFile : FileEditorManager.getInstance(myProject).getOpenFiles()) {
                    FileEditorManager.getInstance(myProject).closeFile(openFile);
                }
                VirtualFile child = null;
                Map<String, TaskFile> taskFiles = task.getTaskFiles();
                for (Map.Entry<String, TaskFile> entry: taskFiles.entrySet()) {
                    VirtualFile file = taskDir.findChild(entry.getKey());
                    if (file != null) {
                        FileEditorManager.getInstance(myProject).openFile(file, true);
                    }
                    if (!entry.getValue().getAnswerPlaceholders().isEmpty()) {
                        child = file;
                    }
                }
                if (child != null) {
                    ProjectView.getInstance(myProject).select(child, child, false);
                    FileEditorManager.getInstance(myProject).openFile(child, true);
                } else {
                    VirtualFile[] children = taskDir.getChildren();
                    if (children.length > 0) {
                        ProjectView.getInstance(myProject).select(children[0], children[0], false);
                    }
                }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09477037430315902, 'fraction_numerical': 0.0007963897000265463, 'mean_word_length': 2.2708333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3871632', 'n_tokens_mistral': 998, 'n_tokens_neox': 945, 'n_words': 182}