<commit_before>// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl

import com.intellij.codeInsight.daemon.impl.analysis.JavaLensSettings
import com.intellij.codeInsight.hints.ChangeListener
import com.intellij.codeInsight.hints.ImmediateConfigurable
import com.intellij.ui.components.CheckBox
import com.intellij.util.ui.JBUI

class JavaLensConfigurable(val settings: JavaLensSettings) : ImmediateConfigurable {
  private val usagesCB = CheckBox("Usages")
  private val inheritCB = CheckBox("Inheritors")

  override fun createComponent(listener: ChangeListener): javax.swing.JPanel {
    usagesCB.isSelected = settings.isShowUsages
    inheritCB.isSelected = settings.isShowImplementations
    usagesCB.addItemListener { handleChange(listener) }
    inheritCB.addItemListener { handleChange(listener) }
    val panel = com.intellij.ui.layout.panel {
      row {
        usagesCB(pushX)
      }
      row {
        inheritCB(pushX)
      }
    }
    panel.border = JBUI.Borders.empty(0, 20, 0, 0)
    return panel
  }

  override val mainCheckboxText: String
    get() = "Show hints for:"

  private fun handleChange(listener: ChangeListener) {
    settings.isShowUsages = usagesCB.isSelected
    settings.isShowImplementations = inheritCB.isSelected
    listener.settingsChanged()
  }<commit_msg>Inlay hints: use new settings api for JavaLensConfigurable to support reset and deactivation<commit_after>// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl

import com.intellij.codeInsight.daemon.impl.analysis.JavaLensSettings
import com.intellij.codeInsight.hints.ChangeListener
import com.intellij.codeInsight.hints.ImmediateConfigurable
import com.intellij.ui.components.CheckBox
import com.intellij.util.ui.JBUI

class JavaLensConfigurable(val settings: JavaLensSettings) : ImmediateConfigurable {
  private val usagesCB = CheckBox("Usages")
  private val inheritCB = CheckBox("Inheritors")

  override fun createComponent(listener: ChangeListener): javax.swing.JPanel {
    reset()
    usagesCB.addItemListener { handleChange(listener) }
    inheritCB.addItemListener { handleChange(listener) }
    val panel = com.intellij.ui.layout.panel {
      row {
        usagesCB(pushX)
      }
      row {
        inheritCB(pushX)
      }
    }
    panel.border = JBUI.Borders.empty(0, 20, 0, 0)
    return panel
  }

  override val mainCheckboxText: String
    get() = "Show hints for:"

  private fun handleChange(listener: ChangeListener) {
    settings.isShowUsages = usagesCB.isSelected
    settings.isShowImplementations = inheritCB.isSelected
    if (!settings.isShowUsages && !settings.isShowImplementations) {
      listener.didDeactivated()
    }
    listener.settingsChanged()
  }

  override fun reset() {
    usagesCB.isSelected = settings.isShowUsages
    inheritCB.isSelected = settings.isShowImplementations
  }
{'fraction_non_alphanumeric': 0.08473479948253558, 'fraction_numerical': 0.009702457956015523, 'mean_word_length': 4.0704918032786885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3838499', 'n_tokens_mistral': 967, 'n_tokens_neox': 934, 'n_words': 208}