提交 4f26974f 编写于 作者: D Dirk Baeumer

First cut of #23752: Task dialog switches to output view

上级 337ded05
......@@ -100,6 +100,7 @@ export interface ITaskResolver {
export interface ITaskSystem extends IEventEmitter {
run(task: Task, resolver: ITaskResolver): ITaskExecuteResult;
show(task: Task, forceFocus?: boolean): void;
isActive(): TPromise<boolean>;
isActiveSync(): boolean;
getActiveTasks(): Task[];
......
......@@ -444,6 +444,9 @@ class NullTaskSystem extends EventEmitter implements ITaskSystem {
promise: TPromise.as<ITaskSummary>({})
};
}
public show(task: Task, forceFocus: boolean = false): void {
return;
}
public isActive(): TPromise<boolean> {
return TPromise.as(false);
}
......@@ -929,8 +932,13 @@ class TaskService extends EventEmitter implements ITaskService {
let executeResult = this.getTaskSystem().run(task, resolver);
if (executeResult.kind === TaskExecuteKind.Active) {
let active = executeResult.active;
if (active.same && active.background) {
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame', 'The task is already active and in watch mode. To terminate the task use `F1 > terminate task`'));
if (active.same) {
if (active.background) {
this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.background', 'The task is already active and in background mode. To terminate the task use `F1 > terminate task`'));
} else {
this.getTaskSystem().show(task, true);
// this.messageService.show(Severity.Info, nls.localize('TaskSystem.activeSame.noBackground', 'The task is already active. To terminate the task use `F1 > terminate task`'));
}
} else {
throw new TaskError(Severity.Warning, nls.localize('TaskSystem.active', 'There is already a task running. Terminate it first before executing another task.'), TaskErrors.RunningTask);
}
......
......@@ -156,6 +156,15 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
}
}
public show(task: Task, forceFocus: boolean = false): void {
let terminalData = this.activeTasks[task._id];
if (terminalData === void 0) {
return;
}
this.terminalService.setActiveInstance(terminalData.terminal);
this.terminalService.showPanel(forceFocus);
}
public isActive(): TPromise<boolean> {
return TPromise.as(this.isActiveSync());
}
......
......@@ -89,6 +89,10 @@ export class ProcessTaskSystem extends EventEmitter implements ITaskSystem {
return this.executeTask(task);
}
public show(task: Task, forceFocus: boolean = false): void {
this.outputChannel.show(!focus);
}
public hasErrors(value: boolean): void {
this.errorsShown = !value;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册