| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 _togglePauseOnExceptions() { | 534 _togglePauseOnExceptions() { |
| 535 Common.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionB
utton.toggled()); | 535 Common.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionB
utton.toggled()); |
| 536 } | 536 } |
| 537 | 537 |
| 538 /** | 538 /** |
| 539 * @return {boolean} | 539 * @return {boolean} |
| 540 */ | 540 */ |
| 541 _runSnippet() { | 541 _runSnippet() { |
| 542 var uiSourceCode = this._sourcesView.currentUISourceCode(); | 542 var uiSourceCode = this._sourcesView.currentUISourceCode(); |
| 543 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets) | 543 if (!uiSourceCode || !Snippets.ScriptSnippetModel.isSnippetUISourceCode(uiSo
urceCode)) |
| 544 return false; | 544 return false; |
| 545 | 545 |
| 546 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext); | 546 var currentExecutionContext = UI.context.flavor(SDK.ExecutionContext); |
| 547 if (!currentExecutionContext) | 547 if (!currentExecutionContext) |
| 548 return false; | 548 return false; |
| 549 | 549 |
| 550 Snippets.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext, u
iSourceCode); | 550 Snippets.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext, u
iSourceCode); |
| 551 return true; | 551 return true; |
| 552 } | 552 } |
| 553 | 553 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 | 782 |
| 783 /** | 783 /** |
| 784 * @param {!UI.ContextMenu} contextMenu | 784 * @param {!UI.ContextMenu} contextMenu |
| 785 * @param {!Workspace.UISourceCode} uiSourceCode | 785 * @param {!Workspace.UISourceCode} uiSourceCode |
| 786 */ | 786 */ |
| 787 _appendUISourceCodeMappingItems(contextMenu, uiSourceCode) { | 787 _appendUISourceCodeMappingItems(contextMenu, uiSourceCode) { |
| 788 Sources.NavigatorView.appendAddFolderItem(contextMenu); | 788 Sources.NavigatorView.appendAddFolderItem(contextMenu); |
| 789 | 789 |
| 790 if (Runtime.experiments.isEnabled('persistence2')) | 790 if (Runtime.experiments.isEnabled('persistence2')) |
| 791 return; | 791 return; |
| 792 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) { | 792 if (Persistence.FileSystemWorkspaceBinding.isFileSystemUISourceCode(uiSource
Code)) { |
| 793 var binding = Persistence.persistence.binding(uiSourceCode); | 793 var binding = Persistence.persistence.binding(uiSourceCode); |
| 794 if (!binding) { | 794 if (!binding) { |
| 795 contextMenu.appendItem( | 795 contextMenu.appendItem( |
| 796 Common.UIString.capitalize('Map to ^network ^resource\u2026'), | 796 Common.UIString.capitalize('Map to ^network ^resource\u2026'), |
| 797 this.mapFileSystemToNetwork.bind(this, uiSourceCode)); | 797 this.mapFileSystemToNetwork.bind(this, uiSourceCode)); |
| 798 } else { | 798 } else { |
| 799 contextMenu.appendItem( | 799 contextMenu.appendItem( |
| 800 Common.UIString.capitalize('Remove ^network ^mapping'), | 800 Common.UIString.capitalize('Remove ^network ^mapping'), |
| 801 this._removeNetworkMapping.bind(this, binding.network)); | 801 this._removeNetworkMapping.bind(this, binding.network)); |
| 802 } | 802 } |
| 803 } | 803 } |
| 804 | 804 |
| 805 /** | 805 if (Bindings.NetworkProject.isNetworkUISourceCode(uiSourceCode)) { |
| 806 * @param {!Workspace.Project} project | 806 if (!Persistence.FileSystemWorkspaceBinding.uiSourceCodes(this._workspace)
.length) |
| 807 */ | |
| 808 function filterProject(project) { | |
| 809 return project.type() === Workspace.projectTypes.FileSystem; | |
| 810 } | |
| 811 | |
| 812 if (uiSourceCode.project().type() === Workspace.projectTypes.Network || | |
| 813 uiSourceCode.project().type() === Workspace.projectTypes.ContentScripts)
{ | |
| 814 if (!this._workspace.projects().filter(filterProject).length) | |
| 815 return; | 807 return; |
| 816 if (this._workspace.uiSourceCodeForURL(uiSourceCode.url()) === uiSourceCod
e) { | 808 if (this._workspace.uiSourceCodeForURL(uiSourceCode.url()) === uiSourceCod
e) { |
| 817 contextMenu.appendItem( | 809 contextMenu.appendItem( |
| 818 Common.UIString.capitalize('Map to ^file ^system ^resource\u2026'), | 810 Common.UIString.capitalize('Map to ^file ^system ^resource\u2026'), |
| 819 this.mapNetworkToFileSystem.bind(this, uiSourceCode)); | 811 this.mapNetworkToFileSystem.bind(this, uiSourceCode)); |
| 820 } | 812 } |
| 821 } | 813 } |
| 822 } | 814 } |
| 823 | 815 |
| 824 /** | 816 /** |
| 825 * @param {!Event} event | 817 * @param {!Event} event |
| 826 * @param {!UI.ContextMenu} contextMenu | 818 * @param {!UI.ContextMenu} contextMenu |
| 827 * @param {!Object} target | 819 * @param {!Object} target |
| 828 */ | 820 */ |
| 829 _appendUISourceCodeItems(event, contextMenu, target) { | 821 _appendUISourceCodeItems(event, contextMenu, target) { |
| 830 if (!(target instanceof Workspace.UISourceCode)) | 822 if (!(target instanceof Workspace.UISourceCode)) |
| 831 return; | 823 return; |
| 832 | 824 |
| 833 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target); | 825 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target); |
| 834 var projectType = uiSourceCode.project().type(); | 826 var projectType = uiSourceCode.project().type(); |
| 835 | 827 |
| 836 if (projectType !== Workspace.projectTypes.Debugger && | 828 if (projectType !== Workspace.projectTypes.Debugger && |
| 837 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget().
element)) { | 829 !event.target.isSelfOrDescendant(this._navigatorTabbedLocation.widget().
element)) { |
| 838 contextMenu.appendItem( | 830 contextMenu.appendItem( |
| 839 Common.UIString.capitalize('Reveal in ^navigator'), this._handleContex
tMenuReveal.bind(this, uiSourceCode)); | 831 Common.UIString.capitalize('Reveal in ^navigator'), this._handleContex
tMenuReveal.bind(this, uiSourceCode)); |
| 840 contextMenu.appendSeparator(); | 832 contextMenu.appendSeparator(); |
| 841 } | 833 } |
| 842 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); | 834 this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode); |
| 843 if (projectType !== Workspace.projectTypes.FileSystem) { | 835 if (!uiSourceCode.project().canSetFileContent()) { |
| 844 contextMenu.appendItem( | 836 contextMenu.appendItem( |
| 845 Common.UIString.capitalize('Local ^modifications\u2026'), this._showLo
calHistory.bind(this, uiSourceCode)); | 837 Common.UIString.capitalize('Local ^modifications\u2026'), this._showLo
calHistory.bind(this, uiSourceCode)); |
| 846 } | 838 } |
| 847 } | 839 } |
| 848 | 840 |
| 849 /** | 841 /** |
| 850 * @param {!Event} event | 842 * @param {!Event} event |
| 851 * @param {!UI.ContextMenu} contextMenu | 843 * @param {!UI.ContextMenu} contextMenu |
| 852 * @param {!Object} target | 844 * @param {!Object} target |
| 853 */ | 845 */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 869 var projectType = uiSourceCode.project().type(); | 861 var projectType = uiSourceCode.project().type(); |
| 870 | 862 |
| 871 var contentType = uiSourceCode.contentType(); | 863 var contentType = uiSourceCode.contentType(); |
| 872 if (contentType.hasScripts()) { | 864 if (contentType.hasScripts()) { |
| 873 var target = UI.context.flavor(SDK.Target); | 865 var target = UI.context.flavor(SDK.Target); |
| 874 var debuggerModel = SDK.DebuggerModel.fromTarget(target); | 866 var debuggerModel = SDK.DebuggerModel.fromTarget(target); |
| 875 if (debuggerModel && debuggerModel.isPaused()) { | 867 if (debuggerModel && debuggerModel.isPaused()) { |
| 876 contextMenu.appendItem( | 868 contextMenu.appendItem( |
| 877 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc
ation.bind(this, uiLocation)); | 869 Common.UIString.capitalize('Continue to ^here'), this._continueToLoc
ation.bind(this, uiLocation)); |
| 878 } | 870 } |
| 871 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc
eCode); |
| 879 } | 872 } |
| 880 | |
| 881 if (contentType.hasScripts() && projectType !== Workspace.projectTypes.Snipp
ets) | |
| 882 this._callstackPane.appendBlackboxURLContextMenuItems(contextMenu, uiSourc
eCode); | |
| 883 } | 873 } |
| 884 | 874 |
| 885 /** | 875 /** |
| 886 * @param {!Workspace.UISourceCode} uiSourceCode | 876 * @param {!Workspace.UISourceCode} uiSourceCode |
| 887 */ | 877 */ |
| 888 _handleContextMenuReveal(uiSourceCode) { | 878 _handleContextMenuReveal(uiSourceCode) { |
| 889 this.editorView.showBoth(); | 879 this.editorView.showBoth(); |
| 890 this._revealInNavigator(uiSourceCode); | 880 this._revealInNavigator(uiSourceCode); |
| 891 } | 881 } |
| 892 | 882 |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 */ | 1312 */ |
| 1323 willHide() { | 1313 willHide() { |
| 1324 UI.inspectorView.setDrawerMinimized(false); | 1314 UI.inspectorView.setDrawerMinimized(false); |
| 1325 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); | 1315 setImmediate(() => Sources.SourcesPanel.updateResizerAndSidebarButtons(Sourc
es.SourcesPanel.instance())); |
| 1326 } | 1316 } |
| 1327 | 1317 |
| 1328 _showViewInWrapper() { | 1318 _showViewInWrapper() { |
| 1329 this._view.show(this.element); | 1319 this._view.show(this.element); |
| 1330 } | 1320 } |
| 1331 }; | 1321 }; |
| OLD | NEW |