diff --git a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeAction.kt b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeAction.kt
index 3c5c07e..8c1695f 100644
--- a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeAction.kt
+++ b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeAction.kt
@@ -41,12 +41,18 @@ abstract class AnalyzeAction : AbstractAction() {
}
private fun analyze(context: DataContext, project: Project) {
- // try to get the file/folder from context, otherwise check if they can be retrieved from the opened editor
- val file: VirtualFile? = PlatformDataKeys.VIRTUAL_FILE.getData(context).let {
- it ?: project.let { it1 ->
- FileEditorManager.getInstance(it1).selectedEditor?.file
+ // If analyzeFileOpenedInEditor is true, use the file opened in the editor. Else it will try to
+ // get the file/folder from context, otherwise check if they can be retrieved from the opened editor.
+ val file: VirtualFile? = analyzeFileOpenedInEditor().let {
+ if (it) {
+ FileEditorManager.getInstance(project).selectedEditor?.file
+ } else {
+ PlatformDataKeys.VIRTUAL_FILE.getData(context).let {virtualFile ->
+ virtualFile ?: FileEditorManager.getInstance(project).selectedEditor?.file
+ }
}
}
+
if (isFileRequired() && file == null) {
showErrorMessageDialog(
ErrorMessages.NO_ACTIVE_FILE
@@ -88,4 +94,6 @@ abstract class AnalyzeAction : AbstractAction() {
protected abstract fun getTicsCommand(file: VirtualFile?, project: Project?): GeneralCommandLine
protected abstract fun isFileRequired(): Boolean
+
+ protected abstract fun analyzeFileOpenedInEditor(): Boolean
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFile.kt b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFile.kt
index 079709a..9878db2 100644
--- a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFile.kt
+++ b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFile.kt
@@ -23,4 +23,8 @@ open class AnalyzeFile : AnalyzeAction() {
override fun isFileRequired(): Boolean {
return true
}
+
+ override fun analyzeFileOpenedInEditor(): Boolean {
+ return true
+ }
}
diff --git a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFileOrFolder.kt b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFileOrFolder.kt
index 2623d2d..45f3ffb 100644
--- a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFileOrFolder.kt
+++ b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeFileOrFolder.kt
@@ -18,4 +18,8 @@ class AnalyzeFileOrFolder : AnalyzeFile() {
super.update(e)
}
+
+ override fun analyzeFileOpenedInEditor(): Boolean {
+ return false
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeProject.kt b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeProject.kt
index d084f07..6d978f7 100644
--- a/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeProject.kt
+++ b/src/main/kotlin/com/tiobe/plugins/intellij/actions/AnalyzeProject.kt
@@ -24,4 +24,8 @@ class AnalyzeProject : AnalyzeAction() {
override fun isFileRequired(): Boolean {
return false
}
+
+ override fun analyzeFileOpenedInEditor(): Boolean {
+ return false
+ }
}
\ No newline at end of file
diff --git a/src/main/resources/icons/filter-outline.png b/src/main/resources/icons/filter-outline.png
deleted file mode 100644
index 9c68672..0000000
Binary files a/src/main/resources/icons/filter-outline.png and /dev/null differ
diff --git a/src/main/resources/icons/filter.png b/src/main/resources/icons/filter.png
deleted file mode 100644
index 04b56e9..0000000
Binary files a/src/main/resources/icons/filter.png and /dev/null differ
diff --git a/src/main/resources/icons/tics-config-solid_dark.svg b/src/main/resources/icons/tics-config-solid_dark.svg
new file mode 100644
index 0000000..62f45e6
--- /dev/null
+++ b/src/main/resources/icons/tics-config-solid_dark.svg
@@ -0,0 +1,103 @@
+
+
+
+
diff --git a/src/main/resources/icons/tics-file-solid_dark.svg b/src/main/resources/icons/tics-file-solid_dark.svg
new file mode 100644
index 0000000..bf44957
--- /dev/null
+++ b/src/main/resources/icons/tics-file-solid_dark.svg
@@ -0,0 +1,121 @@
+
+
+
+