Skip to content

Commit

Permalink
Merge pull request cnescatlab#22 from WaldoFR/V3-dev
Browse files Browse the repository at this point in the history
Fix cnescatlab#14 & Update cnescatlab#16 using File instead of IPath
  • Loading branch information
dupuisa authored May 16, 2017
2 parents b563868 + 363bc9f commit aa3f533
Show file tree
Hide file tree
Showing 401 changed files with 25,438 additions and 25,023 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;

Expand All @@ -32,7 +32,7 @@ public abstract class AbstractAnalysisJob extends Job {
/** Extension id for the analyzer to use. **/
private String extensionId;
/** List of files to analyze. **/
private List<IPath> files;
private List<File> files;

/**
* Constructor for this Job with extension id in parameter and files' path.
Expand All @@ -43,7 +43,7 @@ public abstract class AbstractAnalysisJob extends Job {
* list of path for files to analyze
*/
public AbstractAnalysisJob(final String pExtensionId,
final List<IPath> pFiles) {
final List<File> pFiles) {
super("Running analysis...");
this.extensionId = pExtensionId;
this.files = pFiles;
Expand All @@ -63,7 +63,7 @@ public String getExtensionId() {
*
* @return the files
*/
public List<IPath> getFiles() {
public List<File> getFiles() {
return this.files;
}

Expand All @@ -83,7 +83,7 @@ public void setExtensionId(final String pExtensionId) {
* @param pFiles
* the files to set
*/
public void setFiles(final List<IPath> pFiles) {
public void setFiles(final List<File> pFiles) {
this.files = pFiles;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
Expand All @@ -15,7 +16,6 @@

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
Expand All @@ -36,7 +36,7 @@ public abstract class AbstractAnalyzer extends Job {
.getLogger(AbstractAnalyzer.class.getName());

/** Files to be analyzed. */
private List<IPath> files;
private List<File> files;
/** the id of rule/metric contribution **/
private String extensionId;

Expand All @@ -46,15 +46,15 @@ public abstract class AbstractAnalyzer extends Job {
*
* @param name
* the name of this Job
* @param pFiles
* @param pFilePath
* the files to analyze
* @param pExtensionId
* the id of rule/metric contribution
*/
public AbstractAnalyzer(final String name, final List<IPath> pFiles,
public AbstractAnalyzer(final String name, final List<File> pFilePath,
final String pExtensionId) {
super(name);
this.files = pFiles;
this.files = pFilePath;
this.extensionId = pExtensionId;
}

Expand All @@ -63,7 +63,7 @@ public AbstractAnalyzer(final String name, final List<IPath> pFiles,
*
* @return the files path.
*/
public List<IPath> getFiles() {
public List<File> getFiles() {
return this.files;
}

Expand All @@ -82,7 +82,7 @@ public String getExtensionId() {
* @param inputFiles
* the files path.
*/
public void setFiles(final List<IPath> inputFiles) {
public void setFiles(final List<File> inputFiles) {
this.files = inputFiles;
}

Expand Down Expand Up @@ -115,7 +115,7 @@ protected IStatus run(final IProgressMonitor monitor) {
.getConfigurationElementsFor(this.extensionId);

// Calculate total work to do
final List<IPath> pFiles = this.getFiles();
final List<File> pFiles = this.getFiles();
int totalEval = 0;
for (final IConfigurationElement contribution : evalContribs) {
if (PlatformUI.getPreferenceStore().getBoolean(
Expand Down Expand Up @@ -211,7 +211,7 @@ protected IStatus run(final IProgressMonitor monitor) {
*/
protected abstract IStatus runEvaluation(
final IConfigurationElement contribution,
final List<IPath> pFiles, final IProgressMonitor monitor)
final List<File> pFiles, final IProgressMonitor monitor)
throws CloneNotSupportedException, CoreException,
IOException, JFlexException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand All @@ -36,7 +36,7 @@ public class MetricAnalysisJob extends AbstractAnalysisJob {
* list of path for files to analyze
*/
public MetricAnalysisJob(final String pExtensionId,
final List<IPath> pFiles) {
final List<File> pFiles) {
super(pExtensionId, pFiles);
this.values = new LinkedList<FileValue>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*/
package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand All @@ -39,14 +39,14 @@ public class MetricAnalyzer extends AbstractAnalyzer {
*
* @param name
* the name of this Job
* @param pFiles
* @param pFile
* the files to analyze
* @param pExtensionId
* the id of rule/metric contribution
*/
public MetricAnalyzer(final String name, final List<IPath> pFiles,
public MetricAnalyzer(final String name, final List<File> pFile,
final String pExtensionId) {
super(name, pFiles, pExtensionId);
super(name, pFile, pExtensionId);
this.values = new LinkedList<FileValue>();
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public void setValues(final FileValue[] pValues) {
*/
@Override
protected IStatus runEvaluation(final IConfigurationElement contribution,
final List<IPath> pFiles, final IProgressMonitor monitor)
final List<File> pFiles, final IProgressMonitor monitor)
throws CloneNotSupportedException, CoreException,
IOException, JFlexException {
LOGGER.finest("Begin runEvaluation method");
Expand All @@ -100,18 +100,17 @@ protected IStatus runEvaluation(final IConfigurationElement contribution,
IStatus status = Status.OK_STATUS;

// Run analysis on all files
for (final IPath file : pFiles) {

for (final File file : pFiles) {
// Get the evaluation
final AbstractMetric metric =
(AbstractMetric) contribution
.createExecutableExtension("class");
metric.setContribution(contribution);

// Run the evaluation
LOGGER.finest("File : " + file.toFile().getName());
LOGGER.finest("File : " + file.getName());
monitor.subTask("Analyzing " + contribution.getAttribute("id")
+ " on file " + file.toFile().getName());
+ " on file " + file.getName());
this.values.add(this.runMetricOnFile(metric, file));
monitor.worked(1);

Expand Down Expand Up @@ -140,7 +139,7 @@ protected IStatus runEvaluation(final IConfigurationElement contribution,
* JFlex analysis error
*/
private FileValue runMetricOnFile(final AbstractMetric metric,
final IPath file) throws IOException,
final File file) throws IOException,
JFlexException {
LOGGER.finest("Begin runEvaluationOnFile method");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand All @@ -35,7 +35,7 @@ public class RuleAnalysisJob extends AbstractAnalysisJob {
* @param pFiles
* list of path for files to analyze
*/
public RuleAnalysisJob(final String pExtensionId, final List<IPath> pFiles) {
public RuleAnalysisJob(final String pExtensionId, final List<File> pFiles) {
super(pExtensionId, pFiles);
this.violations = new LinkedList<Violation>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*/
package fr.cnes.analysis.tools.analyzer;

import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand All @@ -39,14 +39,14 @@ public class RuleAnalyzer extends AbstractAnalyzer {
*
* @param name
* the name of this Job
* @param pFiles
* @param list
* the files to analyze
* @param pExtensionId
* the id of rule/metric contribution
*/
public RuleAnalyzer(final String name, final List<IPath> pFiles,
public RuleAnalyzer(final String name, final List<File> list,
final String pExtensionId) {
super(name, pFiles, pExtensionId);
super(name, list, pExtensionId);
this.violations = new LinkedList<Violation>();
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public void setDescriptors(final Violation[] pViolations) {
*/
@Override
protected IStatus runEvaluation(final IConfigurationElement contribution,
final List<IPath> pFiles, final IProgressMonitor monitor)
final List<File> pFiles, final IProgressMonitor monitor)
throws CloneNotSupportedException, CoreException, IOException,
JFlexException {
LOGGER.finest("Begin runEvaluation method");
Expand All @@ -101,17 +101,17 @@ protected IStatus runEvaluation(final IConfigurationElement contribution,
IStatus status = Status.OK_STATUS;

// Run analysis on all files
for (final IPath file : pFiles) {
for (final File file : pFiles) {

// Get the evaluation
final AbstractRule rule = (AbstractRule) contribution
.createExecutableExtension("class");
rule.setContribution(contribution);

// Run the evaluation
LOGGER.finest("File : " + file.toFile().getName());
LOGGER.finest("File : " + file.getName());
monitor.subTask("Analyzing " + contribution.getAttribute("id")
+ " on file " + file.toFile().getName());
+ " on file " + file.getName());
this.violations.addAll(this.runRuleOnFile(rule, file));
monitor.worked(1);

Expand Down Expand Up @@ -140,7 +140,7 @@ protected IStatus runEvaluation(final IConfigurationElement contribution,
* JFlex analysis error
*/
private List<Violation> runRuleOnFile(final AbstractRule rule,
final IPath file) throws IOException, JFlexException {
final File file) throws IOException, JFlexException {
LOGGER.finest("Begin runRuleOnFile method");

// Initializing file reader in the metric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/
package fr.cnes.analysis.tools.analyzer.datas;

import java.io.File;
import java.io.FileNotFoundException;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;

/**
* Abstract class implementing the generic application of a rule or metric over
Expand Down Expand Up @@ -48,5 +48,5 @@ public void setContribution(final IConfigurationElement pContribution) {
* @throws FileNotFoundException
* exception thrown when a file is not found
*/
public abstract void setInputFile(IPath file) throws FileNotFoundException;
public abstract void setInputFile(File file) throws FileNotFoundException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*/
package fr.cnes.analysis.tools.analyzer.datas;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import org.eclipse.core.runtime.IPath;

import fr.cnes.analysis.tools.analyzer.exception.JFlexException;

/**
Expand Down Expand Up @@ -108,7 +107,7 @@ protected void setError(final String pLocation, final String pMessage, final int
* (org.eclipse.core.runtime.IPath)
*/
@Override
public void setInputFile(final IPath file) throws FileNotFoundException {
public void setInputFile(final File file) throws FileNotFoundException {
this.violations = new LinkedList<Violation>();
this.violation =
new Violation(this.getContribution().getAttribute("name"),
Expand Down
Loading

0 comments on commit aa3f533

Please sign in to comment.