<commit_before>package com.ideacolorschemes.ideacolor

import util.Loggable
import com.intellij.openapi.editor.colors.{EditorColorsScheme, EditorColorsListener}
import com.intellij.openapi.components.{ServiceManager, ApplicationComponent}

/**
* @author il
*/
class SchemeBookComponent extends ApplicationComponent with Loggable {
  val schemeBookManager = ServiceManager.getService(classOf[SchemeBookManager])
  import schemeBookManager._

  def initComponent() {
    editorColorsManager.addEditorColorsListener(new EditorColorsListener{
      def globalSchemeChange(scheme: EditorColorsScheme) {
        val name = scheme.getName
        if (contains(name)) {
          currentBook = Some(name)
        }
      }
    })

    UserManager.subscribe(schemeBookManager)

    // todo: run async
    initUpdate()
  }

  def disposeComponent() {
  }

  def getComponentName = "ideacolor.SchemeBookManager"
}<commit_msg>Run initUpdate just after app starting.<commit_after>package com.ideacolorschemes.ideacolor

import util.Loggable
import com.intellij.openapi.editor.colors.{EditorColorsScheme, EditorColorsListener}
import com.intellij.openapi.components.{ServiceManager, ApplicationComponent}
import com.intellij.openapi.progress.Task.Backgroundable
import com.intellij.openapi.progress.{ProgressIndicator, ProgressManager}
import com.intellij.openapi.project.Project
import com.intellij.openapi.application.ApplicationManager
import com.intellij.ide.AppLifecycleListener

/**
 * @author il
 */
class SchemeBookComponent extends ApplicationComponent with Loggable {
  val schemeBookManager = ServiceManager.getService(classOf[SchemeBookManager])

  import schemeBookManager._

  def initComponent() {
    editorColorsManager.addEditorColorsListener(new EditorColorsListener {
      def globalSchemeChange(scheme: EditorColorsScheme) {
        val name = scheme.getName
        if (contains(name)) {
          currentBook = Some(name)
        }
      }
    })

    UserManager.subscribe(schemeBookManager)

    val listener: AppLifecycleListener = new AppLifecycleListener.Adapter {
      override def appStarting(projectFromCommandLine: Project) {
        ProgressManager.getInstance().run(new Backgroundable(projectFromCommandLine, "Update color schemes", false) {
          def run(indicator: ProgressIndicator) {
            initUpdate()
          }
        })
      }
    }

    ApplicationManager.getApplication.getMessageBus.connect().subscribe(AppLifecycleListener.TOPIC, listener)
  }

  def disposeComponent() {
  }

  def getComponentName = "ideacolor.SchemeBookManager"
}
{'fraction_non_alphanumeric': 0.08372093023255814, 'fraction_numerical': 0.0, 'mean_word_length': 4.310699588477366, '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': '1117524', 'n_tokens_mistral': 707, 'n_tokens_neox': 697, 'n_words': 127}