diff --git a/src/main/kotlin/com/github/hpich/cognitide/actions/studyUtils/CloseAllFilesAction.kt b/src/main/kotlin/com/github/hpich/cognitide/actions/studyUtils/CloseAllFilesAction.kt new file mode 100644 index 0000000..0283464 --- /dev/null +++ b/src/main/kotlin/com/github/hpich/cognitide/actions/studyUtils/CloseAllFilesAction.kt @@ -0,0 +1,19 @@ +package com.github.hpich.cognitide.actions.studyUtils + +import com.intellij.ide.impl.ProjectUtil +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.project.Project + +class CloseAllFilesAction : StudyUtilAction() { + override fun actionPerformed(event: AnActionEvent) { + val project: Project? = ProjectUtil.getActiveProject() + + if (project != null) { + val files = FileEditorManager.getInstance(project).openFiles + for (file in files) { + FileEditorManager.getInstance(project).closeFile(file) + } + } + } +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 49979a8..ef0c58b 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -33,6 +33,12 @@ +