<commit_before>package org.jetbrains.plugins.scala.lang.structureView

import org.jetbrains.plugins.scala.lang.psi._
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef._
import org.jetbrains.plugins.scala.lang.psi.api.statements._
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.packaging._
import com.intellij.psi._
import org.jetbrains.plugins.scala.lang.psi.api.base._

/**
* @author <NAME>
* Date: 04.05.2008
*/

object ScalaElementPresentation {

  //TODO refactor with name getters

  def getFilePresentableText(file: ScalaFile): String = {
    return file.getName()
  }

  def getPackagingPresentableText(packaging: ScPackaging): String = {
    return packaging.getPackageName
  }

  def getTypeDefinitionPresentableText(typeDefinition: ScTypeDefinition): String = {
    if (typeDefinition.nameId != null)
      return typeDefinition.nameId.getText()
    else
      return "unnamed"
  }

  def getPrimaryConstructorPresentableText(constructor: ScPrimaryConstructor): String = {
    val presentableText: StringBuffer = new StringBuffer("")
    presentableText.append("this")
    if (constructor.parameters != null)
      presentableText.append(StructureViewUtil.getParametersAsString(constructor.parameters))
    return presentableText.toString()
  }

  def getMethodPresentableText(function: ScFunction): String = {
    val presentableText: StringBuffer = new StringBuffer("")
      presentableText.append(function.getName)

    function.typeParametersClause match {
      case Some(clause) => presentableText.append(clause.getText)
      case _ => ()
    }

    if (function.paramClauses != null)
      presentableText.append(StructureViewUtil.getParametersAsString(function.paramClauses))
    function.returnTypeElement match {
      case Some(rte) => {
        presentableText.append(": ")
        presentableText.append(rte.getText)
      }
      case None =>
    }

    return presentableText.toString()
  }

  def getTypeAliasPresentableText(typeAlias: ScTypeAlias): String = {
    if (typeAlias.nameId != null)
      return typeAlias.nameId.getText()
    else
      return "unnamed"
  }

  def getPresentableText(elem: PsiElement): String = {
    return elem.getText
  }
}<commit_msg>TypeAlias presentation in structure view(2)<commit_after>package org.jetbrains.plugins.scala.lang.structureView

import org.jetbrains.plugins.scala.lang.psi._
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef._
import org.jetbrains.plugins.scala.lang.psi.api.statements._
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.packaging._
import com.intellij.psi._
import org.jetbrains.plugins.scala.lang.psi.api.base._

/**
* @author <NAME>
* Date: 04.05.2008
*/

object ScalaElementPresentation {

  //TODO refactor with name getters

  def getFilePresentableText(file: ScalaFile): String = {
    return file.getName()
  }

  def getPackagingPresentableText(packaging: ScPackaging): String = {
    return packaging.getPackageName
  }

  def getTypeDefinitionPresentableText(typeDefinition: ScTypeDefinition): String = {
    if (typeDefinition.nameId != null)
      return typeDefinition.nameId.getText()
    else
      return "unnamed"
  }

  def getPrimaryConstructorPresentableText(constructor: ScPrimaryConstructor): String = {
    val presentableText: StringBuffer = new StringBuffer("")
    presentableText.append("this")
    if (constructor.parameters != null)
      presentableText.append(StructureViewUtil.getParametersAsString(constructor.parameters))
    return presentableText.toString()
  }

  def getMethodPresentableText(function: ScFunction): String = {
    val presentableText: StringBuffer = new StringBuffer("")
      presentableText.append(function.getName)

    function.typeParametersClause match {
      case Some(clause) => presentableText.append(clause.getText)
      case _ => ()
    }

    if (function.paramClauses != null)
      presentableText.append(StructureViewUtil.getParametersAsString(function.paramClauses))
    function.returnTypeElement match {
      case Some(rte) => {
        presentableText.append(": ")
        presentableText.append(rte.getText)
      }
      case None =>
    }

    return presentableText.toString()
  }

  def getTypeAliasPresentableText(typeAlias: ScTypeAlias): String = {
    if (typeAlias.nameId != null)
      return "type" + typeAlias.nameId.getText()
    else
      return "type unnamed"
  }

  def getPresentableText(elem: PsiElement): String = {
    return elem.getText
  }
}
{'fraction_non_alphanumeric': 0.10410164957646009, 'fraction_numerical': 0.003789567543468569, 'mean_word_length': 3.9966592427616927, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 13, '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': '264214', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1296, 'n_words': 232}