Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2015-09-28 13:40:44 +0000
committerJonah Graham2015-10-13 12:26:16 +0000
commitb7372b3688f64bc5f6ad9001c77932aa98104953 (patch)
tree8d13d11ecd107ba83c150d1ea40018a7d8021213
parent1f7278e9e811b11f7aaae8b511af5bf4eeca23bb (diff)
downloadorg.eclipse.ease.scripts-b7372b3688f64bc5f6ad9001c77932aa98104953.tar.gz
org.eclipse.ease.scripts-b7372b3688f64bc5f6ad9001c77932aa98104953.tar.xz
org.eclipse.ease.scripts-b7372b3688f64bc5f6ad9001c77932aa98104953.zip
Bug 478397: Examples for a module for Eclipse Debug Launch
Change-Id: I7395e7211d156753cba57a924c699b8be2e257ab Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
-rw-r--r--JavaScript Snippets/Launch Module Examples/01 simple launch.js17
-rw-r--r--JavaScript Snippets/Launch Module Examples/02 launch group.js30
-rw-r--r--JavaScript Snippets/Launch Module Examples/03 terminate server when client terminates.js40
-rw-r--r--JavaScript Snippets/Launch Module Examples/README.md18
4 files changed, 105 insertions, 0 deletions
diff --git a/JavaScript Snippets/Launch Module Examples/01 simple launch.js b/JavaScript Snippets/Launch Module Examples/01 simple launch.js
new file mode 100644
index 0000000..62e2c1e
--- /dev/null
+++ b/JavaScript Snippets/Launch Module Examples/01 simple launch.js
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jonah Graham and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Jonah Graham - initial API and implementation
+ *
+ * name : Launch Module Example 1
+ * description : In this first example, we simply launch the Client in Debug mode.
+ ******************************************************************************/
+
+// load the Launch module, this populates the namespace with all the methods defined in the Launch module.
+loadModule("/System/Launch")
+
+// launch the existing launch configuration “Client” in debug mode.
+launch("Client", "debug")
diff --git a/JavaScript Snippets/Launch Module Examples/02 launch group.js b/JavaScript Snippets/Launch Module Examples/02 launch group.js
new file mode 100644
index 0000000..62e5e66
--- /dev/null
+++ b/JavaScript Snippets/Launch Module Examples/02 launch group.js
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jonah Graham and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Jonah Graham - initial API and implementation
+ *
+ * name : Launch Module Example 2
+ * description : In this example, we prepare our environment with the Prepare”
+ * configuration, then launch the “Server” and “Client” configurations.
+ ******************************************************************************/
+
+// load the Launch module
+loadModule("/System/Launch")
+
+// launch the Prepare configuration
+prepare = launch("Prepare")
+// Busy-wait until the Prepare launch has terminated
+while (!prepare.isTerminated()) {
+ java.lang.Thread.sleep(1)
+}
+
+// launch the server
+launch("Server")
+// Wait 3 seconds for the server to be ready
+java.lang.Thread.sleep(3000)
+
+// launch the client in Debug mode
+launch("Client", "debug")
diff --git a/JavaScript Snippets/Launch Module Examples/03 terminate server when client terminates.js b/JavaScript Snippets/Launch Module Examples/03 terminate server when client terminates.js
new file mode 100644
index 0000000..06bdd78
--- /dev/null
+++ b/JavaScript Snippets/Launch Module Examples/03 terminate server when client terminates.js
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jonah Graham and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Jonah Graham - initial API and implementation
+ *
+ * name : Launch Module Example 3
+ * description : Example 1 and 2 are a promising start, but do not
+ * yet add any new functionality to Eclipse. So what
+ * do you do if you want the server to stop automatically
+ * when you finish debugging your client. Well that is
+ * really easy now, just monitor the client launch and
+ * terminate the server.
+ ******************************************************************************/
+
+// load the Launch module
+loadModule("/System/Launch")
+
+// launch the Prepare configuration
+prepare = launch("Prepare")
+// Busy-wait until the Prepare launch has terminated
+while (!prepare.isTerminated()) {
+ java.lang.Thread.sleep(1)
+}
+
+// launch the Server, but keep a handle of the ILaunch
+server = launch("Server")
+// Wait 3 seconds for the server to be ready
+java.lang.Thread.sleep(3000)
+
+// launch the Client
+client = launch("Client", "debug")
+// Busy-wait until the Client debug session launch has terminated
+while (!client.isTerminated()) {
+ java.lang.Thread.sleep(1)
+}
+// terminate the server
+server.terminate()
diff --git a/JavaScript Snippets/Launch Module Examples/README.md b/JavaScript Snippets/Launch Module Examples/README.md
new file mode 100644
index 0000000..222feb4
--- /dev/null
+++ b/JavaScript Snippets/Launch Module Examples/README.md
@@ -0,0 +1,18 @@
+# The Launch Module Examples
+
+For these examples you need to create three launch configurations for your tools tools
+(the name of the launch configuration is the quoted string in the list):
+
+* “Prepare” – An External Tools configuration which prepares my test environment
+* “Server” – A PyDev supplied, Python Run configuration to launch my Python server
+* “Client” – A Java configuration to launch my Java client
+
+## Running The Examples
+
+1. Create three launch configurations named as above
+2. Right-click on the desired script (e.g. 01 simple launch.js)
+3. Choose Run As –> EASE Script
+
+Alternatively paste the lines from the examples into the Rhino Script Shell
+console. You get auto-completion of the names of the launch configurations
+and the launch modes too! \ No newline at end of file

Back to the top