]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2016 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     THTH ry - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.debug.browser.internal;\r
13 \r
14 import java.net.URL;\r
15 \r
16 import org.simantics.scl.runtime.reporting.SCLReporting;\r
17 \r
18 /**\r
19  * @author Tuukka Lehtonen / Semantum Oy\r
20  */\r
21 public class SCL {\r
22 \r
23     public static void startDebugServer() throws Exception {\r
24         Activator activator = Activator.getDefault();\r
25         DebugBrowserServer server = activator.getDebugServer();\r
26         if (server == null) {\r
27             server = activator.startDebugServer();\r
28             SCLReporting.print("Started debug server at " + server.getURL());\r
29         } else {\r
30             SCLReporting.print("Debug server is already running at " + server.getURL());\r
31         }\r
32     }\r
33 \r
34     public static void stopDebugServer() throws Exception {\r
35         Activator activator = Activator.getDefault();\r
36         DebugBrowserServer server = activator.getDebugServer();\r
37         if (server != null) {\r
38             URL url = server.getURL();\r
39             activator.stopDebugServer();\r
40             SCLReporting.print("Stopped debug server that was running at " + url);\r
41         } else {\r
42             SCLReporting.print("Debug server is not running.");\r
43         }\r
44     }\r
45 \r
46 }\r