- ThreadUtils.getBlockingWorkExecutor().execute(new Runnable() {
- @Override
- public void run() {
- try {
- Pair<Resource, String> modelAndRVI = sessionContext.getSession().syncRequest(new UniqueRead<Pair<Resource, String>>() {
- @Override
- public Pair<Resource, String> perform(ReadGraph graph) throws DatabaseException {
- return new Pair<Resource, String>( resolveModel(graph, node), resolveRVI(graph, node) );
- }
- });
-
- final Boolean isSymbol = sessionContext.getSession().syncRequest(new UniqueRead<Boolean>() {
- @Override
- public Boolean perform(ReadGraph graph) throws DatabaseException {
- StructuralResource2 STR = StructuralResource2.getInstance(graph);
- DiagramResource DIA = DiagramResource.getInstance(graph);
- Resource possibleSymbol = graph.getPossibleObject(node.getDiagramResource(), STR.Defines);
- return possibleSymbol != null && graph.isInstanceOf(possibleSymbol, DIA.ElementClass);
- }
- });
-
- ICanvasSceneGraphProvider provider = DiagramNodeUtil.loadSceneGraphProvider(ctx, modelAndRVI.first, node.getDiagramResource(), modelAndRVI.second, 5000);
- sgProvider.set( provider );
- ctx.getDefaultHintContext().setHint(Hints.KEY_PAGE_DESC, pageDesc);
-
-// StringBuilder b = new StringBuilder();
-// NodeUtil.printTreeNodes(ctx.getCanvasNode(), b);
-// System.err.println(b.toString());
-
- ThreadUtils.asyncExec(thread, new Runnable() {
- @Override
- public void run() {
- try {
- PDFBuilder chassis = new PDFBuilder(writer, mapper, pageSize, pageDesc, fitDiagramContentsToPageMargins || isSymbol);
-
- chassis.paint(ctx, true);
- } finally {
- done.release();
- }
- }
- });
- } catch (DatabaseException e) {
- done.release();
- exception.set(e);
- } catch (Throwable e) {
- done.release();
- exception.set(new DatabaseException(e));
- } finally {
- done.release();
- }
+ ThreadUtils.getBlockingWorkExecutor().execute(() -> {
+ try {
+ Session s = exportModel.sessionContext.getSession();
+
+ Pair<Resource, String> modelAndRVI = s.syncRequest( modelAndRVI(node) );
+ Boolean isSymbol = s.syncRequest( isSymbol(node) );
+
+ ICanvasSceneGraphProvider provider = DiagramNodeUtil.loadSceneGraphProvider(
+ ctx,
+ modelAndRVI.first,
+ node.getDiagramResource(),
+ modelAndRVI.second,
+ 5000);
+ sgProvider[0] = provider;
+ ctx.getDefaultHintContext().setHint(Hints.KEY_PAGE_DESC, pageDesc);
+
+// System.err.println(NodeUtil.printTreeNodes(ctx.getCanvasNode(), new StringBuilder()).toString());
+
+ ThreadUtils.asyncExec(thread, () -> {
+ try {
+ PDFBuilder chassis = new PDFBuilder(writer, mapper, pageSize, pageDesc, fitDiagramContentsToPageMargins || isSymbol);
+ chassis.paint(ctx, true);
+ } catch (Throwable e) {
+ exception[0] = new DatabaseException(e);
+ } finally {
+ done.release();
+ }
+ });
+ } catch (DatabaseException e) {
+ done.release();
+ exception[0] = e;
+ } catch (Throwable e) {
+ done.release();
+ exception[0] = new DatabaseException(e);
+ } finally {
+ done.release();