Permalink
Browse files

added find support

  • Loading branch information...
1 parent 5912263 commit 4a3d253d834ddbd1d16d6a0652162cbd899784bc @sans-sense sans-sense committed Mar 21, 2012
Showing with 29 additions and 0 deletions.
  1. +7 −0 data/application.js
  2. +3 −0 data/fireedit.css
  3. +12 −0 data/outline_view.js
  4. +7 −0 data/shell-commands.js
View
7 data/application.js
@@ -22,6 +22,7 @@ define("fireedit/core/application",
(function(){
var currentEditor;
+ var registeredViews = {};
var self = this;
this.localModeRun = function() {
@@ -88,6 +89,12 @@ define("fireedit/core/application",
getResourceManager().observeSettings(settingsCallback);
}
};
+ this.registerView = function(name, implementation) {
+ registeredViews[name] = implementation;
+ };
+ this.getView = function(name) {
+ return registeredViews[name];
+ };
}).call(Application.prototype);
var currentApplication = new Application();
View
3 data/fireedit.css
@@ -201,3 +201,6 @@
background-position: 0 0;
}
+li.highlighted {
+ text-decoration: underline;
+}
View
12 data/outline_view.js
@@ -19,6 +19,7 @@ define("fireedit/view/outline_view",
// set it up to listen to the mode
this.jsMode.on("AST", this.handleAST);
viewUI.addEventListener("click", this.handleNavigation, false);
+ application.registerView("outline_view", this);
};
(function () {
@@ -139,6 +140,17 @@ define("fireedit/view/outline_view",
editor.focus();
}
};
+ this.find = function(functionPattern) {
+ var pattern = new RegExp(functionPattern), functionName;
+ $("#outline-tree li").each(function(index, item ) {
+ var functionName = $(item).text();
+ if (functionName.match(pattern)) {
+ $(item).addClass("expanded");
+ $(item).addClass("highlighted");
+ $(item).parents().show();
+ }
+ });
+ };
var nodeToHtml = function (decoratedNode) {
var liHtml, i, generatedContent, fun = decoratedNode.originalFunction;
var nodeChildren = decoratedNode.getChildren();
View
7 data/shell-commands.js
@@ -20,9 +20,16 @@ define("fireedit/shell-commands",
}
};
+ var find_function = {
+ name:"find",
+ fn: function(fname) {
+ this.getView("outline_view").find(fname);
+ }
+ };
/* register commands with the shell */
var register = function() {
shell.add(goto_function);
+ shell.add(find_function);
};
exports.commands = {

0 comments on commit 4a3d253

Please sign in to comment.