]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/SCL.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.debug.browser / src / org / simantics / debug / browser / internal / SCL.java
diff --git a/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/SCL.java b/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/SCL.java
new file mode 100644 (file)
index 0000000..8c529b0
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************\r
+ * Copyright (c) 2016 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     THTH ry - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.debug.browser.internal;\r
+\r
+import java.net.URL;\r
+\r
+import org.simantics.scl.runtime.reporting.SCLReporting;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen / Semantum Oy\r
+ */\r
+public class SCL {\r
+\r
+    public static void startDebugServer() throws Exception {\r
+        Activator activator = Activator.getDefault();\r
+        DebugBrowserServer server = activator.getDebugServer();\r
+        if (server == null) {\r
+            server = activator.startDebugServer();\r
+            SCLReporting.print("Started debug server at " + server.getURL());\r
+        } else {\r
+            SCLReporting.print("Debug server is already running at " + server.getURL());\r
+        }\r
+    }\r
+\r
+    public static void stopDebugServer() throws Exception {\r
+        Activator activator = Activator.getDefault();\r
+        DebugBrowserServer server = activator.getDebugServer();\r
+        if (server != null) {\r
+            URL url = server.getURL();\r
+            activator.stopDebugServer();\r
+            SCLReporting.print("Stopped debug server that was running at " + url);\r
+        } else {\r
+            SCLReporting.print("Debug server is not running.");\r
+        }\r
+    }\r
+\r
+}\r