summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorGrant Gayed2012-01-11 13:36:24 (EST)
committer skaegi2012-01-12 15:08:51 (EST)
commitca8baa01cf15fde5cde3d2cddde42ee6819cba17 (patch)
tree3f65c0b62b5ff8293bb19cb647d302d858480f2a
parent9b27bd8d6f402854f002af01a6550784a00ad027 (diff)
downloadorg.eclipse.orion.client-ca8baa01cf15fde5cde3d2cddde42ee6819cba17.zip
org.eclipse.orion.client-ca8baa01cf15fde5cde3d2cddde42ee6819cba17.tar.gz
org.eclipse.orion.client-ca8baa01cf15fde5cde3d2cddde42ee6819cba17.tar.bz2
initial debug (re-)contribution
-rw-r--r--bundles/org.eclipse.orion.client.debug/.project23
-rw-r--r--bundles/org.eclipse.orion.client.debug/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.orion.client.debug/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.orion.client.debug/about.html29
-rw-r--r--bundles/org.eclipse.orion.client.debug/build.properties16
-rw-r--r--bundles/org.eclipse.orion.client.debug/bundle.properties2
-rw-r--r--bundles/org.eclipse.orion.client.debug/chromeExtension/bin/debugChromeExtension.crxbin0 -> 1414 bytes
-rw-r--r--bundles/org.eclipse.orion.client.debug/chromeExtension/src/debug.js47
-rw-r--r--bundles/org.eclipse.orion.client.debug/chromeExtension/src/manifest.json9
-rw-r--r--bundles/org.eclipse.orion.client.debug/web/debug.css45
-rw-r--r--bundles/org.eclipse.orion.client.debug/web/debug.html55
-rw-r--r--bundles/org.eclipse.orion.client.debug/web/debug.js403
-rw-r--r--bundles/org.eclipse.orion.client.debug/web/debugPlugin.html29
-rw-r--r--bundles/org.eclipse.orion.client.debug/web/debugTree.js101
14 files changed, 771 insertions, 0 deletions
diff --git a/bundles/org.eclipse.orion.client.debug/.project b/bundles/org.eclipse.orion.client.debug/.project
new file mode 100644
index 0000000..40131b8
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.orion.client.git</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.orion.client.debug/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.orion.client.debug/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..6731da7
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Tue Jan 18 14:23:15 CET 2011
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.orion.client.debug/META-INF/MANIFEST.MF b/bundles/org.eclipse.orion.client.debug/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e117a84
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.orion.client.debug
+Bundle-Version: 0.2.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: bundle
diff --git a/bundles/org.eclipse.orion.client.debug/about.html b/bundles/org.eclipse.orion.client.debug/about.html
new file mode 100644
index 0000000..7948686
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/about.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>April 26, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+<a href="http://www.eclipse.org/legal/epl-v10.html">Eclipse Public License Version 1.0</a>
+(&quot;EPL&quot;), and the <a href="http://www.eclipse.org/org/documents/edl-v10.html">
+Eclipse Distribution License Version 1.0</a> (&quot;EDL&quot;).
+For purposes of the EPL and EDL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.orion.client.debug/build.properties b/bundles/org.eclipse.orion.client.debug/build.properties
new file mode 100644
index 0000000..0cbb72c
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2011 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials are made
+# available under the terms of the Eclipse Public License v1.0
+# (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+# License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+#
+# Contributors: IBM Corporation - initial API and implementation
+###############################################################################
+
+bin.includes = META-INF/,\
+ web/,\
+ bundle.properties,\
+ about.html
+src.includes = web/,\
+ about.html
diff --git a/bundles/org.eclipse.orion.client.debug/bundle.properties b/bundles/org.eclipse.orion.client.debug/bundle.properties
new file mode 100644
index 0000000..b101b47
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/bundle.properties
@@ -0,0 +1,2 @@
+Bundle-Vendor = Eclipse.org - Orion
+Bundle-Name = Orion Debug UI (Incubation)
diff --git a/bundles/org.eclipse.orion.client.debug/chromeExtension/bin/debugChromeExtension.crx b/bundles/org.eclipse.orion.client.debug/chromeExtension/bin/debugChromeExtension.crx
new file mode 100644
index 0000000..5ee241e
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/chromeExtension/bin/debugChromeExtension.crx
Binary files differ
diff --git a/bundles/org.eclipse.orion.client.debug/chromeExtension/src/debug.js b/bundles/org.eclipse.orion.client.debug/chromeExtension/src/debug.js
new file mode 100644
index 0000000..a07abfd
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/chromeExtension/src/debug.js
@@ -0,0 +1,47 @@
+/*******************************************************************************
+* @license
+* Copyright (c) 2011 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License v1.0
+* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+* License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+
+var debugMessaging = document.getElementById("orion-debugMessaging");
+if (!debugMessaging) {
+ return;
+}
+
+debugMessaging.addEventListener("DOMNodeInserted", function() {
+ var portLabel = document.getElementById("debug-port");
+ if (!portLabel) {
+ return;
+ }
+ var port = parseInt(portLabel.innerHTML);
+ debugMessaging.removeChild(portLabel);
+ if (port === NaN || !(1000 <= port && port < 65535)) {
+ alert("Invalid port, value must be 1000 - 65535");
+ return;
+ }
+ var url = "http://localhost:" + port + "/json";
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.responseText.length > 0) {
+ var responseLabel = document.createElement('label');
+ responseLabel.setAttribute('id', 'debug-response');
+ responseLabel.style.display = 'none';
+ responseLabel.innerHTML = xhr.responseText;
+ debugMessaging.appendChild(responseLabel);
+ }
+ }
+ }
+ xhr.onerror = function () {
+ alert("XHR error: " + xhr.status);
+ };
+ xhr.open("GET", url, true);
+ xhr.send(null);
+});
diff --git a/bundles/org.eclipse.orion.client.debug/chromeExtension/src/manifest.json b/bundles/org.eclipse.orion.client.debug/chromeExtension/src/manifest.json
new file mode 100644
index 0000000..8348694
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/chromeExtension/src/manifest.json
@@ -0,0 +1,9 @@
+{
+ "name":"Orion Debug Extension for Chrome",
+ "version":"0.1",
+ "content_scripts":[{
+ "matches":["http://*/*", "file://*/*"],
+ "js":["debug.js"]
+ }],
+ "optional-permissions":["http://*/json", "file://*/json"]
+}
diff --git a/bundles/org.eclipse.orion.client.debug/web/debug.css b/bundles/org.eclipse.orion.client.debug/web/debug.css
new file mode 100644
index 0000000..dc13c2b
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/web/debug.css
@@ -0,0 +1,45 @@
+@import "../org.dojotoolkit/dojo/resources/dojo.css";
+@import "../org.dojotoolkit/dijit/themes/nihilo/nihilo.css";
+@import "../org.dojotoolkit/dijit/themes/nihilo/Tree.css";
+@import "../org.dojotoolkit/dijit/themes/nihilo/layout/BorderContainer.css";
+@import "../org.dojotoolkit/dijit/themes/nihilo/form/Common.css";
+@import "../org.dojotoolkit/dijit/themes/nihilo/form/Button.css";
+@import "../css/ide.css";
+@import "../css/commands.css";
+
+html,body {
+ height: 100%;
+}
+
+h1 {
+ position: relative;
+ margin-top: 18px;
+}
+
+.statusPane {
+ font-weight: bold;
+}
+
+.domCommandToolbar {
+ padding-left: 8px;
+}
+
+tr.treeTableRow td:first-child {
+ padding-left: 16px !important;
+}
+
+.treetable th {
+ font-weight: bold;
+}
+
+.treetable td {
+ padding: 16px 0 16px 16px;
+}
+
+.treetable th {
+ padding: 16px 0 0 16px;
+}
+
+.siteConfigDetails {
+ padding-left: 16px;
+}
diff --git a/bundles/org.eclipse.orion.client.debug/web/debug.html b/bundles/org.eclipse.orion.client.debug/web/debug.html
new file mode 100644
index 0000000..6aba351
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/web/debug.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="copyright" content="Copyright (c) IBM Corporation and others 2011." >
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Debug</title>
+ <link rel="stylesheet" type="text/css" href="debug.css" />
+ <script src="../requirejs/require.js"></script>
+ <script src="../../orion/plugin.js"></script>
+ <script src="../../org.dojotoolkit/dojo/dojo.js.uncompressed.js"></script>
+ <script type="text/javascript">
+ require({
+ baseUrl: '..',
+ packages: [
+ {
+ name: 'dojo',
+ location: 'org.dojotoolkit/dojo',
+ main: 'lib/main-browser',
+ lib: '.'
+ },
+ {
+ name: 'dijit',
+ location: 'org.dojotoolkit/dijit',
+ main: 'lib/main',
+ lib: '.'
+ },
+ {
+ name: 'dojox',
+ location: 'org.dojotoolkit/dojox',
+ main: 'lib/main',
+ lib: '.'
+ }
+ ],
+ paths: {
+ text: 'requirejs/text',
+ i18n: 'requirejs/i18n'
+ }
+ });
+ require(["./debug"]);
+ </script>
+</head>
+
+<body style="visibility:hidden;" class="nihilo">
+ <div id="orion-debug" dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%;">
+ <div class="toolbar" id="toolbar" dojotype="dijit.layout.ContentPane" region="top">
+ </div>
+ <div id="orion-debugMainPane" dojotype="dijit.layout.ContentPane" region="center" class="mainpane">
+ <div id="orion-debugMessaging"></div>
+ <div id="debug-table"></div>
+ </div>
+ <div class="footer" id="footer" dojotype="dijit.layout.ContentPane" region="bottom" splitter="false">
+ </div>
+ </div>
+</body>
+</html>
diff --git a/bundles/org.eclipse.orion.client.debug/web/debug.js b/bundles/org.eclipse.orion.client.debug/web/debug.js
new file mode 100644
index 0000000..1ddf664
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/web/debug.js
@@ -0,0 +1,403 @@
+/*******************************************************************************
+* @license
+* Copyright (c) 2011 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License v1.0
+* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+* License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+/*global define dojo dijit orion window widgets*/
+/*jslint browser:true*/
+
+define(['require', 'dojo', 'orion/bootstrap', 'orion/commands', 'orion/fileClient',
+ 'orion/searchClient', 'orion/globalCommands', 'debug/debugTree', 'orion/treetable',
+ 'orion/widgets/NewSiteDialog'],
+ function(require, dojo, mBootstrap, mCommands, mFileClient, mSearchClient, mGlobalCommands, mDebugTree, mTreeTable) {
+
+ var eclipse = {};
+ eclipse.debug = {};
+
+ var model = new mDebugTree.DebugConnectionTreeModel("debug-tableTree");
+ var treeWidget;
+
+ eclipse.debug.RemoteDebugConnection = (function() {
+ eclipse.debug.StatesEnum = {
+ STATE_DISCONNECTED: "Disconnected",
+ STATE_CONNECTED: "Connected",
+ STATE_ENABLED: "Debugging",
+ STATE_SUSPENDING: "Suspending...",
+ STATE_RESUMING: "Resuming...",
+ STATE_SUSPENDED: "Suspended"
+ };
+
+ function RemoteDebugConnection(info) {
+ this._nextId = 1;
+ this._state = eclipse.debug.StatesEnum.STATE_DISCONNECTED;
+ this._wsUrl = info.webSocketDebuggerUrl;
+ this._url = info.url;
+ this._pendingResponses = [];
+ this._socket = new WebSocket(info.webSocketDebuggerUrl);
+ var self = this;
+ this._socket.onmessage = function(evt) {
+ self._handleMessage(evt.data);
+ };
+ this._socket.onclose = function(evt) {
+ self._state = eclipse.debug.StatesEnum.STATE_DISCONNECTED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ });
+ };
+ this._socket.onopen = function(evt) {
+ self._state = eclipse.debug.StatesEnum.STATE_CONNECTED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ });
+ };
+ }
+ RemoteDebugConnection.prototype = /** @lends eclipse.debug.RemoteDebugConnection.prototype */{
+ disable: function() {
+ if (this._state !== eclipse.debug.StatesEnum.STATE_ENABLED && this._state !== eclipse.debug.StatesEnum.STATE_SUSPENDED) {
+ return false;
+ }
+ var request = {
+ id: this._nextId++,
+ method: "Debugger.disable",
+ params: {}
+ };
+ var requestString = JSON.stringify(request);
+ var result = this._socket.send(requestString);
+ if (result) {
+ var self = this;
+ this._pendingResponses.push({
+ id: request.id,
+ action: function(event) {
+ self._state = eclipse.debug.StatesEnum.STATE_CONNECTED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ }
+ });
+ }
+ return result;
+ },
+ enable: function() {
+ if (this._state !== eclipse.debug.StatesEnum.STATE_CONNECTED) {
+ return false;
+ }
+ var request = {
+ id: this._nextId++,
+ method: "Debugger.enable",
+ params: {}
+ };
+ var requestString = JSON.stringify(request);
+ var result = this._socket.send(requestString);
+ if (result) {
+ var self = this;
+ this._pendingResponses.push({
+ id: request.id,
+ action: function(event) {
+ self._state = eclipse.debug.StatesEnum.STATE_ENABLED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ }
+ });
+ }
+ return result;
+ },
+ evaluate: function(expression) {
+ if (this._state !== eclipse.debug.StatesEnum.STATE_SUSPENDED &&
+ this._state !== eclipse.debug.StatesEnum.STATE_ENABLED) {
+ return false;
+ }
+ var request;
+ if (this._frameId) {
+ request = {
+ id: this._nextId++,
+ method: "Debugger.evaluateOnCallFrame",
+ params: {
+ callFrameId: this._frameId,
+ expression: expression
+ }
+ };
+ } else {
+ request = {
+ id: this._nextId++,
+ method: "Runtime.evaluate",
+ params: {
+ expression: expression
+ }
+ };
+ }
+
+ var requestString = JSON.stringify(request);
+ var result = this._socket.send(requestString);
+ if (result) {
+ this._pendingResponses.push({
+ id: request.id,
+ action: function(event) {
+ alert("Evaluation Result: " + JSON.stringify(event.result.result));
+ }
+ });
+ }
+ return result;
+ },
+ getState: function() {
+ return this._state;
+ },
+ getUrl: function() {
+ return this._url;
+ },
+ resume: function() {
+ if (this._state !== eclipse.debug.StatesEnum.STATE_SUSPENDED) {
+ return false;
+ }
+ var request = {
+ id: this._nextId++,
+ method: "Debugger.resume",
+ params: {}
+ };
+ var requestString = JSON.stringify(request);
+ var result = this._socket.send(requestString);
+ if (result) {
+ var self = this;
+ this._pendingResponses.push({
+ id: request.id,
+ action: function(event) {
+ self._state = eclipse.debug.StatesEnum.STATE_RESUMING;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ }
+ });
+ }
+ return result;
+ },
+ suspend: function() {
+ if (this._state !== eclipse.debug.StatesEnum.STATE_ENABLED) {
+ return false;
+ }
+ var request = {
+ id: this._nextId++,
+ method: "Debugger.pause",
+ params: {}
+ };
+ var requestString = JSON.stringify(request);
+ var result = this._socket.send(requestString);
+ if (result) {
+ var self = this;
+ this._pendingResponses.push({
+ id: request.id,
+ action: function(event) {
+ self._state = eclipse.debug.StatesEnum.STATE_SUSPENDING;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ }
+ });
+ }
+ return result;
+ },
+
+ _handleMessage: function(wsMessage) {
+ var event = JSON.parse(wsMessage);
+ var method = event.method;
+ if (method === "Debugger.paused") {
+ this._frameId = event.params.callFrames[0].callFrameId;
+ this._state = eclipse.debug.StatesEnum.STATE_SUSPENDED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ } else if (method === "Debugger.resumed") {
+ this._frameId = null;
+ this._state = eclipse.debug.StatesEnum.STATE_ENABLED;
+ model.getRoot(
+ function(root) {
+ treeWidget.refreshAndExpand("debug-tableTree", root);
+ }
+ );
+ } else if (!method) {
+ for (var i = 0; i < this._pendingResponses.length; i++) {
+ var current = this._pendingResponses[i];
+ if (current.id === event.id) {
+ current.action(event);
+ this._pendingResponses.splice(i, 1);
+ break;
+ }
+ }
+ }
+ }
+ };
+ return RemoteDebugConnection;
+ }());
+
+ dojo.addOnLoad(function() {
+ mBootstrap.startup().then(function(core) {
+ var serviceRegistry = core.serviceRegistry;
+ var preferences = core.preferences;
+ document.body.style.visibility = "visible";
+ dojo.parser.parse();
+
+ var commandService = new mCommands.CommandService({serviceRegistry: serviceRegistry});
+ var fileClient = new mFileClient.FileClient(serviceRegistry);
+ var searcher = new mSearchClient.Searcher({serviceRegistry: serviceRegistry, commandService: commandService, fileService: fileClient});
+ mGlobalCommands.generateBanner("toolbar", serviceRegistry, commandService, preferences, searcher);
+
+ var renderer = new mDebugTree.DebugConnectionRenderer(commandService);
+ treeWidget = new mTreeTable.TableTree({
+ id: "debug-tableTree",
+ parent: dojo.byId("debug-table"),
+ model: model,
+ showRoot: false,
+ renderer: renderer
+ });
+
+ var connectCommand = new mCommands.Command({
+ name: "Connect",
+ tooltip: "Connect to a new browser",
+ image: require.toUrl("images/add.gif"),
+ id: "eclipse.debug.connect",
+ groupId: "eclipse.debugGroup",
+ visibleWhen: function(item) {
+ return true;
+ },
+ callback: function() {
+ var dialog = new orion.widgets.NewSiteDialog({
+ title: "Enter browser debug port",
+ serviceRegistry: serviceRegistry,
+ func: function(name, workspace) {
+ var label = dojo.create("label", {id: "debug-port"});
+ label.style.display = "none";
+ label.innerHTML = name;
+ dojo.place(label, "orion-debugMessaging", "first");
+ }
+ });
+ dialog.startup();
+ dialog.show();
+ }
+ });
+ commandService.addCommand(connectCommand, "dom");
+
+ var enableCommand = new mCommands.Command({
+ name: "Enable",
+ tooltip: "Enable the debugger in the target",
+ imageClass: "core-sprite-add",
+ id: "eclipse.debug.enable",
+ visibleWhen: function(item) {
+ return item.getState() === eclipse.debug.StatesEnum.STATE_CONNECTED;
+ },
+ callback: function(item, cmdId, imageId, userData) {
+ item.enable();
+ }
+ });
+ commandService.addCommand(enableCommand, "object");
+
+ var disableCommand = new mCommands.Command({
+ name: "Disable",
+ tooltip: "Disable the debugger in the target",
+ imageClass: "core-sprite-problem",
+ id: "eclipse.debug.disable",
+ visibleWhen: function(item) {
+ return item.getState() !== eclipse.debug.StatesEnum.STATE_DISCONNECTED &&
+ item.getState() !== eclipse.debug.StatesEnum.STATE_CONNECTED;
+ },
+ callback: function(item, cmdId, imageId, userData) {
+ item.disable();
+ }
+ });
+ commandService.addCommand(disableCommand, "object");
+
+ var suspendCommand = new mCommands.Command({
+ name: "Suspend",
+ tooltip: "Suspend execution in the target",
+ imageClass: "core-sprite-leftarrow",
+ id: "eclipse.debug.suspend",
+ visibleWhen: function(item) {
+ return item.getState() === eclipse.debug.StatesEnum.STATE_ENABLED;
+ },
+ callback: function(item, cmdId, imageId, userData) {
+ item.suspend();
+ }
+ });
+ commandService.addCommand(suspendCommand, "object");
+
+ var evaluateCommand = new mCommands.Command({
+ name: "Evaluate",
+ tooltip: "Evaluate a JS expression in the target",
+ imageClass: "core-sprite-rename",
+ id: "eclipse.debug.evaluate",
+ visibleWhen: function(item) {
+ return item.getState() === eclipse.debug.StatesEnum.STATE_SUSPENDED ||
+ item.getState() === eclipse.debug.StatesEnum.STATE_ENABLED;
+ },
+ callback: function(item, cmdId, imageId, userData) {
+ var dialog = new orion.widgets.NewSiteDialog({
+ title: "Enter the JS Expression to Evaluate",
+ serviceRegistry: serviceRegistry,
+ func: function(name, workspace) {
+ item.evaluate(name);
+ }
+ });
+ dialog.startup();
+ dialog.show();
+ }
+ });
+ commandService.addCommand(evaluateCommand, "object");
+
+ var resumeCommand = new mCommands.Command({
+ name: "Resume",
+ tooltip: "Resume execution in the target",
+ imageClass: "core-sprite-rightarrow",
+ id: "eclipse.debug.resume",
+ visibleWhen: function(item) {
+ return item.getState() === eclipse.debug.StatesEnum.STATE_SUSPENDED;
+ },
+ callback: function(item, cmdId, imageId, userData) {
+ item.resume();
+ }
+ });
+ commandService.addCommand(resumeCommand, "object");
+
+ commandService.registerCommandContribution("eclipse.debug.connect", 1, "pageActions");
+ commandService.registerCommandContribution("eclipse.debug.enable", 1, "connectionActions");
+ commandService.registerCommandContribution("eclipse.debug.disable", 2, "connectionActions");
+ commandService.registerCommandContribution("eclipse.debug.suspend", 3, "connectionActions");
+ commandService.registerCommandContribution("eclipse.debug.evaluate", 4, "connectionActions");
+ commandService.registerCommandContribution("eclipse.debug.resume", 5, "connectionActions");
+ mGlobalCommands.generateDomCommandsInBanner(commandService, {});
+
+ var debugMessaging = dojo.byId("orion-debugMessaging");
+ if (debugMessaging) {
+ debugMessaging.addEventListener("DOMNodeInserted", function() {
+ var responseLabel = dojo.byId("debug-response");
+ if (!responseLabel) {
+ return;
+ }
+ var info = JSON.parse(responseLabel.innerHTML);
+ var connections = [];
+ for (var i = 0; i < info.length; i++) {
+ var connection = new eclipse.debug.RemoteDebugConnection(info[i]);
+ connections.push(connection);
+ }
+ model.setRoot(connections);
+ treeWidget.refreshAndExpand("debug-tableTree", connections);
+ });
+ }
+ });
+ });
+});
diff --git a/bundles/org.eclipse.orion.client.debug/web/debugPlugin.html b/bundles/org.eclipse.orion.client.debug/web/debugPlugin.html
new file mode 100644
index 0000000..3eeb6f1
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/web/debugPlugin.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="copyright" content="Copyright (c) IBM Corporation and others 2011." >
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <script src="../../orion/plugin.js"></script>
+ <script src="../../org.dojotoolkit/dojo/dojo.js.uncompressed.js"></script>
+ <script>
+ var serviceImpl = {
+ run: function(text) {}
+ };
+ window.onload = function() {
+ var provider = new PluginProvider();
+ provider.registerServiceProvider(
+ "orion.page.link",
+ serviceImpl,
+ {
+ name: "Debug",
+ id: "orion.debug",
+ href: "/debug/debug.html"
+ }
+ );
+ provider.connect();
+ };
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/bundles/org.eclipse.orion.client.debug/web/debugTree.js b/bundles/org.eclipse.orion.client.debug/web/debugTree.js
new file mode 100644
index 0000000..37681dd
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.debug/web/debugTree.js
@@ -0,0 +1,101 @@
+/*******************************************************************************
+* @license
+* Copyright (c) 2011 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License v1.0
+* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+* License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+*
+* Contributors: IBM Corporation - initial API and implementation
+******************************************************************************/
+
+/*global dojo eclipse:true */
+/*jslint browser:true devel:true*/
+
+define(['dojo'], function(dojo) {
+
+ var eclipse = {};
+ eclipse.debug = {};
+
+ eclipse.debug.DebugConnectionTreeModel = (function() {
+ function DebugConnectionTreeModel(/**String*/ id) {
+ this._id = id;
+ this._root = [];
+ }
+ DebugConnectionTreeModel.prototype = /** @lends eclipse.debug.DebugConnectionTreeModel.prototype */{
+ getRoot: function(/**function*/ onItem) {
+ onItem(this._root);
+ },
+ getChildren: function(/**dojo.data.Item*/ parentItem, /**Function(items)*/ onComplete) {
+ onComplete(parentItem === this._root ? this._root : []);
+ },
+ getId: function(/**dojo.data.Item|String*/ item) {
+ return (item === this._root || item === this._id) ? this._id : item.Id;
+ },
+ setRoot: function(/**Array*/ value) {
+ this._root = value;
+ }
+ };
+ return DebugConnectionTreeModel;
+ }());
+
+ eclipse.debug.DebugConnectionRenderer = (function() {
+ function DebugConnectionRenderer(commandService) {
+ this._commandService = commandService;
+ }
+ DebugConnectionRenderer.prototype = /** @lends eclipse.debug.DebugConnectionRenderer.prototype */{
+ initTable: function (tableNode, tableTree) {
+ this.tableTree = tableTree;
+ dojo.addClass(tableNode, "treetable");
+ var header = dojo.create("thead", null);
+ dojo.create("th", {innerHTML: "URL"}, header, "last");
+ dojo.create("th", {innerHTML: "Status"}, header, "last");
+ dojo.create("th", {innerHTML: "Actions"}, header, "last");
+ tableNode.appendChild(header);
+ },
+ render: function(item, tableRow) {
+ dojo.style(tableRow, "verticalAlign", "baseline");
+ dojo.addClass(tableRow, "treeTableRow");
+ var urlCol = dojo.create("td", {id: tableRow.id + "col1"});
+ var stateCol = dojo.create("td", {id: tableRow.id + "col2"});
+ var actionCol = dojo.create("td", {id: tableRow.id + "col3"});
+
+ dojo.place(document.createTextNode(item.getUrl()), urlCol, "last");
+ dojo.place(document.createTextNode(item.getState()), stateCol, "last");
+
+ /* Action column */
+ var actionsWrapper = dojo.create(
+ "span",
+ {id: tableRow.id + "actionswrapper", style: {visibility: "hidden"}},
+ actionCol,
+ "only");
+ dojo.connect(tableRow, "onmouseover", tableRow, function() {
+ dojo.style(actionsWrapper, "visibility", "visible");
+ });
+ dojo.connect(tableRow, "onmouseout", tableRow, function() {
+ dojo.style(actionsWrapper, "visibility", "hidden");
+ });
+ this._commandService.renderCommands(actionsWrapper, "object", item, {}, "image");
+
+ dojo.place(urlCol, tableRow, "last");
+ dojo.place(stateCol, tableRow, "last");
+ dojo.place(actionCol, tableRow, "last");
+ },
+ rowsChanged: function() {
+ dojo.query(".treeTableRow").forEach(function(node, i) {
+ if (i % 2) {
+ dojo.addClass(node, "darkTreeTableRow");
+ dojo.removeClass(node, "lightTreeTableRow");
+ } else {
+ dojo.addClass(node, "lightTreeTableRow");
+ dojo.removeClass(node, "darkTreeTableRow");
+ }
+ });
+ },
+ labelColumnIndex: 0
+ };
+ return DebugConnectionRenderer;
+ }());
+
+ return eclipse.debug;
+});