提交 f5e70c33 编写于 作者: I isidor

debug: rename function breakpoints

上级 1937d52a
......@@ -660,7 +660,7 @@ export class WatchExpressionsController extends BaseDebugController {
}
}
/* protected */ public onLeftClick(tree: tree.ITree, element: any, event: mouse.StandardMouseEvent): boolean {
protected onLeftClick(tree: tree.ITree, element: any, event: mouse.StandardMouseEvent): boolean {
// double click on primitive value: open input box to be able to select and copy value.
if (element instanceof model.Expression && event.detail === 2) {
const expression = <debug.IExpression> element;
......@@ -879,7 +879,8 @@ export class BreakpointsRenderer implements tree.IRenderer {
}
private renderFunctionBreakpoint(tree: tree.ITree, functionBreakpoint: debug.IFunctionBreakpoint, data: IFunctionBreakpointTemplateData): void {
if (!functionBreakpoint.name) {
const selected = this.debugService.getViewModel().getSelectedFunctionBreakpoint();
if (!functionBreakpoint.name || (selected && selected.getId() === functionBreakpoint.getId())) {
renderRenameBox(this.debugService, this.contextViewService, tree, functionBreakpoint, data.breakpoint, nls.localize('functionBreakpointPlaceholder', "Function to break on"), nls.localize('functionBreakPointInputAriaLabel', "Type function breakpoint"));
} else {
this.debugService.getModel().areBreakpointsActivated() ? tree.removeTraits('disabled', [functionBreakpoint]) : tree.addTraits('disabled', [functionBreakpoint]);
......@@ -932,19 +933,24 @@ export class BreakpointsAccessibilityProvider implements tree.IAccessibilityProv
export class BreakpointsController extends BaseDebugController {
/* protected */ public onLeftClick(tree:tree.ITree, element: any, eventish:treedefaults.ICancelableEvent, origin: string = 'mouse'):boolean {
protected onLeftClick(tree:tree.ITree, element: any, event: mouse.StandardMouseEvent): boolean {
if (element instanceof model.ExceptionBreakpoint) {
return false;
}
return super.onLeftClick(tree, element, eventish, origin);
if (element instanceof model.FunctionBreakpoint && event.detail === 2) {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(element);
return true;
}
return super.onLeftClick(tree, element, event);
}
/* protected */ public onUp(tree:tree.ITree, event:keyboard.StandardKeyboardEvent): boolean {
protected onUp(tree:tree.ITree, event:keyboard.StandardKeyboardEvent): boolean {
return this.doNotFocusExceptionBreakpoint(tree, super.onUp(tree, event));
}
/* protected */ public onPageUp(tree:tree.ITree, event:keyboard.StandardKeyboardEvent): boolean {
protected onPageUp(tree:tree.ITree, event:keyboard.StandardKeyboardEvent): boolean {
return this.doNotFocusExceptionBreakpoint(tree, super.onPageUp(tree, event));
}
......
......@@ -165,12 +165,9 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
const unbind = this.tree.addListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
this.tree.addOneTimeListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
});
}).done(null, errors.onUnexpectedError);
......@@ -374,6 +371,21 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
this.debugService.openOrRevealEditor(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.SELECTED_FUNCTION_BREAKPOINT_UPDATED, (fbp: debug.IFunctionBreakpoint) => {
if (!fbp || !(fbp instanceof model.FunctionBreakpoint)) {
return;
}
this.tree.refresh(fbp, false).then(() => {
this.tree.setHighlight(fbp);
this.tree.addOneTimeListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedFunctionBreakpoint(null);
}
});
}).done(null, errors.onUnexpectedError);
}));
}
public getActions(): actions.IAction[] {
......
......@@ -106,7 +106,8 @@ export var ModelEvents = {
export var ViewModelEvents = {
FOCUSED_STACK_FRAME_UPDATED: 'FocusedStackFrameUpdated',
SELECTED_EXPRESSION_UPDATED: 'SelectedExpressionUpdated'
SELECTED_EXPRESSION_UPDATED: 'SelectedExpressionUpdated',
SELECTED_FUNCTION_BREAKPOINT_UPDATED: 'SelectedFunctionBreakpointUpdated'
};
export var ServiceEvents = {
......@@ -132,6 +133,8 @@ export interface IViewModel extends ee.EventEmitter {
getSelectedExpression(): IExpression;
getFocusedThreadId(): number;
setSelectedExpression(expression: IExpression);
getSelectedFunctionBreakpoint(): IFunctionBreakpoint;
setSelectedFunctionBreakpoint(functionBreakpoint: IFunctionBreakpoint): void;
}
export interface IModel extends ee.IEventEmitter, ITreeElement {
......
......@@ -9,6 +9,7 @@ export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debu
private focusedStackFrame: debug.IStackFrame;
private selectedExpression: debug.IExpression;
private selectedFunctionBreakpoint: debug.IFunctionBreakpoint;
public getId(): string {
return 'root';
......@@ -35,4 +36,13 @@ export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debu
this.selectedExpression = expression;
this.emit(debug.ViewModelEvents.SELECTED_EXPRESSION_UPDATED, expression);
}
public getSelectedFunctionBreakpoint(): debug.IFunctionBreakpoint {
return this.selectedFunctionBreakpoint;
}
public setSelectedFunctionBreakpoint(functionBreakpoint: debug.IFunctionBreakpoint): void {
this.selectedFunctionBreakpoint = functionBreakpoint;
this.emit(debug.ViewModelEvents.SELECTED_FUNCTION_BREAKPOINT_UPDATED, functionBreakpoint);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册