debugViewModel.ts 1.8 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7 8 9 10 11
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
import ee = require('vs/base/common/eventEmitter');
import debug = require('vs/workbench/parts/debug/common/debug');

export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debug.ITreeElement {

	private focusedStackFrame: debug.IStackFrame;
	private selectedExpression: debug.IExpression;
I
isidor 已提交
12
	private selectedFunctionBreakpoint: debug.IFunctionBreakpoint;
E
Erich Gamma 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

	public getId(): string {
		return 'root';
	}

	public getFocusedStackFrame(): debug.IStackFrame {
		return this.focusedStackFrame;
	}

	public setFocusedStackFrame(focusedStackFrame: debug.IStackFrame): void {
		this.focusedStackFrame = focusedStackFrame;
		this.emit(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED);
	}

	public getFocusedThreadId(): number {
		return this.focusedStackFrame ? this.focusedStackFrame.threadId : 0;
	}

	public getSelectedExpression(): debug.IExpression {
		return this.selectedExpression;
	}

	public setSelectedExpression(expression: debug.IExpression) {
		this.selectedExpression = expression;
		this.emit(debug.ViewModelEvents.SELECTED_EXPRESSION_UPDATED, expression);
	}
I
isidor 已提交
39 40 41 42 43 44 45 46 47

	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);
	}
E
Erich Gamma 已提交
48
}