diff --git a/client/ext/console/console.js b/client/ext/console/console.js index 1f10082f93c..860a38910fa 100644 --- a/client/ext/console/console.js +++ b/client/ext/console/console.js @@ -37,7 +37,7 @@ return ext.register("ext/console/console", { for (var i=0; i" + lines[i] .replace(/\s/g, " ") .replace(/(((http:\/\/)|(www\.))[\w\d\.]*(:\d+)?(\/[\w\d]+)?)/, function(m, url) { @@ -55,7 +55,7 @@ return ext.register("ext/console/console", { } txtConsole.addValue(log.join("")); }, - + log : function(msg, type, pre, post){ msg = apf.htmlentities(String(msg)); /* @@ -63,17 +63,17 @@ return ext.register("ext/console/console", { .replace(/\t/g, "   ") .replace(/") */ - - if (!type) + + if (!type) type = "log"; else if (type == "command") { msg = ">>>
" + msg + "
"; } - + txtConsole.addValue("
" + (pre || "") + msg + (post || "") + "
"); }, - + evaluate : function(expression, callback){ var _self = this; var frame = dgStack && dgStack.selected && dgStack.selected.getAttribute("ref") || null; @@ -81,13 +81,13 @@ return ext.register("ext/console/console", { _self.showObject(xmlNode); }); }, - + checkChange : function(xmlNode){ var value = xmlNode.getAttribute("value"); if (xmlNode.tagName == "method" || "Boolean|String|undefined|null|Number".indexOf(xmlNode.getAttribute("type")) == -1) return false; }, - + applyChange : function(xmlNode){ var value = xmlNode.getAttribute("value"); var name = this.calcName(xmlNode); @@ -99,9 +99,9 @@ return ext.register("ext/console/console", { return; } } - + self.parent.eval(name + " = " + value); - + //@todo determine new type } catch(e) { @@ -110,15 +110,15 @@ return ext.register("ext/console/console", { //@todo undo } }, - + calcName : function(xmlNode, useDisplay){ var isMethod = xmlNode.tagName == "method"; var name, loopNode = xmlNode, path = []; do { - name = useDisplay - ? loopNode.getAttribute("display") || loopNode.getAttribute("name") + name = useDisplay + ? loopNode.getAttribute("display") || loopNode.getAttribute("name") : loopNode.getAttribute("name"); - + if (!name) break; @@ -134,12 +134,12 @@ return ext.register("ext/console/console", { } } while (loopNode && loopNode.nodeType == 1); - + if (path[0].charAt(0) == "[") path[0] = path[0].substr(2, path[0].length - 4); return path.join(".").replace(/\.\[/g, "["); }, - + consoleTextHandler: function(e) { if (e.keyCode == 9 && e.currentTarget == txtConsole) { txtConsole.focus(); @@ -149,9 +149,9 @@ return ext.register("ext/console/console", { else if(e.keyCode == 13 && e.ctrlKey) { var _self = this; var expression = txtCode.value; - if (!expression.trim()) + if (!expression.trim()) return; - + this.log(expression, "command"); this.evaluate(expression, function(xmlNode, body, refs, error){ if (error) @@ -159,9 +159,9 @@ return ext.register("ext/console/console", { else { var type = body.type, value = body.value || body.text, ref = body.handle, className = body.className; if (className == "Function") { - var pre = ""; var post = ""; var name = body.name || body.inferredName || "function"; @@ -169,11 +169,11 @@ return ext.register("ext/console/console", { } else if (className == "Array") { var pre = ""; var post = " }"; - - _self.log("Array { length: " + + _self.log("Array { length: " + (body.properties && body.properties.length - 1), "log", pre, post); } else if (type == "object") { @@ -181,9 +181,9 @@ return ext.register("ext/console/console", { for (var i = 0, l = body.properties.length; i < l; i++) { refs.push(props[i].ref); } - + var pre = ""; var post = " }"; @@ -210,31 +210,22 @@ return ext.register("ext/console/console", { _self.log(value, "log"); } }); - + require("ext/settings/settings").save(); return false; } }, - + showObject : function(xmlNode, ref, expression){ if (ref && ref.dataType == apf.ARRAY) { - require("ext/debugger/debugger").$showFile(ref[0]); - ide.addEventListener("openfile", function(e){ - if (e.node.getAttribute("scriptid") == ref[0]) { - ceEditor.$editor.gotoLine(ref[1] + 1); - if (ref[4]) - ceEditor.$editor.find(ref[4]); - ceEditor.focus(); - ide.removeEventListener("openfile", arguments.callee); - } - }); + require("ext/debugger/debugger").$showFile(ref[0], ref[1] + 1, ref[4]); } else { tabConsole.set(1); - + if (xmlNode && typeof xmlNode == "string") xmlNode = apf.getXml(xmlNode); - + var name = xmlNode && xmlNode.getAttribute("name") || expression; txtCurObject.setValue(name); dgWatch.clear("loading"); @@ -249,27 +240,27 @@ return ext.register("ext/console/console", { }, 10); } else if (ref) { - + } else { this.evaluate(expression); } } }, - + types : ["Object", "Number", "Boolean", "String", "Array", "Date", "RegExp", "Function", "Object"], - domtypes : [null, "Element", "Attr", "Text", "CDataSection", - "EntityReference", "Entity", "ProcessingInstruction", "Comment", + domtypes : [null, "Element", "Attr", "Text", "CDataSection", + "EntityReference", "Entity", "ProcessingInstruction", "Comment", "Document", "DocumentType", "DocumentFragment", "Notation"], - + calcName : function(xmlNode, useDisplay){ var isMethod = xmlNode.tagName == "method"; var name, loopNode = xmlNode, path = []; do { - name = useDisplay - ? loopNode.getAttribute("display") || loopNode.getAttribute("name") + name = useDisplay + ? loopNode.getAttribute("display") || loopNode.getAttribute("name") : loopNode.getAttribute("name"); - + if (!name) break; @@ -285,12 +276,12 @@ return ext.register("ext/console/console", { } } while (loopNode && loopNode.nodeType == 1); - + if (path[0].charAt(0) == "[") path[0] = path[0].substr(2, path[0].length - 4); return path.join(".").replace(/\.\[/g, "["); }, - + /**** Init ****/ hook : function(){ @@ -299,11 +290,11 @@ return ext.register("ext/console/console", { init : function(amlNode){ this.panel = winDbgConsole; - + lstScripts.addEventListener("afterselect", function(e) { e.selected && require("ext/debugger/debugger").$showFile(e.selected.getAttribute("scriptid")); }); - + apf.importCssString(".console_date{display:inline}"); }, diff --git a/client/ext/debugger/debugger.js b/client/ext/debugger/debugger.js index d9740ccf217..1b183545800 100644 --- a/client/ext/debugger/debugger.js +++ b/client/ext/debugger/debugger.js @@ -33,14 +33,14 @@ return ext.register("ext/debugger/debugger", { init : function(amlNode){ this.rightPane = ide.vbMain.selectSingleNode("a:hbox/a:vbox[3]"); this.nodes.push( - //Append the debug toolbar to the main toolbar - //winDbgConsole.insertBefore(tbDebug, winDbgConsole.firstChild), - //Append the stack window at the right this.rightPane.appendChild(winDbgStack), //Append the variable window on the right - this.rightPane.appendChild(winDbgVariables) + this.rightPane.appendChild(winDbgVariables), + + //Append the variable window on the right + this.rightPane.appendChild(winDbgBreakpoints) ); this.paths = {}; @@ -65,11 +65,32 @@ return ext.register("ext/debugger/debugger", { e.data && _self.$showFile(e.data.getAttribute("scriptid")); }); + lstBreakpoints.addEventListener("afterselect", function(e) { + if (e.selected && e.selected.getAttribute("scriptid")) + _self.$showFile(e.selected.getAttribute("scriptid"), e.selected.getAttribute("line")); + // TODO sometimes we don't have a scriptID + }); + log.enable(true); }, - $showFile : function(scriptId) { + $showFile : function(scriptId, line, text) { var file = fs.model.queryNode("//file[@scriptid='" + scriptId + "']"); + + if (line !== undefined) { + ide.addEventListener("afteropenfile", function(e) { + if (e.node.getAttribute("scriptid") == scriptId) { + ide.removeEventListener("afteropenfile", arguments.callee); + setTimeout(function() { + ceEditor.$editor.gotoLine(line); + if (text) + ceEditor.$editor.find(text); + ceEditor.focus(); + }, 30); + } + }); + } + if (file) { ide.dispatchEvent("openfile", { node: file diff --git a/client/ext/debugger/debugger.xml b/client/ext/debugger/debugger.xml index bc476dc1221..6b8694d8946 100644 --- a/client/ext/debugger/debugger.xml +++ b/client/ext/debugger/debugger.xml @@ -41,15 +41,15 @@ - + \ No newline at end of file diff --git a/client/ext/filesystem/filesystem.js b/client/ext/filesystem/filesystem.js index d6bc288fffd..2388e7fea80 100644 --- a/client/ext/filesystem/filesystem.js +++ b/client/ext/filesystem/filesystem.js @@ -166,8 +166,10 @@ return ext.register("ext/filesystem/filesystem", { ide.addEventListener("openfile", function(e){ var node = e.node; - if (node.selectSingleNode("data")) + if (node.selectSingleNode("data")) { + ide.dispatchEvent("afteropenfile", {node: node}); return; + } var path = node.getAttribute("path"); fs.readFile(path, function(data, state, extra) { @@ -192,6 +194,8 @@ return ext.register("ext/filesystem/filesystem", { xml.appendChild(doc.createTextNode(data)); xml.setAttribute("newline", nl); apf.b(node).append(xml); + + ide.dispatchEvent("afteropenfile", {node: node}); } }); }); diff --git a/common/ace b/common/ace index a96c5469ab8..b646c0d1b79 160000 --- a/common/ace +++ b/common/ace @@ -1 +1 @@ -Subproject commit a96c5469ab8f2bcc2a3ab12445cbb4c36dccf6a0 +Subproject commit b646c0d1b79cfdf2f4de439703f6904c95382ea6 diff --git a/server/lib/cloud9/index.js b/server/lib/cloud9/index.js index b6b7c45a657..01a8c9a23ef 100644 --- a/server/lib/cloud9/index.js +++ b/server/lib/cloud9/index.js @@ -23,7 +23,7 @@ exports.main = function(projectDir, port) { server = connect.createServer( //connect.logger(), connect.conditionalGet(), - connect.gzip(), +// connect.gzip(), connect.staticProvider(__dirname + "/../../../client"), commonProvider() );