| Index: Source/devtools/front_end/UISourceCode.js
|
| diff --git a/Source/devtools/front_end/UISourceCode.js b/Source/devtools/front_end/UISourceCode.js
|
| index 79c0b538dda014516baa93fb1cdec5c984515302..caa836a81b36321176722d7491f70612ddd085c6 100644
|
| --- a/Source/devtools/front_end/UISourceCode.js
|
| +++ b/Source/devtools/front_end/UISourceCode.js
|
| @@ -132,16 +132,41 @@ WebInspector.UISourceCode.prototype = {
|
| },
|
|
|
| /**
|
| + * @return {boolean}
|
| + */
|
| + canRename: function()
|
| + {
|
| + return this._project.canRename();
|
| + },
|
| +
|
| + /**
|
| * @param {string} newName
|
| + * @param {function(boolean)} callback
|
| + */
|
| + rename: function(newName, callback)
|
| + {
|
| + this._project.rename(this, newName, innerCallback.bind(this));
|
| +
|
| + function innerCallback(success, newName)
|
| + {
|
| + if (success)
|
| + this._updateName(newName);
|
| + callback(success);
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * @param {string} name
|
| */
|
| - rename: function(newName)
|
| + _updateName: function(name)
|
| {
|
| if (!this._path.length)
|
| return;
|
| - this._path[this._path.length - 1] = newName;
|
| - this._url = newName;
|
| - this._originURL = newName;
|
| - this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, null);
|
| + var oldURI = this.uri();
|
| + this._path[this._path.length - 1] = name;
|
| + this._url = name;
|
| + this._originURL = name;
|
| + this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged, oldURI);
|
| },
|
|
|
| /**
|
|
|