Reports any actions that are registered in the plugin.xml file and initialize their presentation (text, description, or icon) in their constructors.

Loading presentation in constructor results in allocating resources, which may not be necessary. Instead, it's more efficient to utilize no-argument constructors of AnAction and other base classes and follow the convention for setting the text, description, and icon in plugin.xml. The IDE will load text, description, and icon only when the action is actually displayed in the UI.

The convention for setting the text, description, and icon is as follows:

Bad example:


  // NewKotlinFileAction.kt
  internal class NewKotlinFileAction : AnAction(
    KotlinBundle.message("action.new.file.text"),
    KotlinBundle.message("action.new.file.description"),
    KotlinIcons.FILE
  )

  
  <action
    class="org.jetbrains.kotlin.idea.actions.NewKotlinFileAction"
  </action>

Good example:


  // NewKotlinFileAction.kt
  internal class NewKotlinFileAction : AnAction()

  
  <action
    id="Kotlin.NewFile"
    class="org.jetbrains.kotlin.idea.actions.NewKotlinFileAction"
    icon="org.jetbrains.kotlin.idea.KotlinIcons.FILE">
  </action>

  # KotlinBundle.properties
  action.Kotlin.NewFile.text=Kotlin Class/File
  action.Kotlin.NewFile.description=Creates a new Kotlin class or file

New in 2023.2