Skip to content

Commit

Permalink
Use isInRename instead of the flag
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMalbran committed Apr 1, 2013
1 parent 40c51fc commit 69a046c
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ define(function (require, exports, module) {
*/
var _projectBaseUrl = "";

/**
* @private
* @see renameItemInline()
*/
var _isRenaming = false;

/**
* @private
* @type {PreferenceStorage}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 69a046c

Please sign in to comment.