<commit_before>/*
 * Copyright 2005-2010 LAMP/EPFL
 */
// $Id$

package scala.tools.eclipse
package javaelements

import java.io.ByteArrayInputStream
import org.eclipse.jdt.internal.core.{ ClassFile, PackageFragment }
import scala.tools.eclipse.contribution.weaving.jdt.cfprovider.IClassFileProvider
import scala.tools.eclipse.ScalaClassFileDescriber
import org.eclipse.jdt.core.IClassFile
import scala.tools.eclipse.util.HasLogger

class ScalaClassFileProvider extends IClassFileProvider with HasLogger {
  override def create(contents : Array[Byte], parent : PackageFragment, name : String) : ClassFile =
    ScalaClassFileDescriber.isScala(new ByteArrayInputStream(contents)) match {
      case Some(sourceFile) =>
        val scf = new ScalaClassFile(parent, name, sourceFile)
        val sourceMapper = parent.getSourceMapper
        if (sourceMapper == null)
          null
        else {
          val source = sourceMapper.findSource(scf.getType, sourceFile)
          if (source != null) scf else null
        }
      case _ => null
    }
  
  override def isInteresting(classFile: IClassFile): Boolean = {
    val res = ScalaPlugin.plugin.isScalaProject(classFile.getJavaProject())
    if (!res) 
      logger.debug("Not interested in %s in project %s".format(classFile.getElementName(), classFile.getJavaProject()))
    res
  }
}<commit_msg>One more try at reducing the amount of output logged by the classfile provider.<commit_after>/*
 * Copyright 2005-2010 LAMP/EPFL
 */
// $Id$

package scala.tools.eclipse
package javaelements

import java.io.ByteArrayInputStream
import org.eclipse.jdt.internal.core.{ ClassFile, PackageFragment }
import scala.tools.eclipse.contribution.weaving.jdt.cfprovider.IClassFileProvider
import scala.tools.eclipse.ScalaClassFileDescriber
import org.eclipse.jdt.core.IClassFile
import scala.tools.eclipse.util.HasLogger

class ScalaClassFileProvider extends IClassFileProvider with HasLogger {
  override def create(contents : Array[Byte], parent : PackageFragment, name : String) : ClassFile =
    ScalaClassFileDescriber.isScala(new ByteArrayInputStream(contents)) match {
      case Some(sourceFile) =>
        val scf = new ScalaClassFile(parent, name, sourceFile)
        val sourceMapper = parent.getSourceMapper
        if (sourceMapper == null)
          null
        else {
          val source = sourceMapper.findSource(scf.getType, sourceFile)
          if (source != null) scf else null
        }
      case _ => null
    }
  
  override def isInteresting(classFile: IClassFile): Boolean = {
    val res = ScalaPlugin.plugin.isScalaProject(classFile.getJavaProject())
    if (!res) 
      logger.debug("Not interested in %s in project %s".format(classFile.getElementName(), classFile.getJavaProject().getElementName()))
    res
  }
}
{'fraction_non_alphanumeric': 0.0932902762827413, 'fraction_numerical': 0.0057409400789379264, 'mean_word_length': 3.823529411764706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3320695', 'n_tokens_mistral': 816, 'n_tokens_neox': 792, 'n_words': 189}