OLD | NEW |
1 | 1 |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @implements {WebInspector.SourcesView.EditorAction} | 8 * @implements {WebInspector.SourcesView.EditorAction} |
9 */ | 9 */ |
10 WebInspector.InplaceFormatterEditorAction = function() | 10 WebInspector.InplaceFormatterEditorAction = function() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 button: function(sourcesView) | 46 button: function(sourcesView) |
47 { | 47 { |
48 if (this._button) | 48 if (this._button) |
49 return this._button.element; | 49 return this._button.element; |
50 | 50 |
51 this._sourcesView = sourcesView; | 51 this._sourcesView = sourcesView; |
52 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito
rSelected, this._editorSelected.bind(this)); | 52 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito
rSelected, this._editorSelected.bind(this)); |
53 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito
rClosed, this._editorClosed.bind(this)); | 53 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.Edito
rClosed, this._editorClosed.bind(this)); |
54 | 54 |
55 this._button = new WebInspector.StatusBarButton(WebInspector.UIString("F
ormat"), "sources-toggle-pretty-print-status-bar-item"); | 55 this._button = new WebInspector.StatusBarButton(WebInspector.UIString("F
ormat"), "sources-toggle-pretty-print-status-bar-item"); |
56 this._button.toggled = false; | 56 this._button.setToggled(false); |
57 this._button.addEventListener("click", this._formatSourceInPlace, this); | 57 this._button.addEventListener("click", this._formatSourceInPlace, this); |
58 this._updateButton(null); | 58 this._updateButton(null); |
59 | 59 |
60 return this._button.element; | 60 return this._button.element; |
61 }, | 61 }, |
62 | 62 |
63 /** | 63 /** |
64 * @param {?WebInspector.UISourceCode} uiSourceCode | 64 * @param {?WebInspector.UISourceCode} uiSourceCode |
65 * @return {boolean} | 65 * @return {boolean} |
66 */ | 66 */ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 var start = [0, 0]; | 109 var start = [0, 0]; |
110 if (sourceFrame) { | 110 if (sourceFrame) { |
111 var selection = sourceFrame.selection(); | 111 var selection = sourceFrame.selection(); |
112 start = formatterMapping.originalToFormatted(selection.startLine
, selection.startColumn); | 112 start = formatterMapping.originalToFormatted(selection.startLine
, selection.startColumn); |
113 } | 113 } |
114 uiSourceCode.setWorkingCopy(formattedContent); | 114 uiSourceCode.setWorkingCopy(formattedContent); |
115 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1
]); | 115 this._sourcesView.showSourceLocation(uiSourceCode, start[0], start[1
]); |
116 } | 116 } |
117 }, | 117 }, |
118 } | 118 } |
OLD | NEW |