Search in sources :

Example 1 with ModuleGraphGenerator

use of org.eclipse.titanium.graph.generators.ModuleGraphGenerator in project titan.EclipsePlug-ins by eclipse.

the class ModuleGraphEditor method initGeneratorAndHandler.

@Override
protected void initGeneratorAndHandler(final Composite parent) {
    handler = new MeasureableGraphHandler(parent.getShell());
    generator = new ModuleGraphGenerator(((IFileEditorInput) getEditorInput()).getFile().getProject(), errorHandler);
}
Also used : MeasureableGraphHandler(org.eclipse.titanium.graph.visualization.MeasureableGraphHandler) ModuleGraphGenerator(org.eclipse.titanium.graph.generators.ModuleGraphGenerator)

Example 2 with ModuleGraphGenerator

use of org.eclipse.titanium.graph.generators.ModuleGraphGenerator 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);
    }
}
Also used : ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) ErrorHandler(org.eclipse.titanium.error.ErrorHandler) ModuleGraphGenerator(org.eclipse.titanium.graph.generators.ModuleGraphGenerator) ClustererBuilder(org.eclipse.titanium.graph.clustering.ClustererBuilder) BaseCluster(org.eclipse.titanium.graph.clustering.BaseCluster) ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) File(java.io.File)

Example 3 with ModuleGraphGenerator

use of org.eclipse.titanium.graph.generators.ModuleGraphGenerator in project titan.EclipsePlug-ins by eclipse.

the class SaveModuleNet 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() + ".net";
        GraphHandler.saveGraphToPajek(graph, fileName);
        errorHandler.reportInformation("The graphs have been successfully saved. See results at " + new File(fileName).getAbsolutePath());
    } catch (Exception e) {
        errorHandler.reportException("Error while exporting", e);
    }
}
Also used : ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) ErrorHandler(org.eclipse.titanium.error.ErrorHandler) ModuleGraphGenerator(org.eclipse.titanium.graph.generators.ModuleGraphGenerator) ClustererBuilder(org.eclipse.titanium.graph.clustering.ClustererBuilder) BaseCluster(org.eclipse.titanium.graph.clustering.BaseCluster) ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) File(java.io.File)

Example 4 with ModuleGraphGenerator

use of org.eclipse.titanium.graph.generators.ModuleGraphGenerator in project titan.EclipsePlug-ins by eclipse.

the class SonarDataExporter method exportModuleDot.

private void exportModuleDot(final URI exportDir) {
    final URI filePath = URIUtil.append(exportDir, "module_graph.dot");
    final ErrorHandler errorHandler = new ConsoleErrorHandler();
    final GraphGenerator generator = new ModuleGraphGenerator(project, errorHandler);
    try {
        generator.generateGraph();
        GraphHandler.saveGraphToDot(generator.getGraph(), filePath.getPath(), project.getName());
    } catch (Exception e) {
        errorHandler.reportException("Error while exporting the module graph", e);
    }
}
Also used : ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) ErrorHandler(org.eclipse.titanium.error.ErrorHandler) ModuleGraphGenerator(org.eclipse.titanium.graph.generators.ModuleGraphGenerator) GraphGenerator(org.eclipse.titanium.graph.generators.GraphGenerator) ModuleGraphGenerator(org.eclipse.titanium.graph.generators.ModuleGraphGenerator) ComponentGraphGenerator(org.eclipse.titanium.graph.generators.ComponentGraphGenerator) ConsoleErrorHandler(org.eclipse.titanium.error.ConsoleErrorHandler) URI(java.net.URI) IOException(java.io.IOException) JAXBException(javax.xml.bind.JAXBException)

Aggregations

ModuleGraphGenerator (org.eclipse.titanium.graph.generators.ModuleGraphGenerator)4 ConsoleErrorHandler (org.eclipse.titanium.error.ConsoleErrorHandler)3 ErrorHandler (org.eclipse.titanium.error.ErrorHandler)3 File (java.io.File)2 BaseCluster (org.eclipse.titanium.graph.clustering.BaseCluster)2 ClustererBuilder (org.eclipse.titanium.graph.clustering.ClustererBuilder)2 IOException (java.io.IOException)1 URI (java.net.URI)1 JAXBException (javax.xml.bind.JAXBException)1 ComponentGraphGenerator (org.eclipse.titanium.graph.generators.ComponentGraphGenerator)1 GraphGenerator (org.eclipse.titanium.graph.generators.GraphGenerator)1 MeasureableGraphHandler (org.eclipse.titanium.graph.visualization.MeasureableGraphHandler)1