From 943131b7b069edfe45b93ff42bad5e20d9d1f104 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Tue, 17 Feb 2015 16:06:19 +0300 Subject: [PATCH] Added button to configure annotations for methods which shouldn't be marked as unused. --- .../idea/inspections/UnusedSymbolInspection.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt index 274134c372c..e7a1def3b1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt @@ -62,8 +62,14 @@ import org.jetbrains.kotlin.psi.JetPsiUtil import org.jetbrains.kotlin.psi.JetObjectDeclaration import org.jetbrains.kotlin.psi.JetClassOrObject import org.jetbrains.kotlin.idea.util.ProjectRootsUtil -import com.intellij.util.IncorrectOperationException import org.jetbrains.kotlin.idea.project.ProjectStructureUtil +import javax.swing.JComponent +import java.awt.GridBagConstraints +import java.awt.Insets +import com.intellij.codeInspection.ex.EntryPointsManager +import com.intellij.openapi.project.ProjectUtil +import java.awt.GridBagLayout +import javax.swing.JPanel public class UnusedSymbolInspection : AbstractKotlinInspection() { private val javaInspection = UnusedDeclarationInspection() @@ -195,4 +201,14 @@ public class UnusedSymbolInspection : AbstractKotlinInspection() { declaration.isAncestor(it.getElement()) }) } + + override fun createOptionsPanel(): JComponent? { + val panel = JPanel(GridBagLayout()) + val project = ProjectUtil.guessCurrentProject(panel) + panel.add( + EntryPointsManager.getInstance(project).createConfigureAnnotationsBtn(), + GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, Insets(0, 0, 0, 0), 0, 0) + ) + return panel + } }