提交 f2baddbf 编写于 作者: I isidor

debug: move more logic into breakpoints controller

上级 8877119b
......@@ -1106,10 +1106,26 @@ export class BreakpointsController extends BaseDebugController {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(element);
return true;
}
if (element instanceof model.Breakpoint) {
this.openBreakpointSource(element, event, true);
}
return super.onLeftClick(tree, element, event);
}
protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean {
const element = tree.getFocus();
if (element instanceof model.FunctionBreakpoint) {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(element);
return true;
}
if (element instanceof model.Breakpoint) {
this.openBreakpointSource(element, event, false);
}
return super.onEnter(tree, event);
}
protected onSpace(tree: tree.ITree, event: IKeyboardEvent): boolean {
super.onSpace(tree, event);
const element = <debug.IEnablement>tree.getFocus();
......@@ -1118,7 +1134,6 @@ export class BreakpointsController extends BaseDebugController {
return true;
}
protected onDelete(tree: tree.ITree, event: IKeyboardEvent): boolean {
const element = tree.getFocus();
if (element instanceof model.Breakpoint) {
......@@ -1133,4 +1148,11 @@ export class BreakpointsController extends BaseDebugController {
return false;
}
private openBreakpointSource(breakpoint: debug.IBreakpoint, event: IKeyboardEvent|IMouseEvent, preserveFocus: boolean): void {
if (!breakpoint.source.inMemory) {
const sideBySide = (event && (event.ctrlKey || event.metaKey));
this.debugService.openOrRevealSource(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}
}
......@@ -16,7 +16,7 @@ import treeimpl = require('vs/base/parts/tree/browser/treeImpl');
import splitview = require('vs/base/browser/ui/splitview/splitview');
import viewlet = require('vs/workbench/browser/viewlet');
import debug = require('vs/workbench/parts/debug/common/debug');
import { StackFrame, Expression, Variable, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel';
import { StackFrame, Expression, Variable, ExceptionBreakpoint, FunctionBreakpoint } from 'vs/workbench/parts/debug/common/debugModel';
import viewer = require('vs/workbench/parts/debug/browser/debugViewer');
import debugactions = require('vs/workbench/parts/debug/electron-browser/debugActions');
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
......@@ -347,31 +347,6 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof Breakpoint)) {
return;
}
const breakpoint = <debug.IBreakpoint> element;
if (!breakpoint.source.inMemory) {
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealSource(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}));
this.toDispose.push(this.debugService.getViewModel().onDidSelectFunctionBreakpoint(fbp => {
if (!fbp || !(fbp instanceof FunctionBreakpoint)) {
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册