importScript("UISourceCodeFrame.js");
importScript("JavaScriptSourceFrame.js");
importScript("CSSSourceFrame.js");
-importScript("NavigatorOverlayController.js");
importScript("NavigatorView.js");
importScript("RevisionHistoryView.js");
importScript("ScopeChainSidebarPane.js");
this.registerRequiredCSS("sourcesPanel.css");
this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplete.
- WebInspector.settings.navigatorWasOnceHidden = WebInspector.settings.createSetting("navigatorWasOnceHidden", false);
+ WebInspector.settings.navigatorHidden = WebInspector.settings.createSetting("navigatorHidden", false);
WebInspector.settings.debuggerSidebarHidden = WebInspector.settings.createSetting("debuggerSidebarHidden", false);
WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetting("showEditorInDrawer", true);
var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));
this.debugToolbar = this._createDebugToolbar();
+ this._debugToolbarDrawer = this._createDebugToolbarDrawer();
this.threadsToolbar = new WebInspector.ThreadsToolbar();
const initialDebugSidebarWidth = 225;
- const minimumDebugSidebarWidthPercent = 0.5;
- this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPosition.End, initialDebugSidebarWidth);
- this.splitView.setSidebarElementConstraints(Preferences.minScriptsSidebarWidth);
- this.splitView.setMainElementConstraints(minimumDebugSidebarWidthPercent);
+ this._splitView = new WebInspector.SplitView(true, true, "sourcesSidebarWidth", initialDebugSidebarWidth);
+ this._splitView.setMainElementConstraints(200, 25);
+ this._splitView.setSidebarElementConstraints(WebInspector.SourcesPanel.minToolbarWidth, 25);
+
+ this._splitView.show(this.element);
+ if (WebInspector.settings.debuggerSidebarHidden.get())
+ this._splitView.hideSidebar();
// Create scripts navigator
const initialNavigatorWidth = 225;
const minimumViewsContainerWidthPercent = 0.5;
- this.editorView = new WebInspector.SidebarView(WebInspector.SidebarView.SidebarPosition.Start, "scriptsPanelNavigatorSidebarWidth", initialNavigatorWidth);
+ this.editorView = new WebInspector.SplitView(true, false, "scriptsPanelNavigatorSidebarWidth", initialNavigatorWidth);
+ if (WebInspector.settings.navigatorHidden.get())
+ this.editorView.hideSidebar();
this.editorView.element.id = "scripts-editor-split-view";
this.editorView.element.tabIndex = 0;
- this.editorView.setSidebarElementConstraints(Preferences.minScriptsSidebarWidth);
+ this.editorView.setSidebarElementConstraints(Preferences.minSidebarWidth);
this.editorView.setMainElementConstraints(minimumViewsContainerWidthPercent);
- this.splitView.setMainView(this.editorView);
+ this.editorView.show(this._splitView.mainElement());
this._navigator = new WebInspector.SourcesNavigator();
- this.editorView.setSidebarView(this._navigator.view);
+ this._navigator.view.show(this.editorView.sidebarElement());
var tabbedEditorPlaceholderText = WebInspector.isMac() ? WebInspector.UIString("Hit Cmd+O to open a file") : WebInspector.UIString("Hit Ctrl+O to open a file");
this._editorContainer = new WebInspector.TabbedEditorContainer(this, "previouslyViewedFiles", tabbedEditorPlaceholderText);
this._editorContainer.show(this._searchableView.element);
- this._navigatorController = new WebInspector.NavigatorOverlayController(this.editorView, this._navigator.view, this._editorContainer.view);
-
this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.SourceSelected, this._sourceSelected, this);
this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.ItemSearchStarted, this._itemSearchStarted, this);
this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.ItemCreationRequested, this._itemCreationRequested, this);
this._debugSidebarResizeWidgetElement = document.createElementWithClass("div", "resizer-widget");
this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-widget";
- this.splitView.installResizer(this._debugSidebarResizeWidgetElement);
+ this._splitView.installResizer(this._debugSidebarResizeWidgetElement);
this.sidebarPanes = {};
this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane();
this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPane.Events.CallFrameRestarted, this._callFrameRestartedInSidebar.bind(this));
this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
- this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this));
+ this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(WebInspector.debuggerModel, WebInspector.breakpointManager, this._showSourceLocation.bind(this));
this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.createProxy(this);
this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPane();
this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerBreakpointsSidebarPane();
- if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFrontend()) {
- WorkerAgent.enable();
- this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebInspector.workerManager);
- }
+ if (Capabilities.canInspectWorkers && !WebInspector.isWorkerFrontend())
+ this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane();
/**
* @this {WebInspector.SourcesPanel}
this._scriptViewStatusBarItemsContainer.className = "inline-block";
this._scriptViewStatusBarTextContainer = document.createElement("div");
- this._scriptViewStatusBarTextContainer.className = "inline-block";
+ this._scriptViewStatusBarTextContainer.className = "hbox";
this._statusBarContainerElement = this.sourcesView.element.createChild("div", "sources-status-bar");
this._statusBarContainerElement.appendChild(this._toggleFormatSourceButton.element);
/** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.SourceFrame>} */
this._sourceFramesByUISourceCode = new Map();
this._updateDebuggerButtons();
- this._pauseOnExceptionStateChanged();
+ this._pauseOnExceptionEnabledChanged();
if (WebInspector.debuggerModel.isPaused())
this._showDebuggerPausedDetails();
- WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pauseOnExceptionStateChanged, this);
+ WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseOnExceptionEnabledChanged, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._debuggerWasDisabled, this);
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true);
}
+WebInspector.SourcesPanel.minToolbarWidth = 215;
+
WebInspector.SourcesPanel.prototype = {
/**
* @param {?Event=} event
wasShown: function()
{
WebInspector.inspectorView.closeViewInDrawer("editor");
- this.editorView.setMainView(this.sourcesView);
+ this.sourcesView.show(this.editorView.mainElement());
WebInspector.Panel.prototype.wasShown.call(this);
- this._navigatorController.wasShown();
this.element.addEventListener("keydown", this._boundOnKeyDown, false);
this.element.addEventListener("keyup", this._boundOnKeyUp, false);
*/
function didGetUILocation(uiLocation)
{
- var breakpoint = WebInspector.breakpointManager.findBreakpoint(uiLocation.uiSourceCode, uiLocation.lineNumber);
+ var breakpoint = WebInspector.breakpointManager.findBreakpointOnLine(uiLocation.uiSourceCode, uiLocation.lineNumber);
if (!breakpoint)
return;
this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint);
},
/**
- * @param {!Element} anchor
- * @return {boolean}
- */
- showAnchorLocation: function(anchor)
- {
- if (!anchor.uiSourceCode) {
- var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(anchor.href);
- if (uiSourceCode)
- anchor.uiSourceCode = uiSourceCode;
- }
- if (!anchor.uiSourceCode)
- return false;
-
- this._showSourceLocation(anchor.uiSourceCode, anchor.lineNumber, anchor.columnNumber);
- return true;
- },
-
- /**
* @param {!WebInspector.UISourceCode} uiSourceCode
* @param {number=} lineNumber
* @param {number=} columnNumber
_editorClosed: function(event)
{
- this._navigatorController.hideNavigatorOverlay();
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
this._historyManager.removeHistoryForSourceCode(uiSourceCode);
if (shouldUseHistoryManager)
this._historyManager.pushNewState();
- this._navigatorController.hideNavigatorOverlay();
- if (!this._navigatorController.isNavigatorPinned())
- sourceFrame.focus();
this._searchableView.setReplaceable(!!sourceFrame && sourceFrame.canEditSource());
this._searchableView.resetSearch();
},
if (shouldUseHistoryManager)
this._historyManager.pushNewState();
- this._navigatorController.hideNavigatorOverlay();
- if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || event.data.focusSource))
+ if (sourceFrame && event.data.focusSource)
sourceFrame.focus();
},
WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement(), searchText);
},
- _pauseOnExceptionStateChanged: function()
+ _pauseOnExceptionEnabledChanged: function()
{
- var pauseOnExceptionsState = WebInspector.settings.pauseOnExceptionStateString.get();
- switch (pauseOnExceptionsState) {
- case WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions:
- this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
- break;
- case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions:
- this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions.");
- break;
- case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions:
- this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions.");
- break;
- }
- this._pauseOnExceptionButton.state = pauseOnExceptionsState;
+ var enabled = WebInspector.settings.pauseOnExceptionEnabled.get();
+ this._pauseOnExceptionButton.toggled = enabled;
+ this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Don't pause on exceptions." : "Pause on exceptions.");
+ this._debugToolbarDrawer.enableStyleClass("expanded", enabled);
},
_updateDebuggerButtons: function()
_togglePauseOnExceptions: function()
{
- var nextStateMap = {};
- var stateEnum = WebInspector.DebuggerModel.PauseOnExceptionsState;
- nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExceptions;
- nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaughtExceptions;
- nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseOnExceptions;
- WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this._pauseOnExceptionButton.state]);
+ WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptionButton.toggled);
},
/**
debugToolbar.appendChild(this._toggleBreakpointsButton.element);
// Pause on Exception
- this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
+ this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item");
this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions, this);
debugToolbar.appendChild(this._pauseOnExceptionButton.element);
return debugToolbar;
},
+ _createDebugToolbarDrawer: function()
+ {
+ var debugToolbarDrawer = document.createElement("div");
+ debugToolbarDrawer.className = "scripts-debug-toolbar-drawer";
+
+ var label = WebInspector.UIString("Pause On Caught Exceptions");
+ var setting = WebInspector.settings.pauseOnCaughtException;
+ debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingCheckbox(label, setting, true));
+
+ return debugToolbarDrawer;
+ },
+
/**
* @param {!WebInspector.StatusBarButton} button
* @param {string} buttonTitle
_installDebuggerSidebarController: function()
{
+ this._toggleNavigatorSidebarButton = new WebInspector.StatusBarButton("", "left-sidebar-show-hide-button", 3);
+ this._toggleNavigatorSidebarButton.addEventListener("click", navigatorHandler, this);
+ this.sourcesView.element.appendChild(this._toggleNavigatorSidebarButton.element);
+ this._enableNavigatorSidebar(!WebInspector.settings.navigatorHidden.get());
+
this._toggleDebuggerSidebarButton = new WebInspector.StatusBarButton("", "right-sidebar-show-hide-button scripts-debugger-show-hide-button", 3);
- this._toggleDebuggerSidebarButton.addEventListener("click", clickHandler, this);
+ this._toggleDebuggerSidebarButton.addEventListener("click", debuggerHandler, this);
- if (this.splitView.isVertical()) {
+ if (this._splitView.isVertical()) {
this.editorView.element.appendChild(this._toggleDebuggerSidebarButton.element);
- this.splitView.mainElement().appendChild(this._debugSidebarResizeWidgetElement);
+ this._splitView.mainElement().appendChild(this._debugSidebarResizeWidgetElement);
} else {
this._statusBarContainerElement.appendChild(this._debugSidebarResizeWidgetElement);
this._statusBarContainerElement.appendChild(this._toggleDebuggerSidebarButton.element);
/**
* @this {WebInspector.SourcesPanel}
*/
- function clickHandler()
+ function navigatorHandler()
+ {
+ this._enableNavigatorSidebar(this._toggleNavigatorSidebarButton.state === "right");
+ }
+
+ /**
+ * @this {WebInspector.SourcesPanel}
+ */
+ function debuggerHandler()
{
this._enableDebuggerSidebar(this._toggleDebuggerSidebarButton.state === "left");
}
/**
* @param {boolean} show
*/
+ _enableNavigatorSidebar: function(show)
+ {
+ this._toggleNavigatorSidebarButton.state = show ? "left" : "right";
+ this._toggleNavigatorSidebarButton.title = show ? WebInspector.UIString("Hide navigator") : WebInspector.UIString("Show navigator");
+ if (show)
+ this.editorView.showBoth(true);
+ else
+ this.editorView.hideSidebar(true);
+ WebInspector.settings.navigatorHidden.set(!show);
+ },
+
+ /**
+ * @param {boolean} show
+ */
_enableDebuggerSidebar: function(show)
{
this._toggleDebuggerSidebarButton.state = show ? "right" : "left";
this._toggleDebuggerSidebarButton.title = show ? WebInspector.UIString("Hide debugger") : WebInspector.UIString("Show debugger");
if (show)
- this.splitView.showSidebarElement();
+ this._splitView.showBoth(true);
else
- this.splitView.hideSidebarElement();
+ this._splitView.hideSidebar(true);
this._debugSidebarResizeWidgetElement.enableStyleClass("hidden", !show);
WebInspector.settings.debuggerSidebarHidden.set(!show);
},
var path = event.data.path;
var uiSourceCodeToCopy = event.data.uiSourceCode;
var filePath;
- var shouldHideNavigator;
var uiSourceCode;
/**
filePath = path;
uiSourceCode = project.uiSourceCode(filePath);
this._showSourceLocation(uiSourceCode);
-
- shouldHideNavigator = !this._navigatorController.isNavigatorPinned();
- if (this._navigatorController.isNavigatorHidden())
- this._navigatorController.showNavigatorOverlay();
this._navigator.rename(uiSourceCode, callback.bind(this));
}
*/
function callback(committed)
{
- if (shouldHideNavigator)
- this._navigatorController.hideNavigatorOverlay();
-
if (!committed) {
project.deleteFile(uiSourceCode);
return;
_itemRenamingRequested: function(event)
{
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
-
- var shouldHideNavigator = !this._navigatorController.isNavigatorPinned();
- if (this._navigatorController.isNavigatorHidden())
- this._navigatorController.showNavigatorOverlay();
this._navigator.rename(uiSourceCode, callback.bind(this));
/**
*/
function callback(committed)
{
- if (shouldHideNavigator && committed)
- this._navigatorController.hideNavigatorOverlay();
this._recreateSourceFrameIfNeeded(uiSourceCode);
this._navigator.updateIcon(uiSourceCode);
this._showSourceLocation(uiSourceCode);
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (target);
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Local modifications\u2026" : "Local Modifications\u2026"), this._showLocalHistory.bind(this, uiSourceCode));
-
- if (WebInspector.isolatedFileSystemManager.supportsFileSystems())
- this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
+ this._appendUISourceCodeMappingItems(contextMenu, uiSourceCode);
},
/**
*/
_splitVertically: function(vertically)
{
- if (this.sidebarPaneView && vertically === !this.splitView.isVertical())
+ if (this.sidebarPaneView && vertically === !this._splitView.isVertical())
return;
if (this.sidebarPaneView)
this.sidebarPaneView.detach();
- this.splitView.setVertical(!vertically);
+ this._splitView.setVertical(!vertically);
// Update resizer widgets.
if (!vertically) {
- this.splitView.uninstallResizer(this._statusBarContainerElement);
+ this._splitView.uninstallResizer(this._statusBarContainerElement);
this.editorView.element.appendChild(this._toggleDebuggerSidebarButton.element);
- this.splitView.mainElement().appendChild(this._debugSidebarResizeWidgetElement);
+ this._splitView.mainElement().appendChild(this._debugSidebarResizeWidgetElement);
} else {
- this.splitView.installResizer(this._statusBarContainerElement);
+ this._splitView.installResizer(this._statusBarContainerElement);
this._statusBarContainerElement.appendChild(this._debugSidebarResizeWidgetElement);
this._statusBarContainerElement.appendChild(this._toggleDebuggerSidebarButton.element)
}
// Create vertical box with stack.
var vbox = new WebInspector.View();
+ vbox.element.appendChild(this._debugToolbarDrawer);
vbox.element.appendChild(this.debugToolbar);
vbox.element.appendChild(this.threadsToolbar.element);
var sidebarPaneStack = new WebInspector.SidebarPaneStack();
this.sidebarPaneView = vbox;
} else {
- var splitView = new WebInspector.SplitView(true, this.name + "PanelSplitSidebarRatio", 0.5);
- splitView.setFirstView(vbox);
+ var splitView = new WebInspector.SplitView(true, true, this.name + "PanelSplitSidebarRatio", 0.5);
+ splitView.setMainElementConstraints(WebInspector.SourcesPanel.minToolbarWidth, 25);
+ vbox.show(splitView.mainElement());
// Populate the left stack.
sidebarPaneStack.addPane(this.sidebarPanes.callstack);
sidebarPaneStack.addPane(this.sidebarPanes.workerList);
var tabbedPane = new WebInspector.SidebarTabbedPane();
- splitView.setSecondView(tabbedPane);
+ tabbedPane.show(splitView.sidebarElement());
tabbedPane.addPane(this.sidebarPanes.scopechain);
tabbedPane.addPane(this.sidebarPanes.watchExpressions);
this._extensionSidebarPanesContainer = tabbedPane;
for (var i = 0; i < this._extensionSidebarPanes.length; ++i)
this._extensionSidebarPanesContainer.addPane(this._extensionSidebarPanes[i]);
- this.splitView.setSidebarView(this.sidebarPaneView);
+ this.sidebarPaneView.show(this._splitView.sidebarElement());
this.sidebarPanes.scopechain.expand();
this.sidebarPanes.jsBreakpoints.expand();
reveal: function(uiLocation)
{
if (uiLocation instanceof WebInspector.UILocation)
- /** @type {!WebInspector.SourcesPanel} */ (WebInspector.showPanel("sources")).showUILocation(uiLocation);
+ /** @type {!WebInspector.SourcesPanel} */ (WebInspector.panel("sources")).showUILocation(uiLocation);
}
}