]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Introduce DebuggerCanvasProxy to avoid compile time AWT toolkit init 11/4411/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 31 Aug 2020 11:06:16 +0000 (14:06 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 31 Aug 2020 11:14:44 +0000 (11:14 +0000)
gitlab #593

Change-Id: Ie625f8bc7becbce47f7d035ba6f73eec0ba5566c

bundles/org.simantics.debug.graphical/scl/Simantics/GraphicalDebugger.scl
bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java [new file with mode: 0644]
bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/GraphicalDebugger.java

index 7a23274c4028d377c5a216d7e01a55bb8fca54d4..0542beb1dad91186e0b646997d3e2a7e9ba4d6c6 100644 (file)
@@ -1,6 +1,6 @@
 import "Simantics/DB"
 
-importJava "org.simantics.debug.graphical.DebuggerCanvas" where
+importJava "org.simantics.debug.graphical.DebuggerCanvasProxy" where
     data GraphDebugger
 
     setStatementFilter :: GraphDebugger -> (Statement -> <ReadGraph,Proc> Boolean) -> <Proc> ()
diff --git a/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java b/bundles/org.simantics.debug.graphical/src/org/simantics/debug/graphical/DebuggerCanvasProxy.java
new file mode 100644 (file)
index 0000000..bf7a738
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.debug.graphical;
+
+import org.simantics.db.Resource;
+import org.simantics.scl.runtime.function.Function;
+
+/**
+ * <code>Simantics/GraphicalDebugger</code> SCL API to avoid undesired AWT
+ * toolkit initialization.
+ * 
+ * @author Tuukka Lehtonen
+ */
+public class DebuggerCanvasProxy {
+
+    DebuggerCanvas canvas;
+
+    public void setStatementFilter(@SuppressWarnings("rawtypes") Function statementFilter) {
+        canvas.setStatementFilter(statementFilter);
+    }
+
+    public void removeStatementFilter() {
+        canvas.removeStatementFilter();
+    }
+
+    public void addResource(Resource resource) {
+        canvas.addResource(resource);
+    }
+
+    public DebuggerCanvasProxy(DebuggerCanvas canvas) {
+        this.canvas = canvas;
+    }
+
+}
index 9091a27f98d6367d340b1927e111ee393a93703c..81844e4aeb82f4310b4409eef9591ffad012b4a9 100644 (file)
@@ -11,7 +11,7 @@ import javax.swing.JFrame;
 
 public class GraphicalDebugger {
 
-    public static DebuggerCanvas newGraphDebugger() {
+    public static DebuggerCanvasProxy newGraphDebugger() {
         final JFrame frame = new JFrame();
         frame.setTitle("Graph debugger");
         Toolkit tk = Toolkit.getDefaultToolkit();
@@ -53,7 +53,7 @@ public class GraphicalDebugger {
         });        
         frame.setVisible(true);
         
-        return canvas;
+        return new DebuggerCanvasProxy(canvas);
     }
     
 }