OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Nokia Inc. All rights reserved. | 2 * Copyright (C) 2008 Nokia Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 var rootNode = this._dataGrid.rootNode(); | 112 var rootNode = this._dataGrid.rootNode(); |
113 var children = rootNode.children; | 113 var children = rootNode.children; |
114 | 114 |
115 event.consume(true); | 115 event.consume(true); |
116 | 116 |
117 for (var i = 0; i < children.length; ++i) { | 117 for (var i = 0; i < children.length; ++i) { |
118 var childNode = children[i]; | 118 var childNode = children[i]; |
119 if (childNode.data.key === storageData.key) { | 119 if (childNode.data.key === storageData.key) { |
120 rootNode.removeChild(childNode); | 120 rootNode.removeChild(childNode); |
121 this.deleteButton.visible = (children.length > 1); | 121 this.deleteButton.visible = (children.length > 1); |
122 return; | 122 break; |
123 } | 123 } |
124 } | 124 } |
| 125 if (this._setItem) { |
| 126 this._setItem(); |
| 127 delete this._setItem; |
| 128 } |
125 }, | 129 }, |
126 | 130 |
127 /** | 131 /** |
128 * @param {WebInspector.Event} event | 132 * @param {WebInspector.Event} event |
129 */ | 133 */ |
130 _domStorageItemAdded: function(event) | 134 _domStorageItemAdded: function(event) |
131 { | 135 { |
132 if (!this.isShowing() || !this._dataGrid) | 136 if (!this.isShowing() || !this._dataGrid) |
133 return; | 137 return; |
134 | 138 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 243 |
240 _refreshButtonClicked: function(event) | 244 _refreshButtonClicked: function(event) |
241 { | 245 { |
242 this._update(); | 246 this._update(); |
243 }, | 247 }, |
244 | 248 |
245 _editingCallback: function(editingNode, columnIdentifier, oldText, newText) | 249 _editingCallback: function(editingNode, columnIdentifier, oldText, newText) |
246 { | 250 { |
247 var domStorage = this.domStorage; | 251 var domStorage = this.domStorage; |
248 if ("key" === columnIdentifier) { | 252 if ("key" === columnIdentifier) { |
249 if (typeof oldText === "string") | 253 if (typeof oldText === "string") { |
250 domStorage.removeItem(oldText); | 254 domStorage.removeItem(oldText); |
251 domStorage.setItem(newText, editingNode.data.value || ''); | 255 this._setItem = domStorage.setItem.bind(domStorage, newText, edi
tingNode.data.value || ''); |
| 256 } else |
| 257 domStorage.setItem(newText, editingNode.data.value || ''); |
252 this._removeDupes(editingNode); | 258 this._removeDupes(editingNode); |
253 } else | 259 } else |
254 domStorage.setItem(editingNode.data.key || '', newText); | 260 domStorage.setItem(editingNode.data.key || '', newText); |
255 }, | 261 }, |
256 | 262 |
257 /** | 263 /** |
258 * @param {!WebInspector.DataGridNode} masterNode | 264 * @param {!WebInspector.DataGridNode} masterNode |
259 */ | 265 */ |
260 _removeDupes: function(masterNode) | 266 _removeDupes: function(masterNode) |
261 { | 267 { |
(...skipping 10 matching lines...) Expand all Loading... |
272 { | 278 { |
273 if (!node || node.isCreationNode) | 279 if (!node || node.isCreationNode) |
274 return; | 280 return; |
275 | 281 |
276 if (this.domStorage) | 282 if (this.domStorage) |
277 this.domStorage.removeItem(node.data.key); | 283 this.domStorage.removeItem(node.data.key); |
278 }, | 284 }, |
279 | 285 |
280 __proto__: WebInspector.View.prototype | 286 __proto__: WebInspector.View.prototype |
281 } | 287 } |
OLD | NEW |