diff --git a/src/main/kotlin/com/github/adrienpessu/sarifviewer/services/SarifService.kt b/src/main/kotlin/com/github/adrienpessu/sarifviewer/services/SarifService.kt index 77b2618..508e220 100644 --- a/src/main/kotlin/com/github/adrienpessu/sarifviewer/services/SarifService.kt +++ b/src/main/kotlin/com/github/adrienpessu/sarifviewer/services/SarifService.kt @@ -2,13 +2,11 @@ package com.github.adrienpessu.sarifviewer.services import com.contrastsecurity.sarif.SarifSchema210 import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.jr.ob.JSON import com.fasterxml.jackson.module.kotlin.readValue import com.github.adrienpessu.sarifviewer.exception.SarifViewerException import com.github.adrienpessu.sarifviewer.models.Leaf import com.github.adrienpessu.sarifviewer.models.Root import com.intellij.openapi.components.Service -import com.intellij.openapi.project.Project import net.minidev.json.JSONArray import java.net.HttpURLConnection import java.net.URL @@ -32,7 +30,7 @@ class SarifService { } fun analyseSarif(sarif: SarifSchema210): HashMap> { - val map = HashMap>(); + val map = HashMap>() sarif.runs.forEach { run -> run.results.forEach { result -> diff --git a/src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow/SarifViewerWindowFactory.kt b/src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow/SarifViewerWindowFactory.kt index e05c6c7..e041e27 100644 --- a/src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow/SarifViewerWindowFactory.kt +++ b/src/main/kotlin/com/github/adrienpessu/sarifviewer/toolWindow/SarifViewerWindowFactory.kt @@ -18,10 +18,8 @@ import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowFactory import com.intellij.ui.ScrollPaneFactory -import com.intellij.ui.TreeSpeedSearch import com.intellij.ui.components.JBPanel import com.intellij.ui.content.ContentFactory -import com.intellij.ui.treeStructure.Tree import git4idea.GitLocalBranch import git4idea.repo.GitRepository import git4idea.repo.GitRepositoryChangeListener @@ -34,6 +32,7 @@ import java.io.FileReader import java.io.FileWriter import java.net.URI import java.nio.charset.Charset +import java.nio.file.Files import java.nio.file.Path import javax.swing.* import javax.swing.event.HyperlinkEvent @@ -43,7 +42,6 @@ import javax.swing.event.TreeSelectionListener import javax.swing.text.html.HTMLEditorKit import javax.swing.tree.DefaultMutableTreeNode import javax.swing.tree.DefaultTreeModel -import javax.swing.tree.TreeNode class SarifViewerWindowFactory : ToolWindowFactory { @@ -161,7 +159,7 @@ class SarifViewerWindowFactory : ToolWindowFactory { NotificationGroupManager.getInstance() .getNotificationGroup("SARIF viewer") .createNotification(message, NotificationType.ERROR) - .notify(project); + .notify(project) thisLogger().info(message) } @@ -270,15 +268,14 @@ class SarifViewerWindowFactory : ToolWindowFactory { myList = JTree(root) myList.isRootVisible = false - val treeSpeedSearch = TreeSpeedSearch(myList) - main = ScrollPaneFactory.createScrollPane(myList); + main = ScrollPaneFactory.createScrollPane(myList) details.isVisible = false splitPane.leftComponent = main splitPane.rightComponent = details - treeSpeedSearch.component.addTreeSelectionListener(object : TreeSelectionListener { + myList.addTreeSelectionListener(object : TreeSelectionListener { override fun valueChanged(e: TreeSelectionEvent?) { if (e != null && e.isAddedPath) { val leaves = map[e.path.parentPath.lastPathComponent.toString()] @@ -310,11 +307,12 @@ class SarifViewerWindowFactory : ToolWindowFactory { } } } - }); + }) } private fun manageTreeIcons() { - val tmpFile: File = File.createTempFile("warning", ".svg") + val tmpPath: Path? = Files.createTempFile("warning", ".svg") + val tmpFile = File(tmpPath!!.toUri()) val writer = FileWriter(tmpFile) writer.write(Icons.ICON_WARNING) writer.close() diff --git a/src/main/kotlin/com/github/adrienpessu/sarifviewer/utils/Icons.kt b/src/main/kotlin/com/github/adrienpessu/sarifviewer/utils/Icons.kt index 036b72c..6338e85 100644 --- a/src/main/kotlin/com/github/adrienpessu/sarifviewer/utils/Icons.kt +++ b/src/main/kotlin/com/github/adrienpessu/sarifviewer/utils/Icons.kt @@ -4,7 +4,7 @@ class Icons { companion object { const val ICON_WARNING = "" - const val ICON_DIRECTORY = "" + // const val ICON_DIRECTORY = "" const val ERROR = "" } } \ No newline at end of file