import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.Session;
-import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.adapter.CopyHandler;
import org.simantics.db.layer0.util.ClipboardUtils;
import org.simantics.graph.representation.TransferableGraph1;
import org.simantics.modeling.template2d.DiagramTemplateConstants;
import org.simantics.utils.ui.dialogs.ShowMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Tuukka Lehtonen
- * @author Teemu Mätäsniemi
+ * @author Teemu M�t�sniemi
*/
public class DrawingTemplateExporter implements IRunnableWithProgress {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DrawingTemplateExporter.class);
+
ExportPlan exportModel;
public DrawingTemplateExporter(ExportPlan exportModel) {
public SimanticsClipboard perform(ReadGraph graph) throws DatabaseException {
CopyHandler ch = graph.adapt(template, CopyHandler.class);
SimanticsClipboardImpl clipboard = new SimanticsClipboardImpl();
- ch.copyToClipboard(graph, clipboard);
+ ch.copyToClipboard(graph, clipboard, SubMonitor.convert(mon, 50));
return clipboard;
}
});
for (Set<Representation> object : clipboard.getContents()) {
TransferableGraph1 tg = ClipboardUtils.accept(object, SimanticsKeys.KEY_TRANSFERABLE_GRAPH);
- mon.worked(95);
+ mon.worked(50);
mon.setTaskName("Writing transferable graph...");
DataContainers.writeFile(location, new DataContainer(
DiagramTemplateConstants.DRAWING_TEMPLATE_FORMAT, DiagramTemplateConstants.DRAWING_TEMPLATE_CURRENT_VERSION,
new Variant(TransferableGraph1.BINDING, tg)));
-
mon.worked(5);
}
-
} catch (DatabaseException e) {
- e.printStackTrace();
- Logger.defaultLogError(e);
+ LOGGER.error("Drawing template export failed", e);
mon.setCanceled(true);
ShowMessage.showError("Export failed.", "Internal application error in export. See log for details.");
}