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 21 matching lines...) Expand all Loading... |
32 * @param {!WebInspector.Workspace=} workspaceForTest | 32 * @param {!WebInspector.Workspace=} workspaceForTest |
33 */ | 33 */ |
34 WebInspector.SourcesPanel = function(workspaceForTest) | 34 WebInspector.SourcesPanel = function(workspaceForTest) |
35 { | 35 { |
36 WebInspector.Panel.call(this, "sources"); | 36 WebInspector.Panel.call(this, "sources"); |
37 this.registerRequiredCSS("sources/sourcesPanel.css"); | 37 this.registerRequiredCSS("sources/sourcesPanel.css"); |
38 new WebInspector.UpgradeFileSystemDropTarget(this.element); | 38 new WebInspector.UpgradeFileSystemDropTarget(this.element); |
39 | 39 |
40 this._workspace = workspaceForTest || WebInspector.workspace; | 40 this._workspace = workspaceForTest || WebInspector.workspace; |
41 | 41 |
42 this.debugToolbar = this._createDebugToolbar(); | 42 this._debugToolbar = this._createDebugToolbar(); |
43 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); | 43 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); |
44 | 44 |
45 const initialDebugSidebarWidth = 225; | 45 const initialDebugSidebarWidth = 225; |
46 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); | 46 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); |
47 this._splitView.enableShowModeSaving(); | 47 this._splitView.enableShowModeSaving(); |
48 this._splitView.show(this.element); | 48 this._splitView.show(this.element); |
49 | 49 |
50 // Create scripts navigator | 50 // Create scripts navigator |
51 const initialNavigatorWidth = 225; | 51 const initialNavigatorWidth = 225; |
52 this.editorView = new WebInspector.SplitView(true, false, "sourcesPanelNavig
atorSplitViewState", initialNavigatorWidth); | 52 this.editorView = new WebInspector.SplitView(true, false, "sourcesPanelNavig
atorSplitViewState", initialNavigatorWidth); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 var active = event.data; | 620 var active = event.data; |
621 this._toggleBreakpointsButton.setToggled(!active); | 621 this._toggleBreakpointsButton.setToggled(!active); |
622 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint
s-list-deactivated", !active); | 622 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint
s-list-deactivated", !active); |
623 this._sourcesView.toggleBreakpointsActiveState(active); | 623 this._sourcesView.toggleBreakpointsActiveState(active); |
624 if (active) | 624 if (active) |
625 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Deacti
vate breakpoints.")); | 625 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Deacti
vate breakpoints.")); |
626 else | 626 else |
627 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Activa
te breakpoints.")); | 627 this._toggleBreakpointsButton.setTitle(WebInspector.UIString("Activa
te breakpoints.")); |
628 }, | 628 }, |
629 | 629 |
| 630 /** |
| 631 * @return {!WebInspector.StatusBar} |
| 632 */ |
630 _createDebugToolbar: function() | 633 _createDebugToolbar: function() |
631 { | 634 { |
632 var debugToolbar = createElementWithClass("div", "scripts-debug-toolbar"
); | 635 var debugToolbar = new WebInspector.StatusBar(); |
| 636 debugToolbar.element.classList.add("scripts-debug-toolbar"); |
633 | 637 |
634 var title, handler; | 638 var title, handler; |
635 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C
trlOrMeta; | 639 var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.C
trlOrMeta; |
636 | 640 |
637 // Run snippet. | 641 // Run snippet. |
638 title = WebInspector.UIString("Run snippet (%s)."); | 642 title = WebInspector.UIString("Run snippet (%s)."); |
639 handler = this._runSnippet.bind(this); | 643 handler = this._runSnippet.bind(this); |
640 this._runSnippetButton = this._createButtonAndRegisterShortcuts("scripts
-run-snippet", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcut
s.RunSnippet); | 644 this._runSnippetButton = this._createButtonAndRegisterShortcuts("scripts
-run-snippet", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcut
s.RunSnippet); |
641 debugToolbar.appendChild(this._runSnippetButton.element); | 645 debugToolbar.appendStatusBarItem(this._runSnippetButton); |
642 this._runSnippetButton.element.classList.add("hidden"); | 646 this._runSnippetButton.element.classList.add("hidden"); |
643 | 647 |
644 // Continue. | 648 // Continue. |
645 this._pauseButton = this._createButtonAndRegisterShortcutsForAction("scr
ipts-pause", "", "debugger.toggle-pause"); | 649 this._pauseButton = this._createButtonAndRegisterShortcutsForAction("scr
ipts-pause", "", "debugger.toggle-pause"); |
646 debugToolbar.appendChild(this._pauseButton.element); | 650 debugToolbar.appendStatusBarItem(this._pauseButton); |
647 | 651 |
648 // Long resume. | 652 // Long resume. |
649 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms
"); | 653 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms
"); |
650 this._longResumeButton = new WebInspector.StatusBarButton(title, "script
s-long-resume"); | 654 this._longResumeButton = new WebInspector.StatusBarButton(title, "script
s-long-resume"); |
651 this._longResumeButton.addEventListener("click", this._longResume.bind(t
his), this); | 655 this._longResumeButton.addEventListener("click", this._longResume.bind(t
his), this); |
652 | 656 |
653 // Step over. | 657 // Step over. |
654 title = WebInspector.UIString("Step over next function call (%s)."); | 658 title = WebInspector.UIString("Step over next function call (%s)."); |
655 handler = this._stepOverClicked.bind(this); | 659 handler = this._stepOverClicked.bind(this); |
656 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); | 660 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); |
657 debugToolbar.appendChild(this._stepOverButton.element); | 661 debugToolbar.appendStatusBarItem(this._stepOverButton); |
658 | 662 |
659 // Step into. | 663 // Step into. |
660 title = WebInspector.UIString("Step into next function call (%s)."); | 664 title = WebInspector.UIString("Step into next function call (%s)."); |
661 handler = this._stepIntoClicked.bind(this); | 665 handler = this._stepIntoClicked.bind(this); |
662 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); | 666 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); |
663 debugToolbar.appendChild(this._stepIntoButton.element); | 667 debugToolbar.appendStatusBarItem(this._stepIntoButton); |
664 | 668 |
665 // Step out. | 669 // Step out. |
666 title = WebInspector.UIString("Step out of current function (%s)."); | 670 title = WebInspector.UIString("Step out of current function (%s)."); |
667 handler = this._stepOutClicked.bind(this); | 671 handler = this._stepOutClicked.bind(this); |
668 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); | 672 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); |
669 debugToolbar.appendChild(this._stepOutButton.element); | 673 debugToolbar.appendStatusBarItem(this._stepOutButton); |
670 | 674 |
671 // Toggle Breakpoints | 675 // Toggle Breakpoints |
672 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 676 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
673 this._toggleBreakpointsButton.setToggled(false); | 677 this._toggleBreakpointsButton.setToggled(false); |
674 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | 678 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); |
675 debugToolbar.appendChild(this._toggleBreakpointsButton.element); | 679 debugToolbar.appendStatusBarItem(this._toggleBreakpointsButton); |
676 | 680 |
677 // Pause on Exception | 681 // Pause on Exception |
678 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item"); | 682 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scr
ipts-pause-on-exceptions-status-bar-item"); |
679 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); | 683 this._pauseOnExceptionButton.addEventListener("click", this._togglePause
OnExceptions, this); |
680 debugToolbar.appendChild(this._pauseOnExceptionButton.element); | 684 debugToolbar.appendStatusBarItem(this._pauseOnExceptionButton); |
681 | 685 |
682 return debugToolbar; | 686 return debugToolbar; |
683 }, | 687 }, |
684 | 688 |
685 _createDebugToolbarDrawer: function() | 689 _createDebugToolbarDrawer: function() |
686 { | 690 { |
687 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to
olbar-drawer"); | 691 var debugToolbarDrawer = createElementWithClass("div", "scripts-debug-to
olbar-drawer"); |
688 | 692 |
689 var label = WebInspector.UIString("Pause On Caught Exceptions"); | 693 var label = WebInspector.UIString("Pause On Caught Exceptions"); |
690 var setting = WebInspector.settings.pauseOnCaughtException; | 694 var setting = WebInspector.settings.pauseOnCaughtException; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 this._splitView.setVertical(!vertically); | 1032 this._splitView.setVertical(!vertically); |
1029 | 1033 |
1030 if (!vertically) | 1034 if (!vertically) |
1031 this._splitView.uninstallResizer(this._sourcesView.statusBarContaine
rElement()); | 1035 this._splitView.uninstallResizer(this._sourcesView.statusBarContaine
rElement()); |
1032 else | 1036 else |
1033 this._splitView.installResizer(this._sourcesView.statusBarContainerE
lement()); | 1037 this._splitView.installResizer(this._sourcesView.statusBarContainerE
lement()); |
1034 | 1038 |
1035 // Create vertical box with stack. | 1039 // Create vertical box with stack. |
1036 var vbox = new WebInspector.VBox(); | 1040 var vbox = new WebInspector.VBox(); |
1037 vbox.element.appendChild(this._debugToolbarDrawer); | 1041 vbox.element.appendChild(this._debugToolbarDrawer); |
1038 vbox.element.appendChild(this.debugToolbar); | 1042 vbox.element.appendChild(this._debugToolbar.element); |
1039 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); | 1043 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo
olbarWidth, 100); |
1040 var sidebarPaneStack = new WebInspector.SidebarPaneStack(); | 1044 var sidebarPaneStack = new WebInspector.SidebarPaneStack(); |
1041 sidebarPaneStack.element.classList.add("flex-auto"); | 1045 sidebarPaneStack.element.classList.add("flex-auto"); |
1042 sidebarPaneStack.show(vbox.element); | 1046 sidebarPaneStack.show(vbox.element); |
1043 | 1047 |
1044 if (!vertically) { | 1048 if (!vertically) { |
1045 // Populate the only stack. | 1049 // Populate the only stack. |
1046 for (var pane in this.sidebarPanes) | 1050 for (var pane in this.sidebarPanes) |
1047 sidebarPaneStack.addPane(this.sidebarPanes[pane]); | 1051 sidebarPaneStack.addPane(this.sidebarPanes[pane]); |
1048 this._extensionSidebarPanesContainer = sidebarPaneStack; | 1052 this._extensionSidebarPanesContainer = sidebarPaneStack; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 | 1417 |
1414 WebInspector.SourcesPanelFactory.prototype = { | 1418 WebInspector.SourcesPanelFactory.prototype = { |
1415 /** | 1419 /** |
1416 * @return {!WebInspector.Panel} | 1420 * @return {!WebInspector.Panel} |
1417 */ | 1421 */ |
1418 createPanel: function() | 1422 createPanel: function() |
1419 { | 1423 { |
1420 return WebInspector.SourcesPanel.instance(); | 1424 return WebInspector.SourcesPanel.instance(); |
1421 } | 1425 } |
1422 } | 1426 } |
OLD | NEW |