<commit_before>package org.jetbrains.plugins.scala
package lang
package completion
package lookups

import com.intellij.codeInsight.lookup.{Lookup, LookupActionProvider, LookupElement, LookupElementAction}
import com.intellij.psi.PsiClass
import com.intellij.util.ui.EmptyIcon
import com.intellij.util.{Consumer, PlatformIcons}

/**
 * @author <NAME>
 */
final class ScalaImportStaticLookupActionProvider extends LookupActionProvider {

  override def fillActions(element: LookupElement, lookup: Lookup, consumer: Consumer[LookupElementAction]): Unit = {
    element match {
      case elem: ScalaLookupItem if elem.element.isInstanceOf[PsiClass] =>
      case elem: ScalaLookupItem =>
        if (!elem.isClassName) return
        if (elem.usedImportStaticQuickfix) return

        val checkIcon = PlatformIcons.CHECK_ICON
        val icon =
          if (!elem.shouldImport) checkIcon
          else EmptyIcon.create(checkIcon.getIconWidth, checkIcon.getIconHeight)
        consumer.consume(new LookupElementAction(icon, ScalaBundle.message("action.import.method")) {
          override def performLookupAction: LookupElementAction.Result = {
            elem.usedImportStaticQuickfix = true
            new LookupElementAction.Result.ChooseItem(elem)
          }
        })
      case _ =>
    }
  }
}<commit_msg>ScalaImportStaticLookupActionProvider refactored #SCL-17547<commit_after>package org.jetbrains.plugins.scala
package lang
package completion
package lookups

import com.intellij.codeInsight.lookup.{Lookup, LookupActionProvider, LookupElement, LookupElementAction}
import com.intellij.psi.PsiClass
import com.intellij.util.ui.EmptyIcon
import com.intellij.util.{Consumer, PlatformIcons}

/**
 * @author <NAME>
 */
final class ScalaImportStaticLookupActionProvider extends LookupActionProvider {

  override def fillActions(element: LookupElement,
                           lookup: Lookup,
                           consumer: Consumer[LookupElementAction]): Unit = element match {
    case element: ScalaLookupItem if element.isClassName &&
      !element.usedImportStaticQuickfix &&
      !element.element.isInstanceOf[PsiClass] =>

      import PlatformIcons.{CHECK_ICON => checkIcon}
      val icon = if (element.shouldImport)
        EmptyIcon.create(checkIcon.getIconWidth, checkIcon.getIconHeight)
      else
        checkIcon

      consumer.consume(new LookupElementAction(icon, ScalaBundle.message("action.import.method")) {

        import LookupElementAction.Result.ChooseItem

        override def performLookupAction: ChooseItem = {
          element.usedImportStaticQuickfix = true
          new ChooseItem(element)
        }
      })
    case _ =>
  }
}
{'fraction_non_alphanumeric': 0.0830849478390462, 'fraction_numerical': 0.0018628912071535022, 'mean_word_length': 3.5819112627986347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5634446', 'n_tokens_mistral': 749, 'n_tokens_neox': 725, 'n_words': 147}