+/*******************************************************************************
+ * Copyright (c) 2019 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
package org.simantics.scl.db;
import java.io.IOException;
}
}
+ public static void runWithGraph(Object graph, Runnable r) {
+ final SCLContext context = SCLContext.getCurrent();
+ SCLContext.push(context);
+ Object oldGraph = context.put(GRAPH, graph);
+ try {
+ r.run();
+ } finally {
+ context.put(GRAPH, oldGraph);
+ SCLContext.pop();
+ }
+ }
+
private static Object[] NO_ARGS = new Object[] { Tuple0.INSTANCE };
public static <T> void asyncRead(final Function f) throws DatabaseException {