Skip to content

Commit

Permalink
Merge branch 'fix-close-all-tabs' into 'main'
Browse files Browse the repository at this point in the history
Add action to really CloseAllFiles...

See merge request cognipro/CognitIDE!35
  • Loading branch information
lkursawe committed Jul 10, 2024
2 parents 1f7371d + ac143ae commit d0266d7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
}
6 changes: 6 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
</extensions>

<actions>
<action id="com.github.hpich.cognitide.actions.studyUtils.CloseAllFilesAction"
class="com.github.hpich.cognitide.actions.studyUtils.CloseAllFilesAction"
text="Close All Editor Tabs"
description="Closes all editor tabs"
icon="AllIcons.Actions.Close"
/>
<group id="com.github.hpich.cognitide.actions.CognitIDEGroup"
text="CognitIDE"
popup="true"
Expand Down

0 comments on commit d0266d7

Please sign in to comment.