- Simantics.getSession().asyncRequest(new WriteRequest() {
- @Override
- public void perform(WriteGraph graph) throws DatabaseException {
- SCLContext.push(context);
- context.put(GRAPH, graph);
- try {
- f.apply(Tuple0.INSTANCE);
- } finally {
- SCLContext.pop();
+ if (Simantics.peekSession() != null) {
+ Simantics.getSession().asyncRequest(new WriteRequest() {
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ SCLContext.push(context);
+ context.put(GRAPH, graph);
+ try {
+ f.apply(Tuple0.INSTANCE);
+ } finally {
+ SCLContext.pop();
+ }