mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-24 00:05:46 +01:00
Encapsulated interfaces with part/panel services in terminalService
This commit is contained in:
@@ -6,9 +6,7 @@
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import nls = require('vs/nls');
|
||||
import {Action} from 'vs/base/common/actions';
|
||||
import {IPartService} from 'vs/workbench/services/part/common/partService';
|
||||
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
|
||||
import {TERMINAL_PANEL_ID, ITerminalService} from 'vs/workbench/parts/terminal/common/terminal';
|
||||
import {ITerminalService} from 'vs/workbench/parts/terminal/common/terminal';
|
||||
|
||||
export class ToggleTerminalAction extends Action {
|
||||
|
||||
@@ -17,21 +15,12 @@ export class ToggleTerminalAction extends Action {
|
||||
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IPartService private partService: IPartService,
|
||||
@IPanelService private panelService: IPanelService,
|
||||
@ITerminalService private terminalService: ITerminalService
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(event?: any): TPromise<any> {
|
||||
const panel = this.panelService.getActivePanel();
|
||||
if (panel && panel.getId() === TERMINAL_PANEL_ID) {
|
||||
this.partService.setPanelHidden(true);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
return this.terminalService.show();
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,26 @@
|
||||
|
||||
import {TPromise} from 'vs/base/common/winjs.base';
|
||||
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
|
||||
import {IPartService} from 'vs/workbench/services/part/common/partService';
|
||||
import {ITerminalService, TERMINAL_PANEL_ID} from 'vs/workbench/parts/terminal/common/terminal';
|
||||
|
||||
export class TerminalService implements ITerminalService {
|
||||
public serviceId = ITerminalService;
|
||||
|
||||
constructor(
|
||||
@IPanelService private panelService: IPanelService
|
||||
@IPanelService private panelService: IPanelService,
|
||||
@IPartService private partService: IPartService
|
||||
) {
|
||||
}
|
||||
|
||||
public show(): TPromise<any> {
|
||||
const panel = this.panelService.getActivePanel();
|
||||
if (panel && panel.getId() === TERMINAL_PANEL_ID) {
|
||||
this.partService.setPanelHidden(true);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
return this.panelService.openPanel(TERMINAL_PANEL_ID, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user