提交 62d8d4c2 编写于 作者: S Sandeep Somavarapu

Toggle display for problems view

上级 40a87b0a
......@@ -11,6 +11,7 @@ import {Composite, CompositeDescriptor, CompositeRegistry} from 'vs/workbench/br
import { Action } from 'vs/base/common/actions';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
export abstract class Panel extends Composite implements IPanel { }
......@@ -74,6 +75,7 @@ export abstract class TogglePanelAction extends Action {
label: string,
panelId: string,
protected panelService: IPanelService,
private partService: IPartService,
private editorService: IWorkbenchEditorService
) {
super(id, name);
......@@ -81,18 +83,13 @@ export abstract class TogglePanelAction extends Action {
}
public run(): TPromise<any> {
// Pass focus to panel if not showing or not focussed
if (!this.isPanelShowing() || !this.isPanelFocussed()) {
return this.panelService.openPanel(this.panelId, true);
}
// Otherwise pass focus to editor if possible
let editor = this.editorService.getActiveEditor();
if (editor) {
editor.focus();
if (this.isPanelShowing()) {
this.partService.setPanelHidden(true);
return TPromise.as(true);
}
return TPromise.as(true);
return this.panelService.openPanel(this.panelId, true);
}
private isPanelShowing(): boolean {
......
......@@ -30,12 +30,12 @@ export class ToggleProblemsPanelAction extends TogglePanelAction {
public static ID:string = 'workbench.actions.view.problems';
constructor(id: string, label: string,
@IPartService private partService: IPartService,
@IPartService partService: IPartService,
@IPanelService panelService: IPanelService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@ITelemetryService private telemetryService: ITelemetryService
) {
super(id, label, Constants.MARKERS_PANEL_ID, panelService, editorService);
super(id, label, Constants.MARKERS_PANEL_ID, panelService, partService, editorService);
}
public run(): TPromise<any> {
......@@ -52,12 +52,12 @@ export class ToggleErrorsAndWarningsAction extends TogglePanelAction {
public static ID:string = 'workbench.action.showErrorsWarnings';
constructor(id: string, label: string,
@IPartService private partService: IPartService,
@IPartService partService: IPartService,
@IPanelService panelService: IPanelService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@ITelemetryService private telemetryService: ITelemetryService
) {
super(id, label, Constants.MARKERS_PANEL_ID, panelService, editorService);
super(id, label, Constants.MARKERS_PANEL_ID, panelService, partService, editorService);
}
public run(): TPromise<any> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册