use of org.eclipse.titanium.error.ConsoleErrorHandler in project titan.EclipsePlug-ins by eclipse.
the class SonarDataExporter method exportMetrics.
private void exportMetrics(final URI exportDir) throws IOException {
final URI filePath = URIUtil.append(exportDir, "metrics.xml");
final File file = new File(filePath);
FileUtils.delete(file);
final SonarMetricsExporter exporter = new SonarMetricsExporter();
try {
exporter.export(MetricData.measure(project), file);
} catch (JAXBException e) {
new ConsoleErrorHandler().reportException("Error while exporting the project metrics", e);
}
}
use of org.eclipse.titanium.error.ConsoleErrorHandler in project titan.EclipsePlug-ins by eclipse.
the class SaveComponentNet method exportInformationForProject.
@Override
protected void exportInformationForProject(final String[] args, final IProject project, final IProgressMonitor monitor) {
final ErrorHandler errorHandler = new ConsoleErrorHandler();
final ComponentGraphGenerator generator = new ComponentGraphGenerator(project, errorHandler);
try {
generator.generateGraph();
GraphHandler.saveGraphToPajek(generator.getGraph(), args[0] + project.getName() + ".net");
} catch (Exception e) {
errorHandler.reportException("Error while exporting", e);
}
}
use of org.eclipse.titanium.error.ConsoleErrorHandler in project titan.EclipsePlug-ins by eclipse.
the class SaveModuleDot method exportInformationForProject.
@Override
protected void exportInformationForProject(final String[] args, final IProject project, final IProgressMonitor monitor) {
final ErrorHandler errorHandler = new ConsoleErrorHandler();
final ModuleGraphGenerator generator = new ModuleGraphGenerator(project, errorHandler);
try {
generator.generateGraph();
String clusterName = "";
for (int i = 1; i < args.length; ++i) {
if (args[i].startsWith("-c")) {
clusterName = args[i].substring(2);
}
}
if (clusterName.isEmpty()) {
graph = generator.getGraph();
} else {
final BaseCluster clusterer = new ClustererBuilder().setAlgorithm(clusterName).setGraph(generator.getGraph()).setProject(project).build();
clusterer.run(monitor, false);
graph = clusterer.getGraph();
}
final String fileName = args[0] + project.getName() + ".dot";
GraphHandler.saveGraphToDot(graph, fileName, project.getName());
errorHandler.reportInformation("The graphs have been successfully saved. See results at " + new File(fileName).getAbsolutePath());
} catch (Exception e) {
errorHandler.reportException("Error while exporting", e);
}
}
use of org.eclipse.titanium.error.ConsoleErrorHandler in project titan.EclipsePlug-ins by eclipse.
the class ClustererBuilder method build.
/**
* This method builds up the convenient clusterer object
* @return The built object
* @throws IllegalArgumentException If some needed parameters are not already set
*/
public BaseCluster build() throws IllegalArgumentException {
if (originalGraph == null) {
throw new IllegalArgumentException("The graph parameter wasn't set for the builder");
}
final ConsoleErrorHandler errorHandler = new ConsoleErrorHandler();
BaseCluster clusterer = null;
if ("modulelocation".equalsIgnoreCase(clusterName)) {
clusterer = new ModuleLocationCluster(originalGraph, project);
} else if ("foldername".equalsIgnoreCase(clusterName)) {
clusterer = new FolderNameCluster(originalGraph, project);
} else if ("linkedlocation".equalsIgnoreCase(clusterName)) {
clusterer = new LinkedFileCluster(originalGraph, project);
} else if ("regularexpression".equalsIgnoreCase(clusterName)) {
clusterer = new RegexpCluster(originalGraph);
} else if ("modulename".equalsIgnoreCase(clusterName)) {
clusterer = new ModuleNameCluster(originalGraph);
} else if ("fullmodulenametree".equalsIgnoreCase(clusterName)) {
clusterer = new FullModuleNameCluster(originalGraph);
} else if ("sparsemodulenametree".equalsIgnoreCase(clusterName)) {
clusterer = new SparseModuleNameCluster(originalGraph);
} else if ("automatic".equalsIgnoreCase(clusterName)) {
clusterer = new AutomaticCluster(originalGraph, project);
} else {
errorHandler.reportInformation("Usage: <output path> [-c<clustering algorithm name>]");
errorHandler.reportInformation("The possible clustering algorithms are: ");
errorHandler.reportInformation("\tModuleLocation\n\tFolderName\n\tLinkedLocation\n\tRegularExpression\n\tModuleName\n" + "\tFullModuleNameTree\n\tSparseModuleNameTree");
throw new IllegalArgumentException("The algorithm doesn't exist!");
}
return clusterer;
}
use of org.eclipse.titanium.error.ConsoleErrorHandler in project titan.EclipsePlug-ins by eclipse.
the class SaveComponentDot method exportInformationForProject.
@Override
protected void exportInformationForProject(final String[] args, final IProject project, final IProgressMonitor monitor) {
final ErrorHandler errorHandler = new ConsoleErrorHandler();
final ComponentGraphGenerator generator = new ComponentGraphGenerator(project, errorHandler);
try {
generator.generateGraph();
GraphHandler.saveGraphToDot(generator.getGraph(), args[0] + project.getName() + ".dot", project.getName());
} catch (Exception e) {
errorHandler.reportException("Error while exporting", e);
}
}
Aggregations