From 69a046c9f365d5828f1aca0a49b24c31d5c01bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Malbr=C3=A1n?= Date: Mon, 1 Apr 2013 18:27:07 -0300 Subject: [PATCH] Use isInRename instead of the flag --- src/project/ProjectManager.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index 3d6c802ac52..c1333cf7bb3 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -126,12 +126,6 @@ define(function (require, exports, module) { */ var _projectBaseUrl = ""; - /** - * @private - * @see renameItemInline() - */ - var _isRenaming = false; - /** * @private * @type {PreferenceStorage} @@ -1275,19 +1269,17 @@ define(function (require, exports, module) { * @param {!Entry} entry FileEntry or DirectoryEntry to rename */ function renameItemInline(entry) { - // Dont try to rename again if we are already renaming - if (_isRenaming) { - return; - } - // First make sure the item in the tree is visible - jsTree's rename API doesn't do anything to ensure inline input is visible showInTree(entry) .done(function (selected) { + // Don't try to rename again if we are already renaming + if (_isInRename(selected)) { + return; + } + var isFolder = selected.hasClass("jstree-open") || selected.hasClass("jstree-closed"); _projectTree.one("rename.jstree", function (event, data) { - _isRenaming = false; - // Make sure the file was actually renamed if (data.rslt.old_name === data.rslt.new_name) { return; @@ -1330,7 +1322,6 @@ define(function (require, exports, module) { }); }); _projectTree.jstree("rename"); - _isRenaming = true; }); // No fail handler: silently no-op if file doesn't exist in tree }