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);
    }
}

@@ -68,103 +68,464 @@
 iew.
-ViewSettings;%0Aimport com.intellij.openapi.project.Project;%0Aimport com.intellij.psi.PsiDirectory
+ProjectView;%0Aimport com.intellij.ide.projectView.ViewSettings;%0Aimport com.intellij.openapi.fileEditor.FileEditorManager;%0Aimport com.intellij.openapi.project.Project;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.psi.PsiDirectory;%0Aimport com.intellij.psi.PsiElement;%0Aimport com.jetbrains.edu.EduNames;%0Aimport com.jetbrains.edu.courseFormat.Task;%0Aimport com.jetbrains.edu.courseFormat.TaskFile;%0Aimport com.jetbrains.edu.learning.StudyUtils
 ;%0Aim
@@ -631,16 +631,39 @@
 tNull;%0A%0A
+import java.util.Map;%0A%0A
 public c
@@ -949,65 +949,2110 @@
     
-//TODO: implement%0A        //super.navigate(requestFocus);
+final String myValueName = myValue.getName();%0A        if (myValueName.contains(EduNames.TASK)) %7B%0A            PsiDirectory src = myValue.findSubdirectory(%22src%22);%0A            if (src == null) %7B%0A                return;%0A            %7D%0A            TaskFile taskFile = null;%0A            VirtualFile virtualFile =  null;%0A            for (PsiElement child : src.getChildren()) %7B%0A                VirtualFile childFile = child.getContainingFile().getVirtualFile();%0A                taskFile = StudyUtils.getTaskFile(myProject, childFile);%0A                if (taskFile != null) %7B%0A                    virtualFile = childFile;%0A                    break;%0A                %7D%0A            %7D%0A            if (taskFile != null) %7B%0A                VirtualFile taskDir = virtualFile.getParent();%0A                Task task = taskFile.getTask();%0A                for (VirtualFile openFile : FileEditorManager.getInstance(myProject).getOpenFiles()) %7B%0A                    FileEditorManager.getInstance(myProject).closeFile(openFile);%0A                %7D%0A                VirtualFile child = null;%0A                Map%3CString, TaskFile%3E taskFiles = task.getTaskFiles();%0A                for (Map.Entry%3CString, TaskFile%3E entry: taskFiles.entrySet()) %7B%0A                    VirtualFile file = taskDir.findChild(entry.getKey());%0A                    if (file != null) %7B%0A                        FileEditorManager.getInstance(myProject).openFile(file, true);%0A                    %7D%0A                    if (!entry.getValue().getAnswerPlaceholders().isEmpty()) %7B%0A                        child = file;%0A                    %7D%0A                %7D%0A                if (child != null) %7B%0A                    ProjectView.getInstance(myProject).select(child, child, false);%0A                    FileEditorManager.getInstance(myProject).openFile(child, true);%0A                %7D else %7B%0A                    VirtualFile%5B%5D children = taskDir.getChildren();%0A                    if (children.length %3E 0) %7B%0A                        ProjectView.getInstance(myProject).select(children%5B0%5D, children%5B0%5D, false);%0A                    %7D%0A                %7D%0A            %7D%0A        %7D
 %0A   

fix navigation for kotlin nodes