Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
- Make 'show in tree' label / command name less generic
Browse files Browse the repository at this point in the history
- Fix bug in _findTreeNode(): return rejected Promise instead of null when
  path lies outside project tree
  • Loading branch information
peterflynn committed Oct 12, 2012
1 parent 0e701a1 commit 1a33aa5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ define(function (require, exports, module) {
// Navigate
exports.NAVIGATE_NEXT_DOC = "navigate.nextDoc";
exports.NAVIGATE_PREV_DOC = "navigate.prevDoc";
exports.NAVIGATE_SHOW_IN_TREE = "navigate.showInTree";
exports.NAVIGATE_SHOW_IN_FILE_TREE = "navigate.showInFileTree";
exports.NAVIGATE_QUICK_OPEN = "navigate.quickOpen";
exports.NAVIGATE_GOTO_DEFINITION = "navigate.gotoDefinition";
exports.NAVIGATE_GOTO_LINE = "navigate.gotoLine";
Expand Down
2 changes: 1 addition & 1 deletion src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.NAVIGATE_PREV_DOC, [{key: "Ctrl-Shift-Tab", platform: "win"},
{key: "Ctrl-Shift-Tab", platform: "mac"}]);
menu.addMenuDivider();
menu.addMenuItem(Commands.NAVIGATE_SHOW_IN_TREE);
menu.addMenuItem(Commands.NAVIGATE_SHOW_IN_FILE_TREE);
menu.addMenuDivider();
menu.addMenuItem(Commands.TOGGLE_QUICK_EDIT, "Ctrl-E");
menu.addMenuItem(Commands.QUICK_EDIT_PREV_MATCH, {key: "Alt-Up", displayKey: "Alt-\u2191"});
Expand Down
2 changes: 1 addition & 1 deletion src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ define(function (require, exports, module) {

CommandManager.register(Strings.CMD_NEXT_DOC, Commands.NAVIGATE_NEXT_DOC, handleGoNextDoc);
CommandManager.register(Strings.CMD_PREV_DOC, Commands.NAVIGATE_PREV_DOC, handleGoPrevDoc);
CommandManager.register(Strings.CMD_SHOW_IN_TREE, Commands.NAVIGATE_SHOW_IN_TREE, handleShowInTree);
CommandManager.register(Strings.CMD_SHOW_IN_TREE, Commands.NAVIGATE_SHOW_IN_FILE_TREE, handleShowInTree);

// Listen for changes that require updating the editor titlebar
$(DocumentManager).on("dirtyFlagChange", handleDirtyChange);
Expand Down
2 changes: 1 addition & 1 deletion src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ define({
"CMD_QUICK_EDIT_NEXT_MATCH" : "Next Match",
"CMD_NEXT_DOC" : "Next Document",
"CMD_PREV_DOC" : "Previous Document",
"CMD_SHOW_IN_TREE" : "Show in Tree",
"CMD_SHOW_IN_TREE" : "Show in File Tree",

// Debug menu commands
"DEBUG_MENU" : "Debug",
Expand Down
7 changes: 4 additions & 3 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,15 +776,16 @@ define(function (require, exports, module) {
* @return {$.Promise} Resolved with jQ obj for the jsTree tree node; or rejected if not found
*/
function _findTreeNode(entry) {
var projRelativePath = makeProjectRelativeIfPossible(entry.fullPath);
var treeAPI = $.jstree._reference(_projectTree);
var result = new $.Deferred();

// If path not within project, ignore
var projRelativePath = makeProjectRelativeIfPossible(entry.fullPath);
if (projRelativePath === entry.fullPath) {
return null;
return result.reject().promise();
}

var treeAPI = $.jstree._reference(_projectTree);

// We're going to traverse from root of tree, one segment at a time
var pathSegments = projRelativePath.split("/");

Expand Down

0 comments on commit 1a33aa5

Please sign in to comment.