<commit_before>package org.jetbrains.plugins.scala
package worksheet.actions

import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent}
import com.intellij.psi.PsiFileFactory
import org.jetbrains.plugins.scala.actions.ScalaActionUtil

/**
 * User: Dmitry.Naydanov
 * Date: 26.05.14.
 */
class CreateLightWorksheetAction extends AnAction {
  override def actionPerformed(e: AnActionEvent) {
    PsiFileFactory.getInstance(e.getProject).createFileFromText("dummy." + ScalaFileType.WORKSHEET_EXTENSION,
      ScalaFileType.SCALA_LANGUAGE, "").navigate(true)
  }

  override def update(e: AnActionEvent) {<commit_msg>Worksheet: now creating scratch with scala language when 'Create Light Worksheet' action invoked (experimental)<commit_after>package org.jetbrains.plugins.scala
package worksheet.actions

import com.intellij.ide.scratch.{ScratchFileService, ScratchRootType}
import com.intellij.openapi.actionSystem.{AnAction, AnActionEvent, CommonDataKeys}
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.util.text.StringUtil
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.plugins.scala.actions.ScalaActionUtil

/**
 * User: Dmitry.Naydanov
 * Date: 26.05.14.
 */
class CreateLightWorksheetAction extends AnAction {
  override def actionPerformed(e: AnActionEvent) {
    val project = e.getProject
    val editor = e getData CommonDataKeys.EDITOR
    val text = StringUtil.notNullize(if (editor == null) null else editor.getSelectionModel.getSelectedText)
    
    val f: VirtualFile = ScratchRootType.getInstance.createScratchFile(
      project, "scratch", ScalaFileType.SCALA_LANGUAGE, text, ScratchFileService.Option.create_new_always)
    if (f != null) FileEditorManager.getInstance(project).openFile(f, true)
  }

  override def update(e: AnActionEvent) {
{'fraction_non_alphanumeric': 0.09489851892484914, 'fraction_numerical': 0.006582556226001097, 'mean_word_length': 5.681318681318682, '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': '3024409', 'n_tokens_mistral': 593, 'n_tokens_neox': 568, 'n_words': 109}