Map<EObject, String> latexMap = new HashMap<EObject, String>();
// do parent
super.doExport(targetDiagram, container, new SubProgressMonitor(monitor, 70));
IProgressMonitor finalMonitor = new SubProgressMonitor(monitor, 30);
finalMonitor.beginTask("Writing HTML files", partDestinationMap.size() * 2);
// get all image parts
for (DiagramEditPart root : partDestinationMap.keySet()) {
if (monitor.isCanceled())
return;
IPath destination = partDestinationMap.get(root);
IPath htmlDestination = getHTMLDestinationFor(destination);
EObject resolved = partEObjectMap.get(root);
finalMonitor.subTask("Writing " + htmlDestination.lastSegment());
// construct the HTML
StringBuffer html = new StringBuffer();
html.append(getHTMLHeader(targetDiagram, resolved))
.append(getBreadcrumb(resolved))
.append(getImageTag(destination))
.append(getClickableMap(root))
.append(getHTMLFooter());
// add the SVG
latexMap.put(resolved, getLatexTag(resolved, destination));
finalMonitor.worked(1);
// export HTML page
try {
File destFile = new File(htmlDestination.toOSString());
FileWriter fw = new FileWriter(destFile);
fw.write(html.toString());
fw.close();
} catch (IOException e) {
throw new ExportImageException("Could not export individual HTML page '" + htmlDestination + "': " + e.getMessage(), e);
}
finalMonitor.worked(1);
}
// export Latex page
IPath latexDestination = targetDiagram.getLocation().removeFileExtension().addFileExtension("tex");
try {
File destFile = new File(latexDestination.toOSString());
FileWriter fw = new FileWriter(destFile);
// we want to sort the latex output based on EObject depth
List<EObject> objectList = new ArrayList<EObject>(latexMap.keySet());
Collections.sort(objectList, new EObjectDepthComparator());
for (EObject obj : objectList) {
fw.write(latexMap.get(obj));
}
fw.close();
finalMonitor.worked(5);
} catch (IOException e) {
throw new ExportImageException("Could not export Latex page '" + latexDestination + "': " + e.getMessage(), e);
}
finalMonitor.done();
// once finished, refresh parent (folder, project)
try {
targetDiagram.getParent().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 5));
} catch (CoreException e) {