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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 /** | 30 /** |
31 * @implements {UI.ActionDelegate} | 31 * @implements {UI.ActionDelegate} |
32 * @implements {UI.ToolbarItem.ItemsProvider} | 32 * @implements {UI.ToolbarItem.ItemsProvider} |
33 * @implements {UI.ContextMenu.Provider} | 33 * @implements {UI.ContextMenu.Provider} |
34 * @unrestricted | 34 * @unrestricted |
35 */ | 35 */ |
36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget { | 36 Sources.WatchExpressionsSidebarPane = class extends UI.ThrottledWidget { |
37 constructor() { | 37 constructor() { |
38 super(); | 38 super(); |
39 this.registerRequiredCSS('components/objectValue.css'); | 39 this.registerRequiredCSS('object_ui/objectValue.css'); |
40 | 40 |
41 /** @type {!Array.<!Sources.WatchExpression>} */ | 41 /** @type {!Array.<!Sources.WatchExpression>} */ |
42 this._watchExpressions = []; | 42 this._watchExpressions = []; |
43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp
ressions', []); | 43 this._watchExpressionsSetting = Common.settings.createLocalSetting('watchExp
ressions', []); |
44 | 44 |
45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l
argeicon-add'); | 45 this._addButton = new UI.ToolbarButton(Common.UIString('Add expression'), 'l
argeicon-add'); |
46 this._addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addBut
tonClicked.bind(this)); | 46 this._addButton.addEventListener(UI.ToolbarButton.Events.Click, this._addBut
tonClicked.bind(this)); |
47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); | 47 this._refreshButton = new UI.ToolbarButton(Common.UIString('Refresh'), 'larg
eicon-refresh'); |
48 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this.upd
ate, this); | 48 this._refreshButton.addEventListener(UI.ToolbarButton.Events.Click, this.upd
ate, this); |
49 | 49 |
50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions'
); | 50 this._bodyElement = this.element.createChild('div', 'vbox watch-expressions'
); |
51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi
s), false); | 51 this._bodyElement.addEventListener('contextmenu', this._contextMenu.bind(thi
s), false); |
52 this._expandController = new Components.ObjectPropertiesSectionExpandControl
ler(); | 52 this._expandController = new ObjectUI.ObjectPropertiesSectionExpandControlle
r(); |
53 | 53 |
54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this); | 54 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this.update, this); |
55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update,
this); | 55 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this.update,
this); |
56 this._linkifier = new Components.Linkifier(); | 56 this._linkifier = new Components.Linkifier(); |
57 this.update(); | 57 this.update(); |
58 } | 58 } |
59 | 59 |
60 /** | 60 /** |
61 * @override | 61 * @override |
62 * @return {!Array<!UI.ToolbarItem>} | 62 * @return {!Array<!UI.ToolbarItem>} |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 contextMenu.appendAction('sources.add-to-watch'); | 205 contextMenu.appendAction('sources.add-to-watch'); |
206 } | 206 } |
207 }; | 207 }; |
208 | 208 |
209 /** | 209 /** |
210 * @unrestricted | 210 * @unrestricted |
211 */ | 211 */ |
212 Sources.WatchExpression = class extends Common.Object { | 212 Sources.WatchExpression = class extends Common.Object { |
213 /** | 213 /** |
214 * @param {?string} expression | 214 * @param {?string} expression |
215 * @param {!Components.ObjectPropertiesSectionExpandController} expandControll
er | 215 * @param {!ObjectUI.ObjectPropertiesSectionExpandController} expandController |
216 * @param {!Components.Linkifier} linkifier | 216 * @param {!Components.Linkifier} linkifier |
217 */ | 217 */ |
218 constructor(expression, expandController, linkifier) { | 218 constructor(expression, expandController, linkifier) { |
219 super(); | 219 super(); |
220 this._expression = expression; | 220 this._expression = expression; |
221 this._expandController = expandController; | 221 this._expandController = expandController; |
222 this._element = createElementWithClass('div', 'watch-expression monospace'); | 222 this._element = createElementWithClass('div', 'watch-expression monospace'); |
223 this._editing = false; | 223 this._editing = false; |
224 this._linkifier = linkifier; | 224 this._linkifier = linkifier; |
225 | 225 |
(...skipping 22 matching lines...) Expand all Loading... |
248 this._expression, Sources.WatchExpression._watchObjectGroupId, false,
true, false, false, false, | 248 this._expression, Sources.WatchExpression._watchObjectGroupId, false,
true, false, false, false, |
249 this._createWatchExpression.bind(this)); | 249 this._createWatchExpression.bind(this)); |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 startEditing() { | 253 startEditing() { |
254 this._editing = true; | 254 this._editing = true; |
255 this._element.removeChild(this._objectPresentationElement); | 255 this._element.removeChild(this._objectPresentationElement); |
256 var newDiv = this._element.createChild('div'); | 256 var newDiv = this._element.createChild('div'); |
257 newDiv.textContent = this._nameElement.textContent; | 257 newDiv.textContent = this._nameElement.textContent; |
258 this._textPrompt = new Components.ObjectPropertyPrompt(); | 258 this._textPrompt = new ObjectUI.ObjectPropertyPrompt(); |
259 this._textPrompt.renderAsBlock(); | 259 this._textPrompt.renderAsBlock(); |
260 var proxyElement = this._textPrompt.attachAndStartEditing(newDiv, this._fini
shEditing.bind(this)); | 260 var proxyElement = this._textPrompt.attachAndStartEditing(newDiv, this._fini
shEditing.bind(this)); |
261 proxyElement.classList.add('watch-expression-text-prompt-proxy'); | 261 proxyElement.classList.add('watch-expression-text-prompt-proxy'); |
262 proxyElement.addEventListener('keydown', this._promptKeyDown.bind(this), fal
se); | 262 proxyElement.addEventListener('keydown', this._promptKeyDown.bind(this), fal
se); |
263 this._element.getComponentSelection().selectAllChildren(newDiv); | 263 this._element.getComponentSelection().selectAllChildren(newDiv); |
264 } | 264 } |
265 | 265 |
266 /** | 266 /** |
267 * @return {boolean} | 267 * @return {boolean} |
268 */ | 268 */ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 */ | 321 */ |
322 _createWatchExpression(result, exceptionDetails) { | 322 _createWatchExpression(result, exceptionDetails) { |
323 this._result = result; | 323 this._result = result; |
324 | 324 |
325 var headerElement = createElementWithClass('div', 'watch-expression-header')
; | 325 var headerElement = createElementWithClass('div', 'watch-expression-header')
; |
326 var deleteButton = headerElement.createChild('button', 'watch-expression-del
ete-button'); | 326 var deleteButton = headerElement.createChild('button', 'watch-expression-del
ete-button'); |
327 deleteButton.title = Common.UIString('Delete watch expression'); | 327 deleteButton.title = Common.UIString('Delete watch expression'); |
328 deleteButton.addEventListener('click', this._deleteWatchExpression.bind(this
), false); | 328 deleteButton.addEventListener('click', this._deleteWatchExpression.bind(this
), false); |
329 | 329 |
330 var titleElement = headerElement.createChild('div', 'watch-expression-title'
); | 330 var titleElement = headerElement.createChild('div', 'watch-expression-title'
); |
331 this._nameElement = Components.ObjectPropertiesSection.createNameElement(thi
s._expression); | 331 this._nameElement = ObjectUI.ObjectPropertiesSection.createNameElement(this.
_expression); |
332 if (!!exceptionDetails || !result) { | 332 if (!!exceptionDetails || !result) { |
333 this._valueElement = createElementWithClass('span', 'watch-expression-erro
r value'); | 333 this._valueElement = createElementWithClass('span', 'watch-expression-erro
r value'); |
334 titleElement.classList.add('dimmed'); | 334 titleElement.classList.add('dimmed'); |
335 this._valueElement.textContent = Common.UIString('<not available>'); | 335 this._valueElement.textContent = Common.UIString('<not available>'); |
336 } else { | 336 } else { |
337 this._valueElement = Components.ObjectPropertiesSection.createValueElement
WithCustomSupport( | 337 this._valueElement = ObjectUI.ObjectPropertiesSection.createValueElementWi
thCustomSupport( |
338 result, !!exceptionDetails, false /* showPreview */, titleElement, thi
s._linkifier); | 338 result, !!exceptionDetails, false /* showPreview */, titleElement, thi
s._linkifier); |
339 } | 339 } |
340 var separatorElement = createElementWithClass('span', 'watch-expressions-sep
arator'); | 340 var separatorElement = createElementWithClass('span', 'watch-expressions-sep
arator'); |
341 separatorElement.textContent = ': '; | 341 separatorElement.textContent = ': '; |
342 titleElement.appendChildren(this._nameElement, separatorElement, this._value
Element); | 342 titleElement.appendChildren(this._nameElement, separatorElement, this._value
Element); |
343 | 343 |
344 this._element.removeChildren(); | 344 this._element.removeChildren(); |
345 this._objectPropertiesSection = null; | 345 this._objectPropertiesSection = null; |
346 if (!exceptionDetails && result && result.hasChildren && !result.customPrevi
ew()) { | 346 if (!exceptionDetails && result && result.hasChildren && !result.customPrevi
ew()) { |
347 headerElement.classList.add('watch-expression-object-header'); | 347 headerElement.classList.add('watch-expression-object-header'); |
348 this._objectPropertiesSection = new Components.ObjectPropertiesSection(res
ult, headerElement, this._linkifier); | 348 this._objectPropertiesSection = new ObjectUI.ObjectPropertiesSection(resul
t, headerElement, this._linkifier); |
349 this._objectPresentationElement = this._objectPropertiesSection.element; | 349 this._objectPresentationElement = this._objectPropertiesSection.element; |
350 this._expandController.watchSection(/** @type {string} */ (this._expressio
n), this._objectPropertiesSection); | 350 this._expandController.watchSection(/** @type {string} */ (this._expressio
n), this._objectPropertiesSection); |
351 var objectTreeElement = this._objectPropertiesSection.objectTreeElement(); | 351 var objectTreeElement = this._objectPropertiesSection.objectTreeElement(); |
352 objectTreeElement.toggleOnClick = false; | 352 objectTreeElement.toggleOnClick = false; |
353 objectTreeElement.listItemElement.addEventListener('click', this._onSectio
nClick.bind(this), false); | 353 objectTreeElement.listItemElement.addEventListener('click', this._onSectio
nClick.bind(this), false); |
354 objectTreeElement.listItemElement.addEventListener('dblclick', this._dblCl
ickOnWatchExpression.bind(this)); | 354 objectTreeElement.listItemElement.addEventListener('dblclick', this._dblCl
ickOnWatchExpression.bind(this)); |
355 } else { | 355 } else { |
356 this._objectPresentationElement = headerElement; | 356 this._objectPresentationElement = headerElement; |
357 this._objectPresentationElement.addEventListener('dblclick', this._dblClic
kOnWatchExpression.bind(this)); | 357 this._objectPresentationElement.addEventListener('dblclick', this._dblClic
kOnWatchExpression.bind(this)); |
358 } | 358 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 InspectorFrontendHost.copyText(this._valueElement.textContent); | 417 InspectorFrontendHost.copyText(this._valueElement.textContent); |
418 } | 418 } |
419 }; | 419 }; |
420 | 420 |
421 Sources.WatchExpression._watchObjectGroupId = 'watch-group'; | 421 Sources.WatchExpression._watchObjectGroupId = 'watch-group'; |
422 | 422 |
423 /** @enum {symbol} */ | 423 /** @enum {symbol} */ |
424 Sources.WatchExpression.Events = { | 424 Sources.WatchExpression.Events = { |
425 ExpressionUpdated: Symbol('ExpressionUpdated') | 425 ExpressionUpdated: Symbol('ExpressionUpdated') |
426 }; | 426 }; |
OLD | NEW |