| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 function populateRevisions(uiSourceCode) | 49 function populateRevisions(uiSourceCode) |
| 50 { | 50 { |
| 51 if (uiSourceCode.history.length) | 51 if (uiSourceCode.history.length) |
| 52 this._createUISourceCodeItem(uiSourceCode); | 52 this._createUISourceCodeItem(uiSourceCode); |
| 53 } | 53 } |
| 54 | 54 |
| 55 WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this))
; | 55 WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this))
; |
| 56 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Workin
gCopyCommittedByUser, this._revisionAdded, this); | 56 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Workin
gCopyCommittedByUser, this._revisionAdded, this); |
| 57 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeRemoved, this._uiSourceCodeRemoved, this); | 57 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISour
ceCodeRemoved, this._uiSourceCodeRemoved, this); |
| 58 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Projec
tRemoved, this._projectRemoved, this); | 58 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Projec
tRemoved, this._projectRemoved, this); |
| 59 } | 59 }; |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @param {!WebInspector.UISourceCode} uiSourceCode | 62 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 63 */ | 63 */ |
| 64 WebInspector.RevisionHistoryView.showHistory = function(uiSourceCode) | 64 WebInspector.RevisionHistoryView.showHistory = function(uiSourceCode) |
| 65 { | 65 { |
| 66 WebInspector.viewManager.showView("sources.history"); | 66 WebInspector.viewManager.showView("sources.history"); |
| 67 var historyView = /** @type {!WebInspector.RevisionHistoryView} */ (self.run
time.sharedInstance(WebInspector.RevisionHistoryView)); | 67 var historyView = /** @type {!WebInspector.RevisionHistoryView} */ (self.run
time.sharedInstance(WebInspector.RevisionHistoryView)); |
| 68 historyView._revealUISourceCode(uiSourceCode); | 68 historyView._revealUISourceCode(uiSourceCode); |
| 69 } | 69 }; |
| 70 | 70 |
| 71 WebInspector.RevisionHistoryView.prototype = { | 71 WebInspector.RevisionHistoryView.prototype = { |
| 72 /** | 72 /** |
| 73 * @param {!WebInspector.UISourceCode} uiSourceCode | 73 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 74 */ | 74 */ |
| 75 _createUISourceCodeItem: function(uiSourceCode) | 75 _createUISourceCodeItem: function(uiSourceCode) |
| 76 { | 76 { |
| 77 var uiSourceCodeItem = new TreeElement(uiSourceCode.displayName(), true)
; | 77 var uiSourceCodeItem = new TreeElement(uiSourceCode.displayName(), true)
; |
| 78 uiSourceCodeItem.selectable = false; | 78 uiSourceCodeItem.selectable = false; |
| 79 | 79 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 this._uiSourceCodeItems.remove(uiSourceCode); | 173 this._uiSourceCodeItems.remove(uiSourceCode); |
| 174 }, | 174 }, |
| 175 | 175 |
| 176 _projectRemoved: function(event) | 176 _projectRemoved: function(event) |
| 177 { | 177 { |
| 178 var project = event.data; | 178 var project = event.data; |
| 179 project.uiSourceCodes().forEach(this._removeUISourceCode.bind(this)); | 179 project.uiSourceCodes().forEach(this._removeUISourceCode.bind(this)); |
| 180 }, | 180 }, |
| 181 | 181 |
| 182 __proto__: WebInspector.VBox.prototype | 182 __proto__: WebInspector.VBox.prototype |
| 183 } | 183 }; |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * @constructor | 186 * @constructor |
| 187 * @extends {TreeElement} | 187 * @extends {TreeElement} |
| 188 * @param {!WebInspector.Revision} revision | 188 * @param {!WebInspector.Revision} revision |
| 189 * @param {!WebInspector.Revision} baseRevision | 189 * @param {!WebInspector.Revision} baseRevision |
| 190 * @param {boolean} allowRevert | 190 * @param {boolean} allowRevert |
| 191 */ | 191 */ |
| 192 WebInspector.RevisionHistoryTreeElement = function(revision, baseRevision, allow
Revert) | 192 WebInspector.RevisionHistoryTreeElement = function(revision, baseRevision, allow
Revert) |
| 193 { | 193 { |
| 194 TreeElement.call(this, revision.timestamp.toLocaleTimeString(), true); | 194 TreeElement.call(this, revision.timestamp.toLocaleTimeString(), true); |
| 195 this.selectable = false; | 195 this.selectable = false; |
| 196 | 196 |
| 197 this._revision = revision; | 197 this._revision = revision; |
| 198 this._baseRevision = baseRevision; | 198 this._baseRevision = baseRevision; |
| 199 | 199 |
| 200 this._revertElement = createElement("span"); | 200 this._revertElement = createElement("span"); |
| 201 this._revertElement.className = "revision-history-link"; | 201 this._revertElement.className = "revision-history-link"; |
| 202 this._revertElement.textContent = WebInspector.UIString("apply revision cont
ent"); | 202 this._revertElement.textContent = WebInspector.UIString("apply revision cont
ent"); |
| 203 this._revertElement.addEventListener("click", event => {this._revision.rever
tToThis();}, false); | 203 this._revertElement.addEventListener("click", event => {this._revision.rever
tToThis();}, false); |
| 204 if (!allowRevert) | 204 if (!allowRevert) |
| 205 this._revertElement.classList.add("hidden"); | 205 this._revertElement.classList.add("hidden"); |
| 206 } | 206 }; |
| 207 | 207 |
| 208 WebInspector.RevisionHistoryTreeElement.prototype = { | 208 WebInspector.RevisionHistoryTreeElement.prototype = { |
| 209 onattach: function() | 209 onattach: function() |
| 210 { | 210 { |
| 211 this.listItemElement.classList.add("revision-history-revision"); | 211 this.listItemElement.classList.add("revision-history-revision"); |
| 212 }, | 212 }, |
| 213 | 213 |
| 214 onpopulate: function() | 214 onpopulate: function() |
| 215 { | 215 { |
| 216 this.listItemElement.appendChild(this._revertElement); | 216 this.listItemElement.appendChild(this._revertElement); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 child.listItemElement.classList.add("revision-history-line"); | 294 child.listItemElement.classList.add("revision-history-line"); |
| 295 contentSpan.classList.add("revision-history-line-" + changeType); | 295 contentSpan.classList.add("revision-history-line-" + changeType); |
| 296 }, | 296 }, |
| 297 | 297 |
| 298 allowRevert: function() | 298 allowRevert: function() |
| 299 { | 299 { |
| 300 this._revertElement.classList.remove("hidden"); | 300 this._revertElement.classList.remove("hidden"); |
| 301 }, | 301 }, |
| 302 | 302 |
| 303 __proto__: TreeElement.prototype | 303 __proto__: TreeElement.prototype |
| 304 } | 304 }; |
| OLD | NEW |