onKeyDown: function(e) { if (gotofile.eventsEnabled) return; if (e.keyCode === 27) { // Escape gotofile.toggleDialog(-1); } else if (e.keyCode === 13) { // Enter gotofile.toggleDialog(-1); } else if (e.keyCode === 40) { // Down e.preventDefault(); delete e.currentTarget; treeOutline.dispatchEvent("keydown", e); return; } else if (e.keyCode === 38) { // Up e.preventDefault(); delete e.currentTarget; treeOutline.dispatchEvent("keydown", e); return; } else if (this.isDirty) { this.renderOutline(); } },
treeOutline.addEventListener("click", function(e) { _self.ignoreSelectOnce = false; _self.onSelect(treeOutline.selected); var COLLAPSE_AREA = 14; if (e.htmlEvent.x >= treeOutline.$container.getClientRects()[0].left + 14) gotofile.toggleDialog(-1); });
e: function(editor, data) { var path = data.argv[1]; if (!path) { gotofile.toggleDialog(1); return false; } else { path = (ide.davPrefix + "/" + path).replace(/\/+/, "/"); filesystem.exists(path, function(exists){ if (exists) { editors.gotoDocument({path: path}); } else { var node = filesystem.createFileNodeFromPath(path); node.setAttribute("newfile", "1"); node.setAttribute("changed", "1"); node.setAttribute("cli", "1"); // blocks Save As dialog var doc = ide.createDocument(node); doc.cachedValue = ""; editors.gotoDocument({ doc: doc, type: "newfile", origin: "newfile" }); } }); } },
onKeyDown: function(e) { if (gotofile.eventsEnabled) return; if (e.keyCode === 27) { // Escape if (this.$originalLine) { var editor = editors.currentEditor; var ace = editor.ceEditor.$editor; ace.gotoLine(this.$originalLine, this.$originalColumn, apf.isTrue(settings.model.queryValue("editors/code/@animatedscroll"))); delete this.$originalLine; delete this.$originalColumn; } gotofile.toggleDialog(-1); } else if (e.keyCode === 13) { // Enter this.ignoreSelectOnce = false; this.onSelect(treeOutline.selected); gotofile.toggleDialog(-1); } else if (e.keyCode === 40) { // Down e.preventDefault(); delete e.currentTarget; treeOutline.dispatchEvent("keydown", e); return; } else if (e.keyCode === 38) { // Up e.preventDefault(); delete e.currentTarget; treeOutline.dispatchEvent("keydown", e); return; } else if (this.isDirty) { this.isKeyDownAfterDirty = true; } },
openOutline : function(event) { var data = event.data; if (data.error) { // TODO: show error in outline? console.log("Oh noes! " + data.error); return; } this.fullOutline = event.data.body; this.renderOutline(event.data.showNow); if (event.data.showNow) { gotofile.toggleDialog(1); txtGoToFile.focus(); this.showOutline(); txtGoToFile.$input.selectionStart = 1; } else if (txtGoToFile.value.match(/^@/)) { this.showOutline(); } this.scrollToSelected(); },
showOutline: function(makeVisible, ignoreInputText) { ext.initExtension(outline); ext.initExtension(gotofile); if (makeVisible) { gotofile.toggleDialog(1); txtGoToFile.focus(); this.showOutline(); if (txtGoToFile.value.length > 0) txtGoToFile.$input.selectionStart = 1; this.scrollToTop(); } gotofile.setEventsEnabled(false); if (!dgGoToFile.getProperty("visible")) return; if (!txtGoToFile.value.match(/^@/) && !ignoreInputText) { this.lastGoToFileText = txtGoToFile.value; txtGoToFile.setValue(this.lastOutlineText); } this.ignoreSelectOnce = true; dgGoToFile.hide(); treeOutline.show(); if (makeVisible) txtGoToFile.$input.selectionStart = 1; },
listEditors : function(editor) { gotofile.toggleDialog(); },
treeOutline.addEventListener("onafterchoose", function() { _self.ignoreSelectOnce = false; _self.onSelect(treeOutline.selected); gotofile.toggleDialog(-1); });
treeOutline.addEventListener("onafterchoose", function() { setTimeout(gotofile.toggleDialog(-1), 500); });