package org.sonar.plugins.stash;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.resources.Project;

/*
 * FIXME this should not be necessary, the new plugin API gives us direct access to the InputFile of an issue
 */
public class InputFileCacheSensor implements Sensor, BatchComponent {
    private static final Logger LOGGER = LoggerFactory.getLogger(InputFileCacheSensor.class);
    private final InputFileCache inputFileCache;
    private final FileSystem fileSystem;

    public InputFileCacheSensor(InputFileCache inputFileCache, FileSystem fileSystem) {
        this.inputFileCache = inputFileCache;
        this.fileSystem = fileSystem;
    }

    @Override
    public void analyse(Project module, SensorContext context) {
        for (InputFile inputFile : fileSystem.inputFiles(fileSystem.predicates().all())) {
            inputFileCache.putInputFile(context.getResource(inputFile).getEffectiveKey(), inputFile);
        }
    }

    @Override
    public boolean shouldExecuteOnProject(Project project) {
        return true;
    }
}

@@ -513,102 +513,8 @@
 t %7B%0A
-    private static final Logger LOGGER = LoggerFactory.getLogger(InputFileCacheSensor.class);%0A
     

remove dead code