<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.openapi.actionSystem

import com.intellij.diagnostic.PluginException
import com.intellij.openapi.extensions.PluginId

interface ActionStubBase {
  val id: String
  val pluginId: PluginId?
  val iconPath: String?
}

class ActionGroupStub(
  override val id: String,
  val actionClass: String,
  val classLoader: ClassLoader,
  override val pluginId: PluginId
) : DefaultActionGroup(), ActionStubBase {

  var popupDefinedInXml = false

  override var iconPath: String? = null

  fun initGroup(target: ActionGroup) {
    ActionStub.copyTemplatePresentation(templatePresentation, target.templatePresentation)
    val children = getChildren(null)
    if (children.isNotEmpty()) {
      val defaultActionGroup = target as? DefaultActionGroup
                               ?: throw PluginException(
                                 "Action group class must extend DefaultActionGroup for the group to accept children: $actionClass",
                                 pluginId)
      defaultActionGroup.addAll(children.toList())
    }
    if (popupDefinedInXml) {
      target.isPopup = isPopup
    }
  }
}
<commit_msg>IDEA-CR-48751: Copy shortcut from stub to actual action group (e.g. "Database tools" action group has a shortcut assigned)<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.openapi.actionSystem

import com.intellij.diagnostic.PluginException
import com.intellij.openapi.extensions.PluginId

interface ActionStubBase {
  val id: String
  val pluginId: PluginId?
  val iconPath: String?
}

class ActionGroupStub(
  override val id: String,
  val actionClass: String,
  val classLoader: ClassLoader,
  override val pluginId: PluginId
) : DefaultActionGroup(), ActionStubBase {

  var popupDefinedInXml = false

  override var iconPath: String? = null

  fun initGroup(target: ActionGroup) {
    ActionStub.copyTemplatePresentation(templatePresentation, target.templatePresentation)
    target.shortcutSet = shortcutSet
    val children = getChildren(null)
    if (children.isNotEmpty()) {
      val defaultActionGroup = target as? DefaultActionGroup
                               ?: throw PluginException(
                                 "Action group class must extend DefaultActionGroup for the group to accept children: $actionClass",
                                 pluginId)
      defaultActionGroup.addAll(children.toList())
    }
    if (popupDefinedInXml) {
      target.isPopup = isPopup
    }
  }
}

{'fraction_non_alphanumeric': 0.07016899338721529, 'fraction_numerical': 0.009184423218221896, 'mean_word_length': 3.1509146341463414, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2500309', 'n_tokens_mistral': 762, 'n_tokens_neox': 734, 'n_words': 227}