]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics/src/org/simantics/Simantics.java
Add support for dependency changes in SCL
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / Simantics.java
index 9a1a354f17131b35e1fbfd7bfcc0565645b95616..b382fba9151798aa6f414b6b1f65071ebcc21212 100644 (file)
@@ -460,20 +460,30 @@ public class Simantics {
 
 
     @SuppressWarnings({ "unchecked", "rawtypes" })
-       public static <T> T applySCL(String module, String function, ReadGraph graph, Object ... args) throws DatabaseException {
-        SCLContext sclContext = SCLContext.getCurrent();
-           Object oldGraph = sclContext.put("graph", graph);
-               try {
-                       T t = (T)((Function)SCLOsgi.MODULE_REPOSITORY.getValue(module, function)).applyArray(args);
-                       return t;
-               } catch (ValueNotFound e) {
-                       throw new DatabaseException("SCL Value not found: " + e.name);
-               } catch (Throwable t) {
-                       throw new DatabaseException(t);
-               } finally {
-                       sclContext.put("graph", oldGraph);
-               }
+    public static <T> T applySCL(String module, String function, Object ... args) throws DatabaseException {
+        try {
+            T t = (T)((Function)SCLOsgi.MODULE_REPOSITORY.getValue(module, function)).applyArray(args);
+            return t;
+        } catch (ValueNotFound e) {
+            throw new DatabaseException("SCL Value not found: " + e.name);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        }
+    }
 
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public static <T> T applySCL(String module, String function, ReadGraph graph, Object ... args) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            return applySCL(module, function, args);
+        } catch (DatabaseException dbe) {
+            throw dbe;
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
     }
 
     @SuppressWarnings("unchecked")