Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2485573009: DevTools: Move the Run Snippet button into the status bar. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
34 super('sources'); 34 super('sources');
35 WebInspector.SourcesPanel._instance = this; 35 WebInspector.SourcesPanel._instance = this;
36 this.registerRequiredCSS('sources/sourcesPanel.css'); 36 this.registerRequiredCSS('sources/sourcesPanel.css');
37 new WebInspector.DropTarget( 37 new WebInspector.DropTarget(
38 this.element, [WebInspector.DropTarget.Types.Files], WebInspector.UIStri ng('Drop workspace folder here'), 38 this.element, [WebInspector.DropTarget.Types.Files], WebInspector.UIStri ng('Drop workspace folder here'),
39 this._handleDrop.bind(this)); 39 this._handleDrop.bind(this));
40 40
41 this._workspace = WebInspector.workspace; 41 this._workspace = WebInspector.workspace;
42 this._networkMapping = WebInspector.networkMapping; 42 this._networkMapping = WebInspector.networkMapping;
43 43
44 this._runSnippetAction =
45 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.run-snippet'));
46 this._togglePauseAction = 44 this._togglePauseAction =
47 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-pause')); 45 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-pause'));
48 this._stepOverAction = 46 this._stepOverAction =
49 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-over')); 47 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-over'));
50 this._stepIntoAction = 48 this._stepIntoAction =
51 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-into')); 49 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.step-into'));
52 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action('debugger.step-out')); 50 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action('debugger.step-out'));
53 this._toggleBreakpointsActiveAction = 51 this._toggleBreakpointsActiveAction =
54 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-breakpoints-active')); 52 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action( 'debugger.toggle-breakpoints-active'));
55 53
(...skipping 21 matching lines...) Expand all
77 var tabbedPane = this._navigatorTabbedLocation.tabbedPane(); 75 var tabbedPane = this._navigatorTabbedLocation.tabbedPane();
78 tabbedPane.setMinimumSize(100, 25); 76 tabbedPane.setMinimumSize(100, 25);
79 tabbedPane.element.classList.add('navigator-tabbed-pane'); 77 tabbedPane.element.classList.add('navigator-tabbed-pane');
80 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true); 78 var navigatorMenuButton = new WebInspector.ToolbarMenuButton(this._populateN avigatorMenu.bind(this), true);
81 navigatorMenuButton.setTitle(WebInspector.UIString('More options')); 79 navigatorMenuButton.setTitle(WebInspector.UIString('More options'));
82 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton); 80 tabbedPane.rightToolbar().appendToolbarItem(navigatorMenuButton);
83 this.editorView.setSidebarWidget(tabbedPane); 81 this.editorView.setSidebarWidget(tabbedPane);
84 82
85 this._sourcesView = new WebInspector.SourcesView(); 83 this._sourcesView = new WebInspector.SourcesView();
86 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); 84 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this));
87 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this));
88 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); 85 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this));
89 86
90 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu tton('navigator'); 87 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSidebarBu tton('navigator');
91 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB utton('debugger'); 88 this._toggleDebuggerSidebarButton = this._splitWidget.createShowHideSidebarB utton('debugger');
92 this.editorView.setMainWidget(this._sourcesView); 89 this.editorView.setMainWidget(this._sourcesView);
93 this._editorChanged(this._sourcesView.currentUISourceCode());
94 90
95 this._threadsSidebarPane = null; 91 this._threadsSidebarPane = null;
96 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view('sources.watch')); 92 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view('sources.watch'));
97 // TODO: Force installing listeners from the model, not the UI. 93 // TODO: Force installing listeners from the model, not the UI.
98 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); 94 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane);
99 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane); 95 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane);
100 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); 96 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this));
101 97
102 WebInspector.moduleSetting('sidebarPosition').addChangeListener(this._update SidebarPosition.bind(this)); 98 WebInspector.moduleSetting('sidebarPosition').addChangeListener(this._update SidebarPosition.bind(this));
103 this._updateSidebarPosition(); 99 this._updateSidebarPosition();
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 552
557 WebInspector.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContex t, uiSourceCode); 553 WebInspector.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContex t, uiSourceCode);
558 return true; 554 return true;
559 } 555 }
560 556
561 /** 557 /**
562 * @param {!WebInspector.Event} event 558 * @param {!WebInspector.Event} event
563 */ 559 */
564 _editorSelected(event) { 560 _editorSelected(event) {
565 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 561 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
566 this._editorChanged(uiSourceCode);
567 if (this.editorView.mainWidget() && WebInspector.moduleSetting('autoRevealIn Navigator').get()) 562 if (this.editorView.mainWidget() && WebInspector.moduleSetting('autoRevealIn Navigator').get())
568 this._revealInNavigator(uiSourceCode, true); 563 this._revealInNavigator(uiSourceCode, true);
569 } 564 }
570 565
571 /** 566 /**
572 * @param {!WebInspector.Event} event
573 */
574 _editorClosed(event) {
575 var wasSelected = /** @type {boolean} */ (event.data.wasSelected);
576 if (wasSelected)
577 this._editorChanged(null);
578 }
579
580 /**
581 * @param {?WebInspector.UISourceCode} uiSourceCode
582 */
583 _editorChanged(uiSourceCode) {
584 var isSnippet = uiSourceCode && uiSourceCode.project().type() === WebInspect or.projectTypes.Snippets;
585 this._runSnippetButton.setVisible(isSnippet);
586 }
587
588 /**
589 * @return {boolean} 567 * @return {boolean}
590 */ 568 */
591 _togglePause() { 569 _togglePause() {
592 var target = WebInspector.context.flavor(WebInspector.Target); 570 var target = WebInspector.context.flavor(WebInspector.Target);
593 if (!target) 571 if (!target)
594 return true; 572 return true;
595 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 573 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
596 if (!debuggerModel) 574 if (!debuggerModel)
597 return true; 575 return true;
598 576
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 this._toggleBreakpointsActiveAction.setToggled(!active); 678 this._toggleBreakpointsActiveAction.setToggled(!active);
701 this._sourcesView.toggleBreakpointsActiveState(active); 679 this._sourcesView.toggleBreakpointsActiveState(active);
702 } 680 }
703 681
704 /** 682 /**
705 * @return {!WebInspector.Toolbar} 683 * @return {!WebInspector.Toolbar}
706 */ 684 */
707 _createDebugToolbar() { 685 _createDebugToolbar() {
708 var debugToolbar = new WebInspector.Toolbar('scripts-debug-toolbar'); 686 var debugToolbar = new WebInspector.Toolbar('scripts-debug-toolbar');
709 687
710 this._runSnippetButton = WebInspector.Toolbar.createActionButton(this._runSn ippetAction);
711 debugToolbar.appendToolbarItem(this._runSnippetButton);
712 this._runSnippetButton.setVisible(false);
713
714 var longResumeButton = new WebInspector.ToolbarButton( 688 var longResumeButton = new WebInspector.ToolbarButton(
715 WebInspector.UIString('Resume with all pauses blocked for 500 ms'), 'pla y-toolbar-item'); 689 WebInspector.UIString('Resume with all pauses blocked for 500 ms'), 'pla y-toolbar-item');
716 longResumeButton.addEventListener('click', this._longResume.bind(this), this ); 690 longResumeButton.addEventListener('click', this._longResume.bind(this), this );
717 debugToolbar.appendToolbarItem( 691 debugToolbar.appendToolbarItem(
718 WebInspector.Toolbar.createActionButton(this._togglePauseAction, [longRe sumeButton], [])); 692 WebInspector.Toolbar.createActionButton(this._togglePauseAction, [longRe sumeButton], []));
719 693
720 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOverAction)); 694 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOverAction));
721 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepIntoAction)); 695 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepIntoAction));
722 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOutAction)); 696 debugToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this. _stepOutAction));
723 debugToolbar.appendSeparator(); 697 debugToolbar.appendSeparator();
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 */ 1323 */
1350 willHide() { 1324 willHide() {
1351 WebInspector.inspectorView.setDrawerMinimized(false); 1325 WebInspector.inspectorView.setDrawerMinimized(false);
1352 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButtons( WebInspector.SourcesPanel.instance())); 1326 setImmediate(() => WebInspector.SourcesPanel.updateResizerAndSidebarButtons( WebInspector.SourcesPanel.instance()));
1353 } 1327 }
1354 1328
1355 _showViewInWrapper() { 1329 _showViewInWrapper() {
1356 this._view.show(this.element); 1330 this._view.show(this.element);
1357 } 1331 }
1358 }; 1332 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698