From 62d8d4c2b478a9da566c45bb540022dda6221357 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 24 Jun 2016 13:44:50 +0200 Subject: [PATCH] Toggle display for problems view --- src/vs/workbench/browser/panel.ts | 15 ++++++--------- .../parts/markers/browser/markersPanelActions.ts | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/browser/panel.ts b/src/vs/workbench/browser/panel.ts index 675efe7e768..94ab7cb0e4c 100644 --- a/src/vs/workbench/browser/panel.ts +++ b/src/vs/workbench/browser/panel.ts @@ -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 { - // 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 { diff --git a/src/vs/workbench/parts/markers/browser/markersPanelActions.ts b/src/vs/workbench/parts/markers/browser/markersPanelActions.ts index ce2c4ede600..89ef86765ed 100644 --- a/src/vs/workbench/parts/markers/browser/markersPanelActions.ts +++ b/src/vs/workbench/parts/markers/browser/markersPanelActions.ts @@ -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 { @@ -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 { -- GitLab