Job job = new WorkspaceJob("Generate architecture graph") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
monitor.beginTask("Loading architecture", IProgressMonitor.UNKNOWN);
ArchitectureMappingModel model = null;
try {
model = ArchitectureMappingCache.getArchitectureMappingModel(project);
if (model == null) {
return Status.CANCEL_STATUS;
}
} catch (ArchMapperException e) {
showErrorAsync("Error reading architecture: "+ e.getMessage());
e.printStackTrace();
return Status.CANCEL_STATUS;
}
monitor.beginTask("Generating graph definition file", IProgressMonitor.UNKNOWN);
String def = new DotGraphExporter().getDotGraphDefinition(model.getArchitecture());
File out = new File(filename);
try {
FileWriter writer = new FileWriter(out);
writer.write(def);