| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) IBM Corp. 2009 All rights reserved. | 2 * Copyright (C) IBM Corp. 2009 All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 { | 68 { |
| 69 this._requiresUpdate = true; | 69 this._requiresUpdate = true; |
| 70 this._refreshExpressionsIfNeeded(); | 70 this._refreshExpressionsIfNeeded(); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * @param {string} expressionString | 74 * @param {string} expressionString |
| 75 */ | 75 */ |
| 76 addExpression: function(expressionString) | 76 addExpression: function(expressionString) |
| 77 { | 77 { |
| 78 this.requestReveal(); | 78 this.revealWidget(); |
| 79 if (this._requiresUpdate) { | 79 if (this._requiresUpdate) { |
| 80 this._rebuildWatchExpressions(); | 80 this._rebuildWatchExpressions(); |
| 81 delete this._requiresUpdate; | 81 delete this._requiresUpdate; |
| 82 } | 82 } |
| 83 this._createWatchExpression(expressionString); | 83 this._createWatchExpression(expressionString); |
| 84 this._saveExpressions(); | 84 this._saveExpressions(); |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 expandIfNecessary: function() | 87 expandIfNecessary: function() |
| 88 { | 88 { |
| 89 if (this._watchExpressionsSetting.get().length) | 89 if (this._watchExpressionsSetting.get().length) |
| 90 this.requestReveal(); | 90 this.revealWidget(); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 _saveExpressions: function() | 93 _saveExpressions: function() |
| 94 { | 94 { |
| 95 var toSave = []; | 95 var toSave = []; |
| 96 for (var i = 0; i < this._watchExpressions.length; i++) | 96 for (var i = 0; i < this._watchExpressions.length; i++) |
| 97 if (this._watchExpressions[i].expression()) | 97 if (this._watchExpressions[i].expression()) |
| 98 toSave.push(this._watchExpressions[i].expression()); | 98 toSave.push(this._watchExpressions[i].expression()); |
| 99 | 99 |
| 100 this._watchExpressionsSetting.set(toSave); | 100 this._watchExpressionsSetting.set(toSave); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 _refreshExpressionsIfNeeded: function() | 103 _refreshExpressionsIfNeeded: function() |
| 104 { | 104 { |
| 105 if (this._requiresUpdate && this.isShowing()) { | 105 if (this._requiresUpdate && this.isShowing()) { |
| 106 this._rebuildWatchExpressions(); | 106 this._rebuildWatchExpressions(); |
| 107 delete this._requiresUpdate; | 107 delete this._requiresUpdate; |
| 108 } else | 108 } else |
| 109 this._requiresUpdate = true; | 109 this._requiresUpdate = true; |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * @param {!WebInspector.Event=} event | 113 * @param {!WebInspector.Event=} event |
| 114 */ | 114 */ |
| 115 _addButtonClicked: function(event) | 115 _addButtonClicked: function(event) |
| 116 { | 116 { |
| 117 if (event) | 117 if (event) |
| 118 event.consume(true); | 118 event.consume(true); |
| 119 this.requestReveal(); | 119 this.revealWidget(); |
| 120 this._createWatchExpression(null).startEditing(); | 120 this._createWatchExpression(null).startEditing(); |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {!WebInspector.Event} event | 124 * @param {!WebInspector.Event} event |
| 125 */ | 125 */ |
| 126 _refreshButtonClicked: function(event) | 126 _refreshButtonClicked: function(event) |
| 127 { | 127 { |
| 128 event.consume(); | 128 event.consume(); |
| 129 this.refreshExpressions(); | 129 this.refreshExpressions(); |
| 130 }, | 130 }, |
| 131 | 131 |
| 132 _rebuildWatchExpressions: function() | 132 _rebuildWatchExpressions: function() |
| 133 { | 133 { |
| 134 this._linkifier.reset(); | 134 this._linkifier.reset(); |
| 135 this._bodyElement.removeChildren(); | 135 this._bodyElement.removeChildren(); |
| 136 this._watchExpressions = []; | 136 this._watchExpressions = []; |
| 137 this._emptyElement = this._bodyElement.createChild("div", "info"); | 137 this._emptyElement = this._bodyElement.createChild("div", "gray-info-mes
sage"); |
| 138 this._emptyElement.textContent = WebInspector.UIString("No Watch Express
ions"); | 138 this._emptyElement.textContent = WebInspector.UIString("No Watch Express
ions"); |
| 139 var watchExpressionStrings = this._watchExpressionsSetting.get(); | 139 var watchExpressionStrings = this._watchExpressionsSetting.get(); |
| 140 for (var i = 0; i < watchExpressionStrings.length; ++i) { | 140 for (var i = 0; i < watchExpressionStrings.length; ++i) { |
| 141 var expression = watchExpressionStrings[i]; | 141 var expression = watchExpressionStrings[i]; |
| 142 if (!expression) | 142 if (!expression) |
| 143 continue; | 143 continue; |
| 144 | 144 |
| 145 this._createWatchExpression(expression); | 145 this._createWatchExpression(expression); |
| 146 } | 146 } |
| 147 }, | 147 }, |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 contextMenu.appendApplicableItems(this._result); | 436 contextMenu.appendApplicableItems(this._result); |
| 437 }, | 437 }, |
| 438 | 438 |
| 439 _copyValueButtonClicked: function() | 439 _copyValueButtonClicked: function() |
| 440 { | 440 { |
| 441 InspectorFrontendHost.copyText(this._valueElement.textContent); | 441 InspectorFrontendHost.copyText(this._valueElement.textContent); |
| 442 }, | 442 }, |
| 443 | 443 |
| 444 __proto__: WebInspector.Object.prototype | 444 __proto__: WebInspector.Object.prototype |
| 445 } | 445 } |
| OLD | NEW |