package org.simantics.scl.runtime;
+import org.simantics.scl.runtime.reporting.SCLReportingHandler;
+
import gnu.trove.map.hash.THashMap;
public class SCLContext extends THashMap<String,Object> {
CONTEXT.set(newContext);
}
+ /**
+ * Creates a new context based on some properties of the current context.
+ * The new context is safe for use in parallel threads.
+ */
+ public static SCLContext createDerivedContext() {
+ SCLContext newContext = new SCLContext();
+
+ SCLContext baseContext = CONTEXT.get();
+ if(baseContext != null) {
+ Object reportingHandler = baseContext.get(SCLReportingHandler.REPORTING_HANDLER);
+ if(reportingHandler != null)
+ newContext.put(SCLReportingHandler.REPORTING_HANDLER, reportingHandler);
+ }
+ return newContext;
+ }
+
public static void pop() {
OldContextNode node = OLD_CONTEXT.get();
if(node == null)