When this happens, as
we saw in the init() method, the filenameChanged() method will be called. More accurately, it
will be called multiple times during the ???lifetime??? of the edit. This code, which handles the
renaming operation, is as follows:
this.filenameChanged = function(inStage, inRowID, inCellIndex, inNewValue,
inOldValue) {
if (inStage == 2) {
// Get the ID of the selected directory and file, if any.
var selectedDirectory = directoryTree.getSelectedItemId();
// Get fully qualified name of selected file.
var directoryPath = directoryTree.getUserData(selectedDirectory, "path");
var oldFullPath = directoryPath + pathSeparator + inOldValue;
var newFullPath = directoryPath + pathSeparator + inNewValue;
FileSystemFunctions.renameFile(oldFullPath, newFullPath,
{ callback : function(inResp) {
// Refresh both the directory file list and the directory tree.
fileman.directoryClicked(selectedDirectory);
directoryTree.deleteChildItems(selectedDirectory);
// Add the "Loading" node back in before refreshing tree.
directoryTree.insertNewChild(selectedDirectory,
selectedDirectory + "_dummy", "Loading...", 0, "blank.gif",
0, 0, 0, 0);
fileman.directoryExpanded(selectedDirectory);
}
}
);
return true;
}
} // End filenameChanged().
Pages:
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543