Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Last active May 1, 2022 18:58
Show Gist options
  • Save rubenquadros/61d774d435e1969bfe04136d7b88a757 to your computer and use it in GitHub Desktop.
Save rubenquadros/61d774d435e1969bfe04136d7b88a757 to your computer and use it in GitHub Desktop.
Creating the notification to be displayed
fun createPanel(
psiFile: PsiFile,
project: Project,
name: String,
onAddClick: () -> Unit,
onIgnoreClick: () -> Unit
): EditorNotificationPanel? {
return if (isErrorHighlighted(psiFile, project)) {
val panel = EditorNotificationPanel()
panel.text("Add SerializedName annotation to $name params?")
panel.createActionLabel("Add annotation") { onAddClick.invoke() }
panel.createActionLabel("Ignore") { onIgnoreClick.invoke() }
panel
} else {
null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment